Cancel a Message Batch
/v1/messages/batches/{message_batch_id}/cancel?beta=true Batches may be canceled any time before processing ends. Once cancellation is initiated, the batch enters a canceling state, at which time the system may complete any in-progress, non-interruptible requests before finalizing cancellation.
The number of canceled requests is specified in request_counts. To determine which requests were canceled, check the individual results within the batch. Note that cancellation may not result in any canceled requests if they were non-interruptible.
Learn more about the Message Batches API in our user guide
Parameters
path Path Parameters
| Name | Type |
|---|---|
message_batch_id
required
ID of the Message Batch. | string |
header Header Parameters
| Name | Type |
|---|---|
anthropic-beta Optional header to specify the beta version(s) you want to use. To use multiple betas, use a comma separated list like | string |
anthropic-version The version of the Claude API you want to use. Read more about versioning and our version history here. | string |
Responses
Successful Response
archived_at: string | null;
cancel_initiated_at: string | null;
created_at: string;
ended_at: string | null;
expires_at: string;
id: string;
processing_status: "in_progress" | "canceling" | "ended";
request_counts:
results_url: string | null;
type: "message_batch";
}
Client Errors
Error response.
See our errors documentation for more details.
error:
request_id: string | null;
type: "error";
}