Skip to content

Cancel a Task

POST /v1/tasks/{id}/cancel

Only queued tasks can be canceled. Tasks already running cannot be stopped through this endpoint.

bash
curl -X POST https://api.llmapi.site/v1/tasks/8b17fd33b0e947a08cb417e81e9ea9da/cancel \
  -H 'Authorization: Bearer YOUR_TASK_API_KEY'

Response — 200 OK

Returns the updated task object with status: "canceled". The held estimated amount is released.

json
{
  "id": "8b17fd33b0e947a08cb417e81e9ea9da",
  "status": "canceled",
  "modality": "image",
  "model": "gpt-image-2",
  "created_at": "2026-06-22T03:10:00Z"
}

Errors

StatusCause
401Missing or invalid API key.
403API key is not enabled for Task API.
404Task not found, or belongs to a different API key.
409Task is not in queued status and cannot be canceled.
503Task API is disabled or temporarily unavailable.