GET/v1/messages/batches/{message_batch_id}

Retrieve a Message Batch

This endpoint is idempotent and can be used to poll for Message Batch completion. To access the results of a Message Batch, make a request to the results_url field in the response.

Learn more about the Message Batches API in our user guide

4 parameters
message_batch_idstringrequired
ID of the Message Batch.
anthropic-versionstringoptional
The version of the Claude API you want to use. Read more about versioning and our version history [here](https://platform.claude.com/docs/en/api/versioning).
x-api-keystringoptional
Your unique API key for authentication. This key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace.
anthropic-workspace-idstringoptional
Optional header to select the Workspace for this request. The value is a Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`). Only needed for credentials that can act on more than one Workspace. A credential that belongs to a specific Workspace may omit it; if sent, it must match that Workspace.

17 status codes
200Successful Response
archived_atstringrequired
RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable.
cancel_initiated_atstringrequired
RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated.
created_atstringrequired
RFC 3339 datetime string representing the time at which the Message Batch was created.
ended_atstringrequired
RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends. Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired.
expires_atstringrequired
RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation.
idstringrequired
Unique object identifier. The format and length of IDs may change over time.
processing_statusstringrequired
Processing status of the Message Batch.
Allowed:in_progresscancelingended
request_countsobjectrequired
Tallies requests within the Message Batch, categorized by their status. Requests start as `processing` and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch.
results_urlstringrequired
URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends. Results in the file are not guaranteed to be in the same order as requests. Use the `custom_id` field to match results to requests.
typestringrequired
Object type. For Message Batches, this is always `"message_batch"`.
Default:message_batch
400Invalid argument - The client specified an invalid argument
errorobjectrequired
request_idstringrequired
Default:null
typestringrequired
Default:error
401Unauthenticated - The request does not have valid authentication credentials
errorobjectrequired
request_idstringrequired
Default:null
typestringrequired
Default:error
403Permission denied - The caller does not have permission to execute the specified operation
errorobjectrequired
request_idstringrequired
Default:null
typestringrequired
Default:error
404Not found - Some requested entity was not found
errorobjectrequired
request_idstringrequired
Default:null
typestringrequired
Default:error
408Deadline exceeded - The deadline expired before the operation could complete
errorobjectrequired
request_idstringrequired
Default:null
typestringrequired
Default:error
409Aborted - The operation was aborted due to concurrency issue
errorobjectrequired
request_idstringrequired
Default:null
typestringrequired
Default:error
412Failed precondition - Operation was rejected because the system is not in required state
errorobjectrequired
request_idstringrequired
Default:null
typestringrequired
Default:error
413Out of range - Operation was attempted past the valid range
errorobjectrequired
request_idstringrequired
Default:null
typestringrequired
Default:error
429Resource exhausted - Some resource has been exhausted (rate limiting)
errorobjectrequired
request_idstringrequired
Default:null
typestringrequired
Default:error
431Request header fields too large - Request metadata was too large
errorobjectrequired
request_idstringrequired
Default:null
typestringrequired
Default:error
499Cancelled - The operation was cancelled by the client
errorobjectrequired
request_idstringrequired
Default:null
typestringrequired
Default:error
500Internal - Internal server error
errorobjectrequired
request_idstringrequired
Default:null
typestringrequired
Default:error
501Unimplemented - The operation is not implemented or supported
errorobjectrequired
request_idstringrequired
Default:null
typestringrequired
Default:error
503Unavailable - The service is currently unavailable
errorobjectrequired
request_idstringrequired
Default:null
typestringrequired
Default:error
504Deadline exceeded - Upstream service did not respond in time
errorobjectrequired
request_idstringrequired
Default:null
typestringrequired
Default:error
529Overloaded - The service is temporarily overloaded
errorobjectrequired
request_idstringrequired
Default:null
typestringrequired
Default:error

Error handling

A 400 is returned: Invalid argument - The client specified an invalid argument. A 401 is returned: Unauthenticated - The request does not have valid authentication credentials. A 403 is returned: Permission denied - The caller does not have permission to execute the specified operation. A 404 is returned: Not found - Some requested entity was not found. A 408 is returned: Deadline exceeded - The deadline expired before the operation could complete. A 409 is returned: Aborted - The operation was aborted due to concurrency issue. A 412 is returned: Failed precondition - Operation was rejected because the system is not in required state. A 413 is returned: Out of range - Operation was attempted past the valid range. A 429 is returned: Resource exhausted - Some resource has been exhausted (rate limiting). A 431 is returned: Request header fields too large - Request metadata was too large. A 499 is returned: Cancelled - The operation was cancelled by the client. A 500 is returned: Internal - Internal server error. A 501 is returned: Unimplemented - The operation is not implemented or supported. A 503 is returned: Unavailable - The service is currently unavailable. A 504 is returned: Deadline exceeded - Upstream service did not respond in time. A 529 is returned: Overloaded - The service is temporarily overloaded.