Үндсэн агуулга руу алгасах
API reference

Run a flow headless (sync JSON or SSE)

POST/flows/{id}/invoke

Requires the flows module (403 module_inactive); list and run reads do not check it. HTTP status is the request's outcome; a failure inside the run is 200 + status "failed" + error.code. Idempotency-Key: 24h replay of the first answer (header Idempotent-Replayed: true), compared semantically (stored as jsonb — not byte-identical). The request fingerprint is method + path + the RAW body, so different whitespace or key order is idempotency_key_reuse. A stored answer over 16KB replays as 409 idempotency_response_unavailable + run_id (read GET /flows/{id}/runs/{runId}). Pre-run refusals free the key; a key "running" for over 5 minutes is freed. Replays and in-progress retries also need a free concurrency slot (429 concurrency_limited). A streamed request's replay is the stored JSON, not a stream; retry a dropped stream with a NEW key. SSE events: run_start {run_id} · node_start {node_id,type} · message {FlowMessage} · node_end {node_id,type,ms,tokens,error?} · end {status,session_id?,output,usage,error?} · ": ping" every 15s. A node stopped by the run's limits gets a synthetic node_start followed at once by its node_end (with error). Bearer header only — no query-string key. Headless-allowed nodes: start (trigger) · send_message · question · condition · variable · http · llm · knowledge · intent · extract · loop · call_flow (loop/call_flow — coming soon) · script (flow_script module — coming soon) · end; anything else is 422 flow_not_invokable (names the node). A call_flow (coming soon) callee is checked against the same list at run time (a mismatch is 200 + status "failed"). script needs the flow_script module (coming soon); without it the run is 200 + status "failed" + error.code module_inactive (node error flow_script_module_inactive — coming soon — in the run trace), the same code as an AI node without flow_ai.

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Path Parameters

id*string
Formatuuid

Header Parameters

Idempotency-Key?string

Printable ASCII

Lengthlength <= 128

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/flows/497f6eca-6276-4993-bfeb-53cbbbba6f08/invoke" \  -H "Content-Type: application/json" \  -d '{}'
{  "status": "completed",  "session_id": "1ffd059c-17ea-40a8-8aef-70fd0307db82",  "run_id": "dded282c-8ebd-44cf-8ba5-9a234973d1ec",  "output": null,  "messages": [    {      "type": "text",      "text": "string",      "quick_replies": [        {          "title": "string",          "payload": "string"        }      ],      "buttons": [        {          "type": "postback",          "title": "string",          "payload": "string",          "url": "string"        }      ],      "cards": [        {          "title": "string",          "subtitle": "string",          "image_url": "string",          "buttons": [            {}          ]        }      ],      "guard_blocked": true    }  ],  "usage": {    "tokens": 0,    "cost_usd": 0,    "billable_units": 0  },  "error": {    "code": "quota_exceeded",    "message": "string"  }}