Claude Platform Docs

Batches

Create a Message Batch
MessageBatch messages().batches().create(BatchCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
POST/v1/messages/batches
Retrieve a Message Batch
MessageBatch messages().batches().retrieve(BatchRetrieveParamsparams = BatchRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
GET/v1/messages/batches/{message_batch_id}
List Message Batches
BatchListPage messages().batches().list(BatchListParamsparams = BatchListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
GET/v1/messages/batches
Cancel a Message Batch
MessageBatch messages().batches().cancel(BatchCancelParamsparams = BatchCancelParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
POST/v1/messages/batches/{message_batch_id}/cancel
Delete a Message Batch
DeletedMessageBatch messages().batches().delete(BatchDeleteParamsparams = BatchDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
DELETE/v1/messages/batches/{message_batch_id}
Retrieve Message Batch results
MessageBatchIndividualResponse messages().batches().resultsStreaming(BatchResultsParamsparams = BatchResultsParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
GET/v1/messages/batches/{message_batch_id}/results
Models
class DeletedMessageBatch:
String id

ID of the Message Batch.

JsonValue type "message_batch_deleted"constant

Deleted object type.

For Message Batches, this is always "message_batch_deleted".

class MessageBatch:
class MessageBatchCanceledResult:
JsonValue type "canceled"constant
class MessageBatchErroredResult:
One of the following:
Optional<String> requestId
JsonValue type "error"constant
JsonValue type "errored"constant
class MessageBatchExpiredResult:
JsonValue type "expired"constant
class MessageBatchIndividualResponse:

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

class MessageBatchRequestCounts:
long canceled

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

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

long errored

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

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

long expired

Number of requests in the Message Batch that have expired.

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

long processing

Number of requests in the Message Batch that are processing.

long succeeded

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

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

class MessageBatchResult: A class that can be one of several variants.union

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.

class MessageBatchSucceededResult:
Message message
JsonValue type "succeeded"constant
class MessageBatchErroredResult:
One of the following:
Optional<String> requestId
JsonValue type "error"constant
JsonValue type "errored"constant
class MessageBatchCanceledResult:
JsonValue type "canceled"constant
class MessageBatchExpiredResult:
JsonValue type "expired"constant
class MessageBatchSucceededResult:
Message message
JsonValue type "succeeded"constant