v1
latestOpenAPI 3.1.02026-08-042453938.9 KBRuns
Record a complete run in one call
One-call convenience endpoint that atomically creates a workflow (if needed), starts a run, emits events, and ends the run.
This replaces the 4-step SDK orchestration:
- GET /workflows (resolve slug)
- POST /runs (start)
- POST /run-events/batch (emit events)
- PATCH /runs/:id (end)
The workflow field can be a workflow ID or a slug. If a slug is provided and no matching workflow exists, one is auto-created.
post/v1/runs/record
Request body
Example request
{
"customerId": "cus_abc123",
"workflow": "research-agent",
"events": [
{
"eventType": "llm.call",
"quantity": 1700,
"units": "tokens",
"description": "web-search",
"costUnits": 0.35,
"metadata": {
"model": "gpt-4",
"inputTokens": 500,
"outputTokens": 1200
}
}
],
"status": "COMPLETED",
"errorMessage": "Provider returned rate_limited",
"errorCode": "rate_limited",
"externalRunId": "job_123",
"correlationId": "trace_abc123",
"metadata": {
"tenant": "acme",
"environment": "production"
}
}Response
Run recorded