flow.api.
Use it when the system that starts the flow is yours and can send a token. When another service sends its own
signed notifications (GitHub, a shop, a payment provider), use the webhook trigger instead.
Setting it up
- Add a trigger to the flow and choose API.
- Choose the Response: Accept at once (202) or Wait for the flow’s answer (see Response mode).
- Publish the flow. Until the flow is published with the trigger active, the address answers
404. - In System → API tokens, issue a token with the permission Start flow runs through the API and give it to your system. Only an administrator can put this permission on a token: a token reaches the flows of every assistant in the workspace.
The call
- Method and address.
POST /api/v1/flow-triggers/<trigger-id>/runson the workspace’s own host. - Token.
Authorization: Bearer fpt_…, a token with Start flow runs through the API. The token is the only credential; nothing in the trigger’s settings is secret. - Body. A JSON object, with
Content-Type: application/json(or another+jsontype), at most 256 KB. - Idempotency key (optional).
Idempotency-Key, 1 to 255 printable ASCII characters.
Idempotency: no call runs twice
A client that did not get an answer in time retries. Send anIdempotency-Key that is the same for every retry of
one call — an order number, an event id — and the flow runs once: a repeated key from the same token is answered
200 with "status": "duplicate" and starts nothing. Repeats are recognised for a day by a quick check, and for as
long as the earlier run is kept in the history.
The key belongs to the token: two integrations with their own tokens may send the same key and each starts its own
run. Without the header, every call starts a new run.
What the flow receives
No header of the call reaches the flow. The flow has no contact, so blocks that need one cannot be published in it;
see Publishing. A call is recorded by its run: the run’s history shows the trigger, and the run’s
variables show which token started it.
A run that failed can be started again by hand from its session page, with the same body — see
Running a failed run again. That run answers nobody.
Answers
Every refusal is a JSON body
{"error": "<code>"}. A run that is accepted still passes the workspace’s limits when it
starts: a run over the plan’s limit is not started, and the trigger’s panel in the builder counts it.
Response mode
Response in the trigger’s settings chooses what the caller gets once the call is accepted. It works as the webhook trigger’s response mode does, with the same limits:- Accept at once (202) — the default. The caller gets
202as soon as the run is queued. - Wait for the flow’s answer — the call is held open while the flow runs, for up to 30 seconds, and the caller
gets the first Respond to webhook block the run reaches, or the end of the run (
200completed or cancelled,500failed). Without an answer in time, or when too many calls already wait, the caller gets202and the run goes on.