API reference · Automation
POST/api/v1/automation/templates

Create automation template from rule

Creates a template row by copying one source automation rule into automation_templates.template_config. Authentication uses x-api-key with optional x-tenant-id; RBAC requires automation:create. The controller validates createTemplateFromRuleSchema and service emits automation.template.created + audit log events. Missing source rules currently throw generic Error and surface as 500.

RBAC · automation

Request body

Content type: application/json · schema CreateAutomationTemplateRequest

automation_rule_idstring <uuid>Required
Source automation_rules.rule_id copied into template_config.
template_namestringRequired
min length 1 · max length 255
template_descriptionstring
categorystringRequired
min length 1
template_variablesarray of object
itemsobject
rule_field_pathstringRequired
min length 1
variable_namestringRequired
min length 1
display_namestringRequired
min length 1
descriptionstring
typestringRequired
Enum: stringnumberbooleandateselectmultiselect
requiredboolean

Response body

Success response 201 · schema AutomationTemplateResponse

dataobjectRequired
template_idstring <uuid>Required
Template UUID generated with crypto.randomUUID.
namestringRequired
descriptionstringNullable
categorystringRequired
iconstringNullable
template_configobjectRequired
Template rule blueprint derived from an automation rule.
versionstring
authorstringNullable
compatible_versionsarray of string
itemsstring
required_permissionsarray of string
itemsstring
usage_countinteger
≥ 0
last_usedstring <date-time>Nullable
template_variablesarray of AutomationTemplateVariable
itemsobject
namestringRequired
display_namestring
descriptionstring
typestringRequired
Enum: stringnumberbooleandateselectmultiselect
requiredboolean
default_valueany
optionsarray of object
itemsobject
labelstringRequired
valueany
validationobject
minnumber
maxnumber
patternstring
custom_validatorstring
is_activeboolean
is_featuredboolean
tenantstring <uuid>Required
_linksobject
HATEOAS links generated by the automation controller. Some generic links may point to methods not implemented by a route file.

Response codes

201
Automation template created successfully.
400
Body validation failed.
401
API key is missing, invalid, expired, over limit, or the key user was not found.
403
Authenticated user lacks automation:create permission.
404
Intended not-found response for missing source rules; current service may surface this as 500.
500
Unexpected failure, including current generic source-rule not-found errors.