beatra

Cancel a task (best-effort)

POST
/v1/tasks/{task_id}/cancel

Request Body

application/jsonOptional
bodyReq

Path Parameters

task_id
Required
Task Id

Header Parameters

Authorization
Required
string

Bearer API key.

X-Request-Idstring

Optional client request id echoed in the response.

Idempotency-Keystring

Optional idempotency key for safe retries of mutating requests.

curl -X POST "https://example.com/v1/tasks/string/cancel" \
  -H "Authorization: string" \
  -H "X-Request-Id: string" \
  -H "Idempotency-Key: string" \
  -H "Content-Type: application/json" \
  -d '{
    "reason": "string"
  }'

Already terminal; returns final state (idempotent)

{
  "object": "task",
  "task_id": "string",
  "status": "queued",
  "capability": "string",
  "model": "string",
  "resolved_model": "string",
  "metadata": {
    "property1": "string",
    "property2": "string"
  },
  "input": {},
  "progress": {
    "percent": 100,
    "stage": "string",
    "message": "string"
  },
  "output": {},
  "warnings": [
    {
      "code": "string",
      "message": "string",
      "field": "string"
    }
  ],
  "error": {
    "code": "string",
    "message": "string",
    "retryable": true
  },
  "usage": {
    "input_tokens": 0,
    "output_tokens": 0,
    "cache_read_tokens": 0,
    "cache_creation_tokens": 0,
    "reasoning_tokens": 0,
    "image_count": 0,
    "image_pixels": 0,
    "video_seconds": 0,
    "audio_seconds": 0,
    "characters": 0,
    "lines": [
      {
        "meter": "string",
        "quantity": "string",
        "unit": "string",
        "billed_amount_credits": "string",
        "billed_amount_credits_usd_reference": "string"
      }
    ],
    "credits": "string",
    "credits_usd_reference": "string"
  },
  "billing": {
    "charged_credits": "string",
    "refunded_credits": "string",
    "charged_credits_usd_reference": "string",
    "refunded_credits_usd_reference": "string",
    "currency": "USD"
  },
  "callback": {
    "url": "string",
    "status": "pending",
    "attempt_count": 0,
    "delivered_at": "2019-08-24T14:15:22Z",
    "last_error": "string"
  },
  "created_at": "2019-08-24T14:15:22Z",
  "started_at": "2019-08-24T14:15:22Z",
  "completed_at": "2019-08-24T14:15:22Z",
  "cancel_requested_at": "2019-08-24T14:15:22Z",
  "links": {
    "self": "string",
    "cancel": "string"
  }
}