Skip to Content
Flows

Create a flow

Permissionflows:createAdd-onFlowsRetriesIdempotency-Key requiredAuthentication
POST
/flows

Creates a flow from a graph of agents you already have.

Only name is required — a flow can be created empty and wired up later — and an omitted slug is derived from the name.

Graph rules

  • Every node must name a deployed agent in the same workspace, and may appear at most once.
  • Every edge must join two distinct nodes and carry a non-empty condition. That text is what the assistant reads when it decides whether to hand the call over, so it is required rather than optional.
  • start_agent_id, when given, must be one of the agents on the canvas.

Validation failures list every offending field with its graph path. Requires the flows entitlement.

Authorization

bearerAuth
headerAuthorizationBearer <token>

Use a Voice API key or connected-app OAuth access token. Authentication.

Header Parameters

Idempotency-Key*string

Required. Reuse the same key to retry this write safely. Retries and idempotency.

Match^[A-Za-z0-9!#$%&'*+.^_`|~-]+$
Length1 <= length <= 255

Request Body

application/json
  1. body

Creates a flow. Only name is required: a flow may be created empty and wired up afterwards, and an omitted slug is derived from the name. Maximum encoded body size is 1048576 bytes.

name*string
Length1 <= length <= 200
slug?string

Unique per workspace. Lower-cased and trimmed before validation. Derived from name when omitted.

Match^[a-z0-9]+(?:-[a-z0-9]+)*$
Length2 <= length <= 64
description?|
Lengthlength <= 2000
start_agent_id?|

Must be one of the agents in graph.nodes. Null leaves it unset.

Formatuuid
graph?

The flow canvas as supplied on write. Sending it REPLACES the stored graph whole; it is never merged edge by edge.

summary_enabled?boolean
Defaulttrue
summary_prompt?|
Lengthlength <= 50000
extraction_object_ids?array<>|

Null is accepted and stores an empty list.

Itemsitems <= 100
webhook_config_ids?array<>|

Null is accepted and stores an empty list.

Itemsitems <= 100

Response Body

The created flow, with its graph enriched by each node's agent slug and name.

application/json
  1. response

A named graph of existing agents joined by agent-to-agent handoffs. The same representation is returned for a single flow and for each element of a list page. A flow owns the graph, the start agent and an after-call override; prompt, model and voice configuration stays on each member agent's own version. Flows are not versioned — resource_version feeds the strong ETag that PATCH's If-Match is checked against.

id*string
Formatuuid
org_id*string
Formatuuid
slug*string
Match^[a-z0-9]+(?:-[a-z0-9]+)*$
Length2 <= length <= 64
name*string
Length1 <= length <= 200
description?string

Absent when no description is set.

Lengthlength <= 2000
start_agent_id?string

The agent that ANSWERS a call routed at this flow; the graph's edges take over from there. Must be one of the agents on the canvas. Absent when the flow has no start agent yet, in which case the flow cannot be targeted by a number, a job or a call.

Formatuuid
graph*

The flow canvas — the agents on it and the handoffs between them.

agent_count*integer

Derived count of graph.nodes, so a list page can show each flow's shape.

Range0 <= value
handoff_count*integer

Derived count of graph.edges.

Range0 <= value
summary_enabled*boolean

After-call override. These four fields REPLACE every member agent's own after-call configuration for calls that run inside the flow.

summary_prompt?string

Absent when no override prompt is set.

Lengthlength <= 50000
extraction_object_ids*array<>
Itemsitems <= 100
webhook_config_ids*array<>
Itemsitems <= 100
resource_version*integer

Monotonic row version maintained by the database, never by the handler. It is the value behind the strong ETag.

Formatint64
Range0 <= value
archived_at?string

Absent unless the flow has been archived.

Formatdate-time
created_at*string
Formatdate-time
updated_at*string
Formatdate-time
Example Request
curl -X POST 'https://api.kejue.co/v1/flows' \  -H 'Idempotency-Key: string' \  -H 'Content-Type: application/json' \  -d '{  "slug": "support-front-door",  "name": "Support front door",  "start_agent_id": "11111111-1111-4111-8111-111111111111",  "graph": {    "nodes": [      {        "id": "triage",        "agent_id": "11111111-1111-4111-8111-111111111111",        "x": 0,        "y": 0      },      {        "id": "billing",        "agent_id": "22222222-2222-4222-8222-222222222222",        "x": 320,        "y": -120      }    ],    "edges": [      {        "id": "triage-to-billing",        "source": "triage",        "target": "billing",        "label": "billing",        "condition": "the caller asks about an invoice or a payment"      }    ]  }}'
Example Response
{  "id": "33333333-3333-4333-8333-333333333333",  "org_id": "44444444-4444-4444-8444-444444444444",  "slug": "support-front-door",  "name": "Support front door",  "start_agent_id": "11111111-1111-4111-8111-111111111111",  "graph": {    "nodes": [      {        "id": "triage",        "agent_id": "11111111-1111-4111-8111-111111111111",        "x": 0,        "y": 0,        "agent_slug": "triage",        "agent_name": "Triage"      },      {        "id": "billing",        "agent_id": "22222222-2222-4222-8222-222222222222",        "x": 320,        "y": -120,        "agent_slug": "billing",        "agent_name": "Billing"      }    ],    "edges": [      {        "id": "triage-to-billing",        "source": "triage",        "target": "billing",        "label": "billing",        "condition": "the caller asks about an invoice or a payment"      }    ]  },  "agent_count": 2,  "handoff_count": 1,  "summary_enabled": true,  "extraction_object_ids": [],  "webhook_config_ids": [],  "resource_version": 1,  "created_at": "2026-09-15T09:00:00Z",  "updated_at": "2026-09-15T09:00:00Z"}