SPB Git

Repository Public

retrieve.md 6.4 KB 265 lines markdown

1---2title: Retrieve a Message Batch3url: https://platform.claude.com/docs/en/api/beta/messages/batches/retrieve4---56# Retrieve a Message Batch78**GET** `/v1/messages/batches/{message_batch_id}`910This 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.1112Learn more about the Message Batches API in our [user guide](https://platform.claude.com/docs/en/build-with-claude/batch-processing)1314## Path parameters1516- `message_batch_id: string`1718  ID of the Message Batch.1920## Headers2122- `"anthropic-beta": optional array of AnthropicBeta`2324  Optional header to specify the beta version(s) you want to use.2526  - `string`2728  - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 43 more`2930    - `"message-batches-2024-09-24"`3132    - `"prompt-caching-2024-07-31"`3334    - `"computer-use-2024-10-22"`3536    - `"computer-use-2025-01-24"`3738    - `"pdfs-2024-09-25"`3940    - `"token-counting-2024-11-01"`4142    - `"token-efficient-tools-2025-02-19"`4344    - `"output-128k-2025-02-19"`4546    - `"files-api-2025-04-14"`4748    - `"mcp-client-2025-04-04"`4950    - `"mcp-client-2025-11-20"`5152    - `"dev-full-thinking-2025-05-14"`5354    - `"interleaved-thinking-2025-05-14"`5556    - `"code-execution-2025-05-22"`5758    - `"extended-cache-ttl-2025-04-11"`5960    - `"context-1m-2025-08-07"`6162    - `"context-management-2025-06-27"`6364    - `"model-context-window-exceeded-2025-08-26"`6566    - `"skills-2025-10-02"`6768    - `"fast-mode-2026-02-01"`6970    - `"output-300k-2026-03-24"`7172    - `"user-profiles-2026-03-24"`7374    - `"user-profiles-2026-08-18"`7576    - `"user-profiles-2026-09-04"`7778    - `"advisor-tool-2026-03-01"`7980    - `"managed-agents-2026-04-01"`8182    - `"cache-diagnosis-2026-04-07"`8384    - `"dreaming-2026-04-21"`8586    - `"thinking-token-count-2026-05-13"`8788    - `"server-side-fallback-2026-06-01"`8990    - `"server-side-fallback-2026-07-01"`9192    - `"fallback-credit-2026-06-01"`9394    - `"fallback-credit-2026-07-01"`9596    - `"agent-memory-2026-07-22"`9798    - `"mid-conversation-tool-changes-2026-07-01"`99100    - `"compact-2026-01-12"`101102    - `"computer-use-2025-11-24"`103104    - `"mcp-tunnels-2026-06-22"`105106    - `"structured-outputs-2025-11-13"`107108    - `"task-budgets-2026-03-13"`109110    - `"thinking-display-updates-2026-08-18"`111112    - `"ce-user-management-2026-07-13"`113114    - `"mid-conversation-output-config-2026-07-01"`115116    - `"thinking-binding-controls-2026-08-01"`117118    - `"mid-conversation-system-clear-at-2026-08-21"`119120    - `"compact-2026-09-04"`121122- `"anthropic-workspace-id": optional string`123124## Returns125126- `BetaMessageBatch object`127128  - `type: "message_batch"`129130    Object type.131132    For Message Batches, this is always `"message_batch"`.133134    default: message_batch135136  - `id: string`137138    Unique object identifier.139140    The format and length of IDs may change over time.141142  - `archived_at: string or null`143144    RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable.145146    format: date-time147148  - `cancel_initiated_at: string or null`149150    RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated.151152    format: date-time153154  - `created_at: string`155156    RFC 3339 datetime string representing the time at which the Message Batch was created.157158    format: date-time159160  - `ended_at: string or null`161162    RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends.163164    Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired.165166    format: date-time167168  - `expires_at: string`169170    RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation.171172    format: date-time173174  - `processing_status: "in_progress" or "canceling" or "ended"`175176    Processing status of the Message Batch.177178    - `"in_progress"`179180    - `"canceling"`181182    - `"ended"`183184  - `request_counts: BetaMessageBatchRequestCounts`185186    Tallies requests within the Message Batch, categorized by their status.187188    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.189190    - `canceled: number`191192      Number of requests in the Message Batch that have been canceled.193194      This is zero until processing of the entire Message Batch has ended.195196      default: 0197198    - `errored: number`199200      Number of requests in the Message Batch that encountered an error.201202      This is zero until processing of the entire Message Batch has ended.203204      default: 0205206    - `expired: number`207208      Number of requests in the Message Batch that have expired.209210      This is zero until processing of the entire Message Batch has ended.211212      default: 0213214    - `processing: number`215216      Number of requests in the Message Batch that are processing.217218      default: 0219220    - `succeeded: number`221222      Number of requests in the Message Batch that have completed successfully.223224      This is zero until processing of the entire Message Batch has ended.225226      default: 0227228  - `results_url: string or null`229230    URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends.231232    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.233234## Example235236```bash237curl https://api.anthropic.com/v1/messages/batches/$MESSAGE_BATCH_ID \238    -H 'anthropic-version: 2023-06-01' \239    -H 'anthropic-beta: message-batches-2024-09-24' \240    -H "X-Api-Key: $ANTHROPIC_API_KEY"241```242243### Response (200)244245```json246{247  "id": "msgbatch_013Zva2CMHLNnXjNJJKqJ2EF",248  "archived_at": "2024-08-20T18:37:24.100435Z",249  "cancel_initiated_at": "2024-08-20T18:37:24.100435Z",250  "created_at": "2024-08-20T18:37:24.100435Z",251  "ended_at": "2024-08-20T18:37:24.100435Z",252  "expires_at": "2024-08-20T18:37:24.100435Z",253  "processing_status": "in_progress",254  "request_counts": {255    "canceled": 10,256    "errored": 30,257    "expired": 10,258    "processing": 100,259    "succeeded": 50260  },261  "results_url": "https://api.anthropic.com/v1/messages/batches/msgbatch_013Zva2CMHLNnXjNJJKqJ2EF/results",262  "type": "message_batch"263}264```265
Files main
Menu

Theme