SPB Git

Repository Public

listing-message-batches.md 5.1 KB 195 lines markdown

1---2title: List Message Batches3url: https://platform.claude.com/docs/en/api/messages/batches/list4---56# List Message Batches78**GET** `/v1/messages/batches`910List all Message Batches within a Workspace. Most recently created batches are returned first.1112Learn more about the Message Batches API in our [user guide](https://platform.claude.com/docs/en/build-with-claude/batch-processing)1314## Query parameters1516- `after_id: optional string`1718  ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately after this object.1920- `before_id: optional string`2122  ID of the object to use as a cursor for pagination. When provided, returns the page of results immediately before this object.2324- `limit: optional number`2526  Number of items to return per page.2728  Defaults to `20`. Ranges from `1` to `1000`.2930  default: 20, maximum: 1000, minimum: 13132## Headers3334- `"anthropic-workspace-id": optional string`3536## Returns3738- `data: array of MessageBatch`3940  - `type: "message_batch"`4142    Object type.4344    For Message Batches, this is always `"message_batch"`.4546    default: message_batch4748  - `id: string`4950    Unique object identifier.5152    The format and length of IDs may change over time.5354  - `archived_at: string or null`5556    RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable.5758    format: date-time5960  - `cancel_initiated_at: string or null`6162    RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated.6364    format: date-time6566  - `created_at: string`6768    RFC 3339 datetime string representing the time at which the Message Batch was created.6970    format: date-time7172  - `ended_at: string or null`7374    RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends.7576    Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired.7778    format: date-time7980  - `expires_at: string`8182    RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation.8384    format: date-time8586  - `processing_status: "in_progress" or "canceling" or "ended"`8788    Processing status of the Message Batch.8990    - `"in_progress"`9192    - `"canceling"`9394    - `"ended"`9596  - `request_counts: MessageBatchRequestCounts`9798    Tallies requests within the Message Batch, categorized by their status.99100    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.101102    - `canceled: number`103104      Number of requests in the Message Batch that have been canceled.105106      This is zero until processing of the entire Message Batch has ended.107108      default: 0109110    - `errored: number`111112      Number of requests in the Message Batch that encountered an error.113114      This is zero until processing of the entire Message Batch has ended.115116      default: 0117118    - `expired: number`119120      Number of requests in the Message Batch that have expired.121122      This is zero until processing of the entire Message Batch has ended.123124      default: 0125126    - `processing: number`127128      Number of requests in the Message Batch that are processing.129130      default: 0131132    - `succeeded: number`133134      Number of requests in the Message Batch that have completed successfully.135136      This is zero until processing of the entire Message Batch has ended.137138      default: 0139140  - `results_url: string or null`141142    URL to a `.jsonl` file containing the results of the Message Batch requests. Specified only once processing ends.143144    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.145146- `first_id: string or null`147148  First ID in the `data` list. Can be used as the `before_id` for the previous page.149150- `has_more: boolean`151152  Indicates if there are more results in the requested page direction.153154- `last_id: string or null`155156  Last ID in the `data` list. Can be used as the `after_id` for the next page.157158## Example159160```bash161curl https://api.anthropic.com/v1/messages/batches \162    -H 'anthropic-version: 2023-06-01' \163    -H "X-Api-Key: $ANTHROPIC_API_KEY"164```165166### Response (200)167168```json169{170  "data": [171    {172      "id": "msgbatch_013Zva2CMHLNnXjNJJKqJ2EF",173      "archived_at": "2024-08-20T18:37:24.100435Z",174      "cancel_initiated_at": "2024-08-20T18:37:24.100435Z",175      "created_at": "2024-08-20T18:37:24.100435Z",176      "ended_at": "2024-08-20T18:37:24.100435Z",177      "expires_at": "2024-08-20T18:37:24.100435Z",178      "processing_status": "in_progress",179      "request_counts": {180        "canceled": 10,181        "errored": 30,182        "expired": 10,183        "processing": 100,184        "succeeded": 50185      },186      "results_url": "https://api.anthropic.com/v1/messages/batches/msgbatch_013Zva2CMHLNnXjNJJKqJ2EF/results",187      "type": "message_batch"188    }189  ],190  "first_id": "first_id",191  "has_more": true,192  "last_id": "last_id"193}194```195
Files main
Menu

Theme