Skip to main content
POST
/
v1
/
workflows
Create Workflow
curl --request POST \
  --url https://api.example.com/v1/workflows \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "condition_entity": "<string>",
  "condition_field": "<string>",
  "condition_operator": "<string>",
  "condition_value": "<string>",
  "action_type": "<string>",
  "action_config": {},
  "max_triggers_per_day": 123,
  "enabled": true
}
'
{
  "data": {}
}

Request

Headers

Authorization: Bearer wbk_your_api_key_here
Content-Type: application/json
Idempotency-Key
string
Optional UUID for retry deduplication within 24 hours.

Body Parameters

name
string
required
Human-readable name. 1 - 120 characters.
condition_entity
string
required
Entity type to listen on: contact, deal, task, email, or meeting.
condition_field
string
required
Field on the entity to evaluate (e.g. status, stage_id, tags).
condition_operator
string
required
Operator: equals, not_equals, contains, changed, changed_to, greater_than, less_than.
condition_value
string
required
Value to compare against. For changed no value is needed but the parameter is still required as an empty string.
action_type
string
required
Action to perform: send_email, create_task, send_channel_message, webhook, update_field.
action_config
object
required
Action-specific configuration. Accepts merge tokens referencing the triggering entity (e.g. {{deal.name}}).
max_triggers_per_day
integer
default:"100"
Circuit-breaker threshold. When exceeded, the workflow auto-disables and raises an alert.
enabled
boolean
default:"true"
Whether the workflow should be active upon creation.

Response

data
object
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

StatusCodeDescription
400validation_errorMissing required fields or unsupported operator/action combination
401invalid_keyInvalid or expired API key
403insufficient_permissionsMissing write:workflows permission
409duplicate_nameA workflow with this name already exists
429rate_limitedRate limit exceeded