/workflows
Create a new agent (funnel + statuses) from scratch — entirely via API. This is the first step in the API-first agent lifecycle:
- Create the agent (this endpoint). It’s born paused.
- Set its prompt — what it says and how it behaves.
- Optionally add custom statuses/fields or custom tools it can call.
- Activate it by setting
is_paused: false.
name already exists on your account, this returns the existing one (status: "existed") instead of creating a duplicate — safe to retry.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Agent name. Used for the idempotency check |
goal_type | string | Yes | One of: appointment, sale, qualification, information, payment_link, support, custom |
statuses | array | Yes | Non-empty array of funnel statuses (see below). If none is marked is_initial, the first one is used; if none is marked is_terminal, the last one is used |
description | string | No | Agent description |
global_prompt | string | No | Base prompt. You can also set this later via PATCH /workflows/:id/prompt |
language | string | No | Default es |
channels | array | No | Channels to enable, e.g. ["whatsapp", "email"]. Default ["whatsapp"] |
fields | array | No | Custom lead fields to collect (see Update Structure for the shape) |
statuses[] shape
| Field | Type | Required | Description |
|---|---|---|---|
key | string | Yes | Stable identifier for the status |
name | string | Yes | Display label (label also accepted) |
is_initial | boolean | No | Marks the funnel’s entry status |
is_terminal | boolean | No | Marks a funnel-ending status |
sort_order | integer | No | Defaults to array index |
Responses
201 — Agent created
200 — Already existed (idempotent replay)
400 — Validation error
"goal_type must be one of: appointment, sale, qualification, information, payment_link, support, custom""statuses must be a non-empty array""each status needs a key and a name"