curl -X POST https://api.zerodrift.ai/api/v3/batches/BATCH_ID/cancel \
-H "x-api-key: YOUR_API_KEY"
{
"api_version": "v3",
"error": {
"code": "batch_not_cancelable",
"message": "batch 'batch_e511e74dd1ea49ba8c5f4293a68427be' is failed and cannot be canceled"
}
}
Batches
Cancel a Batch
Stop a batch. Messages already checked keep their results; the rest are not billed.
POST
/
api
/
v3
/
batches
/
{batch_id}
/
cancel
curl -X POST https://api.zerodrift.ai/api/v3/batches/BATCH_ID/cancel \
-H "x-api-key: YOUR_API_KEY"
{
"api_version": "v3",
"error": {
"code": "batch_not_cancelable",
"message": "batch 'batch_e511e74dd1ea49ba8c5f4293a68427be' is failed and cannot be canceled"
}
}
Cancels a batch:
- A batch still
validatingends at once, with nothing checked or billed. - A batch
in_progressmoves tocanceling. Messages not yet started are canceled and not billed. Messages already checked keep their results and are billed. The batch then finalizes and ends, with the results so far.
canceling or finalizing returns its current state. Needs a full-access API key.
Path Parameters
Response
The batch, in the shape returned by Get a Batch.curl -X POST https://api.zerodrift.ai/api/v3/batches/BATCH_ID/cancel \
-H "x-api-key: YOUR_API_KEY"
{
"api_version": "v3",
"error": {
"code": "batch_not_cancelable",
"message": "batch 'batch_e511e74dd1ea49ba8c5f4293a68427be' is failed and cannot be canceled"
}
}
Errors
| Status | Code | Meaning |
|---|---|---|
404 | batch_not_found | No batch with this ID is yours. |
409 | batch_not_cancelable | The batch has already ended or failed. |

