Spaces method and path for this operation:
Refer to Spaces for more information.
Creates a field definition in the field library. You must have the "Manage templates" sub-privilege for the Cases feature of the owning solution. Requires the Cases feature to be enabled in the space. Use dry_run=true to validate the request without writing anything.
Query parameters
-
When true, runs authorization, body, and name-uniqueness validation without creating the field definition. Returns
{ "valid": true }on success.Default value is
false.
Body
Required
-
The field definition as a YAML string describing a single field (type, label, control, metadata).
Maximum length is
30000. -
Optional human-readable description of the field's purpose.
Maximum length is
1000. -
When true, this field is rendered in every case for this owner, regardless of the template used. Global fields cannot be demoted (set to false) while they are linked to an active custom field in the Cases configuration.
-
The field name, unique per owner (case-insensitive). Must match the
namekey inside the YAML definition. When omitted, the name is extracted from the definition YAML automatically. Immutable after creation.Minimum length is
1, maximum length is50. -
The application that owns this field definition.
Minimum length is
1, maximum length is30.
Responses
-
Indicates a successful call. Returns the created field definition, or
{ "valid": true }whendry_run=true. -
The request body is invalid, the YAML definition is malformed, the
namedoes not match the YAML definition'sname, or the owner already has 200 field definitions. -
Authorization information is missing or invalid.
-
The user does not have the manage templates privilege for the owner.
-
A field definition with the same name already exists for the owner.
curl \
--request POST 'https://localhost:5601/api/cases/field_definitions' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--data '{
"definition": "name: priority\nlabel: Priority\ntype: keyword\ncontrol: SELECT_BASIC\nmetadata:\n options: [low, medium, high]\n default: medium\n",
"description": "Ticket priority level.",
"isGlobal": false,
"name": "priority",
"owner": "cases"
}'
{
"definition": "name: priority\nlabel: Priority\ntype: keyword\ncontrol: SELECT_BASIC\nmetadata:\n options: [low, medium, high]\n default: medium\n",
"description": "Ticket priority level.",
"isGlobal": false,
"name": "priority",
"owner": "cases"
}
{
"definition": "name: priority\nlabel: Priority\ntype: keyword\ncontrol: SELECT_BASIC\nmetadata:\n options: [low, medium, high]\n default: medium\n",
"description": "Ticket priority level.",
"fieldDefinitionId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"isGlobal": false,
"name": "priority",
"owner": "cases"
}
{
"error": "Bad Request",
"message": "Template [invalid-template-id] not found for owner [cases]",
"statusCode": 400
}
{
"error": "Unauthorized",
"message": "Unable to authenticate with the provided credentials.",
"statusCode": 401
}
{
"error": "Forbidden",
"message": "Unauthorized to access cases",
"statusCode": 403
}
{
"error": "Conflict",
"message": "Template name \"Security incident\" already exists for owner \"cases\"",
"statusCode": 409
}