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

Create automation rule

Creates a tenant-scoped automation rule in automation_rules. Authentication uses x-api-key with optional x-tenant-id; RBAC requires automation:create. The controller validates request body via createAutomationRuleSchema, and the service validates trigger/action config, inserts the rule with crypto.randomUUID generated rule_id, and emits automation.rule.created + audit log events.

RBAC · automation

Request body

Content type: application/json · schema CreateAutomationRuleRequest

namestringRequired
min length 1 · max length 255
descriptionstring
statusstring
Defaults to draft when omitted.
Enum: activeinactivedrafterror
prioritystring
Defaults to normal when omitted.
Enum: lownormalhighcritical
trigger_typestringRequired
Enum: time_basedevent_basedcondition_basedmanualrecurringwebhook
trigger_configobjectRequired
Trigger-type-specific configuration object.
conditionsarray of AutomationRuleCondition
itemsobject
fieldstringRequired
Field path evaluated for this condition.
operatorstringRequired
Enum: equalsnot_equalsgreater_thanless_thangreater_than_or_equalless_than_or_equalcontainsnot_containsstarts_withends_withinnot_inexistsnot_existsregex_match
valueany
Condition comparison value.
data_typestring
Enum: stringnumberbooleandatearrayobject
condition_logicstring
Enum: andor
actionsarray of AutomationRuleActionRequired
min items 1
itemsobject
typestringRequired
Automation action type.
Enum: email_notificationsms_notificationwebhook_calldatabase_updateticket_creationticket_updateproject_updatetime_entry_creationinvoice_generationcustom_scriptworkflow_executionsystem_command
configobjectRequired
Action configuration object. Expected keys depend on action type.
orderintegerRequired
Execution order (1-based).
≥ 1
continue_on_errorboolean
Continue execution after a failed action.
timeout_secondsinteger
Optional per-action timeout in seconds.
≥ 1
retry_attemptsinteger
Optional retry count for this action.
≥ 0 · ≤ 5
max_concurrent_executionsinteger
≥ 1
execution_timeout_minutesinteger
≥ 1
retry_failed_executionsboolean
is_templateboolean
template_categorystring
tagsarray of string
itemsstring
metadataobject
notification_settingsobject
notify_on_successboolean
notify_on_failureboolean
notification_emailsarray of string
itemsstring <email>
notification_webhooksarray of string
itemsstring <uri>

Response body

Success response 201 · schema AutomationRuleResponse

dataobjectRequired
rule_idstring <uuid>Required
Rule UUID generated with crypto.randomUUID when a rule is created.
tenantstring <uuid>Required
Tenant UUID scoped from API key authentication.
namestringRequired
Rule display name.
descriptionstringNullable
statusstringRequired
Current automation rule status.
Enum: activeinactivedrafterror
prioritystringRequired
Current automation rule priority.
Enum: lownormalhighcritical
trigger_typestringRequired
Trigger type used to start rule execution.
Enum: time_basedevent_basedcondition_basedmanualrecurringwebhook
trigger_configobjectRequired
Trigger configuration object stored with the rule.
conditionsarray of AutomationRuleCondition
Optional additional rule conditions.
itemsobject
fieldstringRequired
Field path evaluated for this condition.
operatorstringRequired
Enum: equalsnot_equalsgreater_thanless_thangreater_than_or_equalless_than_or_equalcontainsnot_containsstarts_withends_withinnot_inexistsnot_existsregex_match
valueany
Condition comparison value.
data_typestring
Enum: stringnumberbooleandatearrayobject
condition_logicstring
Condition combination logic.
Enum: andor
actionsarray of AutomationRuleActionRequired
Ordered action list for this rule.
itemsobject
typestringRequired
Automation action type.
Enum: email_notificationsms_notificationwebhook_calldatabase_updateticket_creationticket_updateproject_updatetime_entry_creationinvoice_generationcustom_scriptworkflow_executionsystem_command
configobjectRequired
Action configuration object. Expected keys depend on action type.
orderintegerRequired
Execution order (1-based).
≥ 1
continue_on_errorboolean
Continue execution after a failed action.
timeout_secondsinteger
Optional per-action timeout in seconds.
≥ 1
retry_attemptsinteger
Optional retry count for this action.
≥ 0 · ≤ 5
max_concurrent_executionsinteger
≥ 1
execution_timeout_minutesinteger
≥ 1
retry_failed_executionsboolean
is_templateboolean
template_categorystringNullable
tagsarray of string
itemsstring
metadataobject
notification_settingsobject
notify_on_successboolean
notify_on_failureboolean
notification_emailsarray of string
itemsstring <email>
notification_webhooksarray of string
itemsstring <uri>
created_bystring <uuid>Nullable
User UUID from API key context that created the rule.
created_atstring <date-time>
updated_atstring <date-time>
execution_countinteger
≥ 0
last_executedstring <date-time>Nullable
execution_statisticsobject
Included on GET /rules/{id} by service lookup helper.
_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 rule 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.
500
Unexpected automation rule creation failure.