Create workflow
POST/workflows
Creates a new automation workflow and automatically creates version 1 as a snapshot. If status is set to 'active' the version is published immediately. Provide trigger (event name), conditions (optional filter array), and actions (ordered effect array).
Request
Request body
Content type application/json (required).
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Human-readable workflow name (e.g. "New Lead Welcome Email"). Max length: 180 |
description | string, nullable | No | Optional explanation of what this workflow does. Max length: 2000 |
trigger | string | Yes | Dot-separated event name that fires this workflow (e.g. "crm.lead.created", "support.ticket.resolved"). Max length: 120 |
throttle_per_minute | integer | No | Maximum number of times this workflow can fire per minute (0 = unlimited). Use to prevent run storms on high-frequency events. Default: |
error_policy | string | No | What to do when an action fails. 'retry' re-attempts with backoff; 'halt' stops the run and marks it failed; 'dlq' sends it to the dead-letter queue for manual review. One of: |
status | string | No | Initial lifecycle status. Use 'draft' to configure before activating; set to 'active' to publish immediately. One of: |
conditions_json | string | No | JSON-encoded array of condition objects. Each condition should include a 'field', 'operator', and 'value'. Only events matching all conditions will trigger the workflow. |
actions_json | string | No | JSON-encoded array of action objects executed in order. Each action should include a 'type' and 'config' object. |
Example
{
"name": "New Lead Welcome Email",
"description": "Sends a welcome email when a new CRM lead is created.",
"trigger": "crm.lead.created",
"throttle_per_minute": 100,
"error_policy": "retry",
"status": "draft",
"conditions_json": "[{\"field\":\"lead.source\",\"operator\":\"equals\",\"value\":\"website\"}]",
"actions_json": "[{\"type\":\"send_email\",\"config\":{\"template\":\"lead_welcome\",\"to\":\"{{lead.email}}\"}},{\"type\":\"assign_owner\",\"config\":{\"user_id\":5}}]"
}
Responses
302 Redirect to workflows list after creation
422 Validation error — name and trigger are required
Content type application/json, any.
Example
{
"errors": {
"trigger": [
"The trigger field is required."
]
}
}
Example request
curl -X POST "https://{tenant}.faciotech.net/api/v1/workflows" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"name": "New Lead Welcome Email", "description": "Sends a welcome email when a new CRM lead is created.", "trigger": "crm.lead.created", "throttle_per_minute": 100, "error_policy": "retry", "status": "draft", "conditions_json": "[{\"field\":\"lead.source\",\"operator\":\"equals\",\"value\":\"website\"}]", "actions_json": "[{\"type\":\"send_email\",\"config\":{\"template\":\"lead_welcome\",\"to\":\"{{lead.email}}\"}},{\"type\":\"assign_owner\",\"config\":{\"user_id\":5}}]"}'