Cancel Batch
Cancel an in-progress extraction batch. Only batches in accumulating or submitted status can be cancelled. Completed batches cannot be rolled back.
Cancel a batch that is still accumulating or submitted. Cancellation sends a stop request to the provider if the batch was already submitted. Documents in the cancelled batch revert to batch_queued status and can be resubmitted or processed via realtime extraction.
Use cancellation when you need to abort a batch — for example, if documents were submitted with an incorrect schema or you need results faster via realtime extraction. Cancel as early as possible; items already processed by the provider before the cancellation lands may still have their results applied.
The response returns the batch with status: cancelled. The succeeded_count may be non-zero if some items were processed before cancellation took effect. Documents revert to batch_queued status and can be re-processed by updating their processing_mode to realtime or by including them in a new batch.
Only batches in accumulating or submitted status can be cancelled — calling cancel on a completed, failed, or already cancelled batch returns 400. Pair with GET /v1/batches/:id after cancellation to inspect which items were processed before the stop request landed.
/v1/batches/:id/cancelResponse
Response fields
Response
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"status": "cancelled",
"provider": "anthropic",
"item_count": 37,
"succeeded_count": 0,
"errored_count": 0,
"expired_count": 0,
"submitted_at": null,
"completed_at": null,
"error_message": null,
"created_at": "2024-10-02T08:10:00.000Z",
"updated_at": "2024-10-02T09:15:00.000Z",
"links": { "self": "/v1/batches/a1b2c3d4-e5f6-7890-abcd-ef1234567890" }
}Errors
Error responses