Claude Platform Docs

Batches

Create a Message Batch
client.Beta.Messages.Batches.New(ctx, params) (*BetaMessageBatch, error)
POST/v1/messages/batches
Retrieve a Message Batch
client.Beta.Messages.Batches.Get(ctx, messageBatchID, query) (*BetaMessageBatch, error)
GET/v1/messages/batches/{message_batch_id}
List Message Batches
client.Beta.Messages.Batches.List(ctx, params) (*Page[BetaMessageBatch], error)
GET/v1/messages/batches
Cancel a Message Batch
client.Beta.Messages.Batches.Cancel(ctx, messageBatchID, body) (*BetaMessageBatch, error)
POST/v1/messages/batches/{message_batch_id}/cancel
Delete a Message Batch
client.Beta.Messages.Batches.Delete(ctx, messageBatchID, body) (*BetaDeletedMessageBatch, error)
DELETE/v1/messages/batches/{message_batch_id}
Retrieve Message Batch results
client.Beta.Messages.Batches.Results(ctx, messageBatchID, query) (*BetaMessageBatchIndividualResponse, error)
GET/v1/messages/batches/{message_batch_id}/results
Models
type BetaDeletedMessageBatch struct{…}
ID string

ID of the Message Batch.

Type MessageBatchDeleted

Deleted object type.

For Message Batches, this is always "message_batch_deleted".

defaultmessage_batch_deleted
type BetaMessageBatch struct{…}
type BetaMessageBatchCanceledResult struct{…}
Type Canceled
defaultcanceled
type BetaMessageBatchErroredResult struct{…}
One of the following:
RequestID string
Type Error
defaulterror
Type Errored
defaulterrored
type BetaMessageBatchExpiredResult struct{…}
Type Expired
defaultexpired
type BetaMessageBatchIndividualResponse struct{…}

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

type BetaMessageBatchRequestCounts struct{…}
Canceled int64

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 int64

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 int64

Number of requests in the Message Batch that have expired.

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

default0
Processing int64

Number of requests in the Message Batch that are processing.

default0
Succeeded int64

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

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

default0
type BetaMessageBatchResultUnion interface{…}

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:
type BetaMessageBatchSucceededResult struct{…}
Message BetaMessage
Type Succeeded
defaultsucceeded
type BetaMessageBatchErroredResult struct{…}
One of the following:
RequestID string
Type Error
defaulterror
Type Errored
defaulterrored
type BetaMessageBatchCanceledResult struct{…}
Type Canceled
defaultcanceled
type BetaMessageBatchExpiredResult struct{…}
Type Expired
defaultexpired
type BetaMessageBatchSucceededResult struct{…}
Message BetaMessage
Type Succeeded
defaultsucceeded