Skip to main content
A
Docs

Flow API reference

Endpoints, request and response examples, and errors for the Flow API: workflows, runs, approvals and webhooks.

Authentication

Send a token as Authorization: Bearer <token>. Read API conventions.

Endpoints

MethodPathPurposeRole
POST/api/v1/composePlan a workflow from a request in plain language. Streams the plan.Any
GET/api/v1/compose/suggestionsExample requests for composeAny
GET/api/v1/compose/agentsList the agents that compose can use in a workflowAny
GET/api/v1/flowsList workflowsAny
POST/api/v1/flows/createCreate a workflowAny
GET/api/v1/flows/{flow_id}Get a workflowAny
GET/api/v1/flows/{flow_id}/detailGet a workflow with all steps and variablesAny
PUT/api/v1/flows/{flow_id}Change a workflowAny
DELETE/api/v1/flows/{flow_id}Delete a workflowadmin
POST/api/v1/flows/batch-deleteDelete more than one workflowadmin
POST/api/v1/flows/{flow_id}/cloneCopy a workflowAny
POST/api/v1/flows/{flow_id}/publishPublish a workflowAny
POST/api/v1/flows/{flow_id}/unpublishMove a workflow back to draftAny
POST/api/v1/flows/{flow_id}/archiveArchive a workflowAny
GET/api/v1/flows/{flow_id}/statsRun statistics of a workflowAny
POST/api/v1/flows/{flow_id}/runsStart a run in the backgroundAny
POST/api/v1/flows/{flow_id}/executeRun a workflow and wait for the resultAny
GET/api/v1/flows/{flow_id}/runsList the runs of a workflowAny
POST/api/v1/flows/{flow_id}/executions/batch-deleteDelete more than one runadmin
GET/api/v1/runsList runsAny
GET/api/v1/runs/{run_id}Get a runAny
GET/api/v1/runs/{run_id}/streamFollow a run as server-sent eventsAny
POST/api/v1/runs/{run_id}/approveRecord a decision on a run that waits for approvalAny
POST/api/v1/webhooks/{flow_id}Start a workflow from another system. Only a published workflow with a webhook trigger accepts the request. Other workflows return 404.None
GET/api/v1/templatesList workflow templatesAny
POST/api/v1/templates/{template_id}/useCreate a draft workflow from a templateAny
GET/api/v1/healthHealth checkNone

Start a run

curl https://flow.example.gov/api/v1/flows/$FLOW_ID/runs \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"input_data": {"request": "Renew the trade licence for applicant A-2291."}}'

input_data sets the variables of the workflow. Values you send replace the defaults of the workflow.

The response returns at once with the run. Follow it with GET /api/v1/runs/{run_id}/stream. The stream sends past events first, then live events.

Run fields

FieldMeaning
idThe run identifier
statusThe state of the run. waiting_approval means a person must decide.
stepsThe result of each step
output_dataThe result of the workflow
approvalThe pending decision, when the run waits for approval
auditWho did what, and when
errorThe error, when the run failed

Errors

StatusCause
403Your role cannot delete workflows or runs
404The workflow or run does not exist
409The run does not wait for approval