Documentation
Usage Guide
Create runs, poll for status, stream events, and use webhooks.
Basic Flow
- 1.Create a run -
POST /api/v1/tasks/runswith prompt and model - 2.Poll or stream - Use
run_idto get status, output, or stream events - 3.Retrieve result - When
statusissucceededorfailed, get output
Polling for Status
bash
curl -H "x-api-key: sk-flow-YOUR_KEY" \
https://<your-domain>/api/v1/tasks/runs/run_abc123Long-Poll for Result
GET /api/v1/tasks/runs/{run_id}/result?timeout=60 waits until the run completes or times out:
bash
curl -H "x-api-key: sk-flow-YOUR_KEY" \
"https://<your-domain>/api/v1/tasks/runs/run_abc123/result?timeout=60"Streaming Events (SSE)
GET /api/v1/tasks/runs/{run_id}/events returns a Server-Sent Events stream:
bash
curl -N -H "x-api-key: sk-flow-YOUR_KEY" \
-H "Accept: text/event-stream" \
https://<your-domain>/api/v1/tasks/runs/run_abc123/eventsEvents include task.status, task.agent.text-delta, task.done, etc.
Webhooks
Pass webhook_url when creating a run. When the run completes, we POST a payload to that URL. Must use HTTPS; no private IPs.