Claude Platform Docs

Batches

Create a Message Batch
POST/v1/messages/batches
Retrieve a Message Batch
GET/v1/messages/batches/{message_batch_id}
List Message Batches
GET/v1/messages/batches
Cancel a Message Batch
POST/v1/messages/batches/{message_batch_id}/cancel
Delete a Message Batch
DELETE/v1/messages/batches/{message_batch_id}
Retrieve Message Batch results
GET/v1/messages/batches/{message_batch_id}/results
Models
BetaDeletedMessageBatch object{ id, type }
id: string

ID of the Message Batch.

type: "message_batch_deleted"

Deleted object type.

For Message Batches, this is always "message_batch_deleted".

defaultmessage_batch_deleted
BetaMessageBatch object{ id, archived_at, cancel_initiated_at, 7 more }
BetaMessageBatchCanceledResult object{ type }
type: "canceled"
defaultcanceled
BetaMessageBatchErroredResult object{ error, type }
error: BetaErrorResponse { error, request_id, type }
error: BetaError
One of the following:
request_id: string or null
type: "error"
defaulterror
type: "errored"
defaulterrored
BetaMessageBatchExpiredResult object{ type }
type: "expired"
defaultexpired
BetaMessageBatchIndividualResponse object{ custom_id, result }

This is a single line in the response .jsonl file and does not represent the response as a whole.

custom_id: string

Developer-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order.

Must be unique for each request within the Message Batch.

Processing result for this request.

Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration.

One of the following:
BetaMessageBatchRequestCounts object{ canceled, errored, expired, 2 more }
canceled: number

Number of requests in the Message Batch that have been canceled.

This is zero until processing of the entire Message Batch has ended.

default0
errored: number

Number of requests in the Message Batch that encountered an error.

This is zero until processing of the entire Message Batch has ended.

default0
expired: number

Number of requests in the Message Batch that have expired.

This is zero until processing of the entire Message Batch has ended.

default0
processing: number

Number of requests in the Message Batch that are processing.

default0
succeeded: number

Number of requests in the Message Batch that have completed successfully.

This is zero until processing of the entire Message Batch has ended.

default0
BetaMessageBatchResult = BetaMessageBatchSucceededResult { message, type } or BetaMessageBatchErroredResult { error, type } or BetaMessageBatchCanceledResult { type } or BetaMessageBatchExpiredResult { type }

Processing result for this request.

Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration.

One of the following:
BetaMessageBatchSucceededResult object{ message, type }
message: BetaMessage { id, container, content, 9 more }
type: "succeeded"
defaultsucceeded