Spaces method and path for this operation:
Refer to Spaces for more information.
Fully replaces a case template. Every accepted update creates a new template version; previous versions stay retrievable with the version query parameter of the get template API, and cases keep the version they were created with. You must have the "Manage templates" sub-privilege for the Cases feature of the owning solution. Set dry_run=true to run the full validation without writing. Requires the Cases feature to be enabled in the space.
Query parameters
-
When true, validates the request without updating the template and returns
{"valid": true}.Default value is
false.
Body
Required
-
The template definition as a YAML string: case defaults (name, severity, category, tags, assignees, connector, settings) and a
fieldsarray of inline field definitions or$refentries pointing into the owner's field library. Stored field values appear on cases underextended_fieldskeys shaped<field_name>_as_<storage_type>.Maximum length is
30000. -
A description of the template.
Maximum length is
1000. -
Disabled templates are hidden from the case creation flow.
Default value is
true. -
The template identity name, unique per owner (case-insensitive). May be omitted when the YAML definition provides a case-default title (
name:), which is then used as the identity name.Minimum length is
1, maximum length is50. -
The application that owns the cases: Stack Management, Observability, or Elastic Security.
Values are
cases,observability, orsecuritySolution.
Responses
-
Indicates a successful call. Returns the new template version, or
{"valid": true}for a dry run. -
The request body, YAML definition, or template name is invalid, or a resource limit was exceeded (max 200 fields per template).
-
Authorization information is missing or invalid.
-
The user does not have the manage templates privilege for the owner.
-
The template was not found.
-
A template with the same name already exists for the owner.
curl \
--request PUT 'https://localhost:5601/api/cases/templates/9da1ea2a-09f8-4d0e-bf9d-09bf8c9d0f42' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--data '"{\n \"definition\": \"name: Security incident\\nseverity: high\\ntags: [security]\\nfields:\\n - name: priority\\n label: Priority\\n type: keyword\\n control: SELECT_BASIC\\n metadata:\\n options: [low, medium, high]\\n default: medium\\n\",\n \"description\": \"Default template for security incidents.\",\n \"isEnabled\": true,\n \"name\": \"Security incident\",\n \"owner\": \"cases\",\n \"tags\": [\n \"security\"\n ]\n}"'
{
"definition": "name: Security incident\nseverity: high\ntags: [security]\nfields:\n - name: priority\n label: Priority\n type: keyword\n control: SELECT_BASIC\n metadata:\n options: [low, medium, high]\n default: medium\n",
"description": "Default template for security incidents.",
"isEnabled": true,
"name": "Security incident",
"owner": "cases",
"tags": [
"security"
]
}
{
"valid": true
}
{
"definition": {},
"definitionString": "fields: []",
"deletedAt": null,
"isLatest": true,
"latestVersion": 1,
"name": "My Template",
"owner": "cases",
"templateId": "9da1ea2a-09f8-4d0e-bf9d-09bf8c9d0f42",
"templateVersion": 1
}
{
"error": "Bad Request",
"message": "A template cannot define more than 200 fields.",
"statusCode": 400
}
{
"error": "Unauthorized",
"message": "Unable to authenticate with the provided credentials.",
"statusCode": 401
}
{
"error": "Forbidden",
"message": "Unauthorized to access cases",
"statusCode": 403
}
{
"error": "Not Found",
"message": "Saved object [cases-template/9da1ea2a-09f8-4d0e-bf9d-09bf8c9d0f42] not found",
"statusCode": 404
}
{
"error": "Conflict",
"message": "Template name \"Security incident\" already exists for owner \"cases\"",
"statusCode": 409
}