文件与批处理

取消批处理

取消尚未完成的批处理任务。

POST
/v1/batches/{batch_id}/cancel

请求取消排队或运行中的批处理。响应返回任务的当前状态,可能仍在取消,也可能已取消完成。已经结束的任务保留原有终态。返回状态尚未结束时,请再次获取批处理任务以确认结果。

请求

cURL
curl -X POST "https://api.tokenlab.sh/v1/batches/batch_abc123/cancel" \
  -H "Authorization: Bearer sk-your-api-key"

响应

200 OK
{
  "id": "batch_abc123",
  "object": "batch",
  "status": "cancelling",
  "input_file_id": "file_abc123"
}
idstring
批处理任务 ID。
statusstring
批处理当前状态。取消请求成功并不一定返回 cancelling。

授权

BearerAuth
AuthorizationBearer <token>

API Key 身份验证。在 Dashboard > API > API Keys 中创建或管理 API Key。

位置: header

路径参数

batch_id*string

响应

application/json

application/json