Retrieve a Message Batch
api/messages/batches/retrieve
Nearest release: v2.1.245, published an hour after this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
api/messages/batches/retrieve Changed · +29 / -14 lines
# Retrieve a Message Batch ## Path parameters ## Returns ## Example ### Response (200) ## Retrieve a Message Batch ### Path Parameters ### Returns ### Example #### Response
---- -title: Retrieve a Message Batch -url: https://platform.claude.com/docs/en/api/messages/batches/retrieve ---- +# Retrieve a Message Batch -## Retrieve a Message Batch +**GET** `/v1/messages/batches/{message_batch_id}` -**get** `/v1/messages/batches/{message_batch_id}` - 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](https://platform.claude.com/docs/en/build-with-claude/batch-processing) -### Path Parameters +## Path parameters - `message_batch_id: string` ID of the Message Batch. -### Returns +## Returns -- `MessageBatch object { id, archived_at, cancel_initiated_at, 7 more }` +- `MessageBatch object` - `id: string`
RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable. + format: date-time + - `cancel_initiated_at: string or null` RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated. + format: date-time + - `created_at: string` RFC 3339 datetime string representing the time at which the Message Batch was created. + format: date-time + - `ended_at: string or null` 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. + format: date-time + - `expires_at: string` RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation. + format: date-time + - `processing_status: "in_progress" or "canceling" or "ended"` Processing status of the Message Batch.
This is zero until processing of the entire Message Batch has ended. + default: 0 + - `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. + default: 0 + - `expired: number` Number of requests in the Message Batch that have expired.
This is zero until processing of the entire Message Batch has ended. + default: 0 + - `processing: number` Number of requests in the Message Batch that are processing. + default: 0 + - `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. + default: 0 + - `results_url: string or null` URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends.
For Message Batches, this is always `"message_batch"`. - - `"message_batch"` + default: message_batch -### Example +## Example -```http +```bash curl https://api.anthropic.com/v1/messages/batches/$MESSAGE_BATCH_ID \ -H 'anthropic-version: 2023-06-01' \ -H "X-Api-Key: $ANTHROPIC_API_KEY" ``` -#### Response +### Response (200) ```json {