Skip to main content

Cancel a running task — POST /v3/bots/runs/{task_id}/cancel

Cancels a running or paused task. Optionally provide `biz_code`; when omitted, the default user-cancel code is used. A task already in a terminal state (`finished`, `canceled`, or `failed`) returns error code `10121` and cannot be resumed.

Written by Maggie

POST /v3/bots/runs/{task_id}/cancel

Cancels a running or paused task. Optionally provide `biz_code`; when omitted, the default user-cancel code is used. A task already in a terminal state (`finished`, `canceled`, or `failed`) returns error code `10121` and cannot be resumed.

Authentication

HTTPBearer

Parameters

  • task_id (path, string, required) — Task ID

  • biz_code (query, integer, optional) — Optional business cancellation code (for your own tracking/analytics).

Responses

200 — Run canceled.

{  "task_id": "string",  "status": "created",  "updated_at": "2026-01-01T00:00:00Z"}

400 — Run not found. Returns error code 10112.

{  "code": 123,  "msg": "Invalid task_id",  "data": null,  "ts": 1786634400000,  "time": "2026-08-13 18:00:00",  "traceId": "a1b2c3d4e5f6"}

500 — Internal Server Error

{  "code": 123,  "msg": "Invalid task_id",  "data": null,  "ts": 1786634400000,  "time": "2026-08-13 18:00:00",  "traceId": "a1b2c3d4e5f6"}

Did this answer your question?