API ReferenceRuns

Cancel a run

POST
/v1/runs/{run_id}/cancel

Requests cancellation. A terminal run is returned unchanged. Work that completed before cancellation remains billable and appears in usage.

Authorization

bearerAuth
AuthorizationBearer <token>

Send a SimpleServe API key as Authorization: Bearer <key>.

In: header

Path Parameters

run_id*string
Match^run_[A-Za-z0-9]+$

Header Parameters

Idempotency-Key?string

Prevents duplicate work and charges when a request is retried. Reusing a key with a different request returns 409 idempotency_conflict.

Length8 <= length <= 255

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/runs/string/cancel" \  -H "Idempotency-Key: 01JXYZ1234567890ABCDEF"
{  "id": "run_01JXYZ1234567890",  "object": "run",  "agent": "acme/construction-researcher",  "status": "cancelled",  "output_text": null,  "output": [],  "usage": {    "rate_card_id": "rc_2026_08",    "meters": [      {        "id": "invocations",        "quantity": 1,        "cost_usd": 1      }    ]  },  "cost_usd": 1.075,  "max_cost_usd": 3,  "session_id": "ses_01JXYZ1234567890",  "stop_reason": null,  "error": null,  "created_at": "2026-08-29T18:30:00Z",  "started_at": "2026-08-29T18:30:00Z",  "completed_at": "2026-08-29T18:30:02Z",  "metadata": {}}