Authentication
Send a token as Authorization: Bearer <token>. Read API conventions.
Endpoints
| Method | Path | Purpose | Role |
|---|---|---|---|
| POST | /api/v1/compose | Plan a workflow from a request in plain language. Streams the plan. | Any |
| GET | /api/v1/compose/suggestions | Example requests for compose | Any |
| GET | /api/v1/compose/agents | List the agents that compose can use in a workflow | Any |
| GET | /api/v1/flows | List workflows | Any |
| POST | /api/v1/flows/create | Create a workflow | Any |
| GET | /api/v1/flows/{flow_id} | Get a workflow | Any |
| GET | /api/v1/flows/{flow_id}/detail | Get a workflow with all steps and variables | Any |
| PUT | /api/v1/flows/{flow_id} | Change a workflow | Any |
| DELETE | /api/v1/flows/{flow_id} | Delete a workflow | admin |
| POST | /api/v1/flows/batch-delete | Delete more than one workflow | admin |
| POST | /api/v1/flows/{flow_id}/clone | Copy a workflow | Any |
| POST | /api/v1/flows/{flow_id}/publish | Publish a workflow | Any |
| POST | /api/v1/flows/{flow_id}/unpublish | Move a workflow back to draft | Any |
| POST | /api/v1/flows/{flow_id}/archive | Archive a workflow | Any |
| GET | /api/v1/flows/{flow_id}/stats | Run statistics of a workflow | Any |
| POST | /api/v1/flows/{flow_id}/runs | Start a run in the background | Any |
| POST | /api/v1/flows/{flow_id}/execute | Run a workflow and wait for the result | Any |
| GET | /api/v1/flows/{flow_id}/runs | List the runs of a workflow | Any |
| POST | /api/v1/flows/{flow_id}/executions/batch-delete | Delete more than one run | admin |
| GET | /api/v1/runs | List runs | Any |
| GET | /api/v1/runs/{run_id} | Get a run | Any |
| GET | /api/v1/runs/{run_id}/stream | Follow a run as server-sent events | Any |
| POST | /api/v1/runs/{run_id}/approve | Record a decision on a run that waits for approval | Any |
| 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/templates | List workflow templates | Any |
| POST | /api/v1/templates/{template_id}/use | Create a draft workflow from a template | Any |
| GET | /api/v1/health | Health check | None |
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
| Field | Meaning |
|---|---|
id | The run identifier |
status | The state of the run. waiting_approval means a person must decide. |
steps | The result of each step |
output_data | The result of the workflow |
approval | The pending decision, when the run waits for approval |
audit | Who did what, and when |
error | The error, when the run failed |
Errors
| Status | Cause |
|---|---|
| 403 | Your role cannot delete workflows or runs |
| 404 | The workflow or run does not exist |
| 409 | The run does not wait for approval |