Request
Authorization: Bearer wbk_your_api_key_here
Content-Type: application/json
Optional UUID for retry deduplication within 24 hours.
Body Parameters
Human-readable name. 1 - 120 characters.
Entity type to listen on: contact, deal, task, email, or meeting.
Field on the entity to evaluate (e.g. status, stage_id, tags).
Operator: equals, not_equals, contains, changed, changed_to, greater_than, less_than.
Value to compare against. For changed no value is needed but the parameter is still required as an empty string.
Action to perform: send_email, create_task, send_channel_message, webhook, update_field.
Action-specific configuration. Accepts merge tokens referencing the triggering entity (e.g. {{deal.name}}).
Circuit-breaker threshold. When exceeded, the workflow auto-disables and raises an alert.
Whether the workflow should be active upon creation.
Response
The created workflow record (same shape as GET /v1/workflows/{id}).
Responses include X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, and X-Request-ID.
curl -X POST \
https://data.leadlex.com/functions/v1/api-gateway/v1/workflows \
-H "Authorization: Bearer wbk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"name": "Ping owner on won deals",
"condition_entity": "deal",
"condition_field": "status",
"condition_operator": "changed_to",
"condition_value": "won",
"action_type": "send_channel_message",
"action_config": {
"channel": "slack",
"recipient": "#sales-wins",
"message": "Deal {{deal.name}} closed at {{deal.value}} {{deal.currency}}"
},
"max_triggers_per_day": 50
}'
Example Response
{
"data": {
"id": "wf_02HY2",
"name": "Ping owner on won deals",
"enabled": true,
"condition_entity": "deal",
"condition_field": "status",
"condition_operator": "changed_to",
"condition_value": "won",
"action_type": "send_channel_message",
"action_config": {
"channel": "slack",
"recipient": "#sales-wins",
"message": "Deal {{deal.name}} closed at {{deal.value}} {{deal.currency}}"
},
"max_triggers_per_day": 50,
"last_triggered_at": null,
"created_at": "2026-04-17T11:05:00Z"
}
}
Errors
| Status | Code | Description |
|---|
| 400 | validation_error | Missing required fields or unsupported operator/action combination |
| 401 | invalid_key | Invalid or expired API key |
| 403 | insufficient_permissions | Missing write:workflows permission |
| 409 | duplicate_name | A workflow with this name already exists |
| 429 | rate_limited | Rate limit exceeded |