Claude Platform Docs

Batches

Create a Message Batch
BetaMessageBatch beta().messages().batches().create(BatchCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
POST/v1/messages/batches
Retrieve a Message Batch
BetaMessageBatch beta().messages().batches().retrieve(BatchRetrieveParamsparams = BatchRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
GET/v1/messages/batches/{message_batch_id}
List Message Batches
BatchListPage beta().messages().batches().list(BatchListParamsparams = BatchListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
GET/v1/messages/batches
Cancel a Message Batch
BetaMessageBatch beta().messages().batches().cancel(BatchCancelParamsparams = BatchCancelParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
POST/v1/messages/batches/{message_batch_id}/cancel
Delete a Message Batch
BetaDeletedMessageBatch beta().messages().batches().delete(BatchDeleteParamsparams = BatchDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
DELETE/v1/messages/batches/{message_batch_id}
Retrieve Message Batch results
BetaMessageBatchIndividualResponse beta().messages().batches().resultsStreaming(BatchResultsParamsparams = BatchResultsParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
GET/v1/messages/batches/{message_batch_id}/results
Models
class BetaDeletedMessageBatch:
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 BetaMessageBatch:
class BetaMessageBatchCanceledResult:
JsonValue type "canceled"constant
class BetaMessageBatchErroredResult:
BetaError error
One of the following:
Optional<String> requestId
JsonValue type "error"constant
JsonValue type "errored"constant
class BetaMessageBatchExpiredResult:
JsonValue type "expired"constant
class BetaMessageBatchIndividualResponse:

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

class BetaMessageBatchRequestCounts:
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 BetaMessageBatchResult: 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 BetaMessageBatchSucceededResult:
BetaMessage message
JsonValue type "succeeded"constant
class BetaMessageBatchErroredResult:
BetaError error
One of the following:
Optional<String> requestId
JsonValue type "error"constant
JsonValue type "errored"constant
class BetaMessageBatchCanceledResult:
JsonValue type "canceled"constant
class BetaMessageBatchExpiredResult:
JsonValue type "expired"constant
class BetaMessageBatchSucceededResult:
BetaMessage message
JsonValue type "succeeded"constant