TokenLab

檔案與批次

取消批次

取消尚未完成的批次。

POST
/v1/batches/{batch_id}/cancel

請求取消排隊中或正在執行的批次。回應會包含其目前狀態:取消可能仍在進行中,或可能已經完成。已結束的批次會保留其現有的最終狀態。若傳回的狀態不是最終狀態,請再次取得該批次以確認結果。未知的批次 ID 會傳回 404 batch_not_found。

請求

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 金鑰。

位置: header

路徑參數

batch_id*string

回應

application/json

application/json

application/json