Custom metadata fields
Generated from core/api/router.go. Edit the router, not this file.
| Method | Path | Who can call it |
|---|---|---|
GET | /api/v1/metadata-fields | Any authenticated user |
POST | /api/v1/metadata-fields | Admin |
PUT | /api/v1/metadata-fields/:id | Admin |
DELETE | /api/v1/metadata-fields/:id | Admin |
GET /api/v1/metadata-fields
| Who can call it | Any authenticated user |
| Handler | metadataHandler.List |
| Display token | Readable by an unattended screen |
Readable by anyone, because a viewer needs the labels to make sense of the values on a certificate. Defining them is admin-only: a required field changes what everyone else has to supply to get a certificate.
Parameters
| Name | In | Default | |
|---|---|---|---|
include_archived | query |
Responses
| Status | Body |
|---|---|
200 | An object with data (MetadataField[]), total |
500 | { "error": … } |
Example request
bash
curl -X GET 'https://certpilot.example.com/api/v1/metadata-fields' \
-H 'Authorization: Bearer <token>'POST /api/v1/metadata-fields
| Who can call it | Admin |
| Handler | metadataHandler.Create |
| Display token | Refused — not a viewer-safe GET |
Request body
MetadataFieldInput is the payload for creating or updating a field.
| Field | Type | Description | |
|---|---|---|---|
label | string | required | |
field_type | string | required | |
options | struct[] | ||
display | string | ||
help_text | string | ||
is_required | boolean | ||
sort_order | integer | ||
is_archived | boolean |
Responses
| Status | Body |
|---|---|
201 | Created |
400 | { "error": … } |
409 | { "error": … } |
500 | { "error": … } |
Example request
bash
curl -X POST 'https://certpilot.example.com/api/v1/metadata-fields' \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{
"label": "<label>",
"field_type": "<field_type>",
"options": [
"<struct>"
],
"display": "<display>",
"help_text": "<help_text>"
}'PUT /api/v1/metadata-fields/:id
| Who can call it | Admin |
| Handler | metadataHandler.Update |
| Display token | Refused — not a viewer-safe GET |
Parameters
| Name | In | Default | |
|---|---|---|---|
id | path | required |
Request body
MetadataFieldInput is the payload for creating or updating a field.
| Field | Type | Description | |
|---|---|---|---|
label | string | required | |
field_type | string | required | |
options | struct[] | ||
display | string | ||
help_text | string | ||
is_required | boolean | ||
sort_order | integer | ||
is_archived | boolean |
Responses
| Status | Body |
|---|---|
200 | Success |
400 | { "error": … } |
404 | { "error": … } |
500 | { "error": … } |
Example request
bash
curl -X PUT 'https://certpilot.example.com/api/v1/metadata-fields/<id>' \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{
"label": "<label>",
"field_type": "<field_type>",
"options": [
"<struct>"
],
"display": "<display>",
"help_text": "<help_text>"
}'DELETE /api/v1/metadata-fields/:id
| Who can call it | Admin |
| Handler | metadataHandler.Archive |
| Display token | Refused — not a viewer-safe GET |
Parameters
| Name | In | Default | |
|---|---|---|---|
id | path | required |
Responses
| Status | Body |
|---|---|
200 | An object with archived, note (string) |
404 | { "error": … } |
500 | { "error": … } |
Example request
bash
curl -X DELETE 'https://certpilot.example.com/api/v1/metadata-fields/<id>' \
-H 'Authorization: Bearer <token>'