Study FAQ
How do I cancel or retry a Claude Message Batch without reprocessing completed entries?
Also asked as 2
- What happens to in-progress requests and partial results when a Claude batch is canceled?
- How should I resubmit failed Claude batch items after cancellation or expiration?
Answer
On the first-party Claude API, cancel an active batch with the documented cancel endpoint and poll from canceling until ended. Then retrieve the per-entry results. Some requests may finish during cancellation, so rebuild retry work from individual outcomes instead of repeating the whole batch.
- Use
POST /v1/messages/batches/{message_batch_id}/cancelin the batch's workspace. The response acknowledges cancellation is in progress. Confirm the final canceled count and reconcile it against the JSONL results. - Preserve successes. Fix deterministic validation failures before requeueing. Resubmit canceled, expired, or transiently errored items only when the work is still needed and your retry budget allows it. Keep the stable application work key and separately identify the new batch attempt.
- If creation timed out before you received a batch ID, check available batch records and reconcile against application submission records before creating another batch. The documented
custom_idmatches a result to an entry inside a batch. Your application should deduplicate accepted results and downstream writes by its own stable key across batches.
The retrieval call is documented as idempotent and useful for polling. Keep pollers and consumers scoped to the same workspace and confirm the final state and result counts before marking the operation complete.
Official references
Full explanation
Choosing Claude API Workload Modes for Vision, Thinking, and Batch Processing
Study guide · CCDV-F
Read the full explanation