openapi: 3.2.0 info: title: Anthropic Admin Agents Message Batches API description: Manage administrative functions for Anthropic organizations, workspaces, users, invites, and API keys. version: 1.0.0 contact: name: Anthropic url: https://www.anthropic.com email: support@anthropic.com license: name: Anthropic API License url: https://www.anthropic.com/terms servers: - url: https://api.anthropic.com/v1 description: Production Server security: - AdminApiKeyAuth: [] tags: - name: Message Batches description: Create, manage, and retrieve batch message processing jobs paths: /messages/batches: get: summary: Anthropic List Message Batches description: Retrieves a paginated list of all message batches associated with your account. operationId: listMessageBatches tags: - Message Batches parameters: - $ref: '#/components/parameters/AnthropicVersion' - $ref: '#/components/parameters/AnthropicBeta' - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/BeforeId' - $ref: '#/components/parameters/AfterId' responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/MessageBatchList' examples: MessageBatchListExample: $ref: '#/components/examples/MessageBatchListExample' 4XX: $ref: '#/components/responses/ErrorResponse' x-microcks-operation: dispatcher: FALLBACK dispatcherRules: "{\n \"dispatcher\": \"FALLBACK\",\n \"fallback\": \"MessageBatchListExample\"\n}\n" post: summary: Anthropic Create Message Batch description: "Creates a new message batch for asynchronous processing. Submits multiple message \nrequests to be processed in the background, ideal for high-volume, non-time-sensitive workloads.\n" operationId: createMessageBatch tags: - Message Batches parameters: - $ref: '#/components/parameters/AnthropicVersion' - $ref: '#/components/parameters/AnthropicBeta' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateMessageBatchRequest' examples: CreateMessageBatchRequestExample: $ref: '#/components/examples/CreateMessageBatchRequestExample' responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/MessageBatch' examples: MessageBatchExample: $ref: '#/components/examples/MessageBatchExample' 4XX: $ref: '#/components/responses/ErrorResponse' x-microcks-operation: dispatcher: FALLBACK dispatcherRules: "{\n \"dispatcher\": \"FALLBACK\",\n \"fallback\": \"MessageBatchExample\"\n}\n" /messages/batches/{message_batch_id}: get: summary: Anthropic Retrieve Message Batch description: Retrieves the current status and details of a previously created batch processing job. operationId: retrieveMessageBatch tags: - Message Batches parameters: - $ref: '#/components/parameters/AnthropicVersion' - $ref: '#/components/parameters/AnthropicBeta' - $ref: '#/components/parameters/MessageBatchId' responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/MessageBatch' examples: MessageBatchExample: $ref: '#/components/examples/MessageBatchExample' 4XX: $ref: '#/components/responses/ErrorResponse' x-microcks-operation: dispatcher: FALLBACK dispatcherRules: "{\n \"dispatcher\": \"FALLBACK\",\n \"fallback\": \"MessageBatchExample\"\n}\n" delete: summary: Anthropic Delete Message Batch description: Permanently removes a message batch from your account. This action cannot be undone. operationId: deleteMessageBatch tags: - Message Batches parameters: - $ref: '#/components/parameters/AnthropicVersion' - $ref: '#/components/parameters/AnthropicBeta' - $ref: '#/components/parameters/MessageBatchId' responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/MessageBatchDeletedResponse' examples: MessageBatchDeletedResponseExample: $ref: '#/components/examples/MessageBatchDeletedResponseExample' 4XX: $ref: '#/components/responses/ErrorResponse' x-microcks-operation: dispatcher: FALLBACK dispatcherRules: "{\n \"dispatcher\": \"FALLBACK\",\n \"fallback\": \"MessageBatchDeletedResponseExample\"\n}\n" /messages/batches/{message_batch_id}/results: get: summary: Anthropic Retrieve Message Batch Results description: "Streams the results of a Message Batch as a .jsonl file. Each line is a JSON object \ncontaining the result of a single request. Results are not guaranteed to be in the \nsame order as requests. Use the custom_id field to match results to requests.\n" operationId: retrieveMessageBatchResults tags: - Message Batches parameters: - $ref: '#/components/parameters/AnthropicVersion' - $ref: '#/components/parameters/AnthropicBeta' - $ref: '#/components/parameters/MessageBatchId' responses: '200': description: Successful Response - Returns a .jsonl file where each line is a JSON object content: application/x-jsonl: schema: $ref: '#/components/schemas/MessageBatchResultsStream' examples: MessageBatchResultsExample: $ref: '#/components/examples/MessageBatchResultsExample' 4XX: $ref: '#/components/responses/ErrorResponse' x-microcks-operation: dispatcher: FALLBACK dispatcherRules: "{\n \"dispatcher\": \"FALLBACK\",\n \"fallback\": \"MessageBatchResultsExample\"\n}\n" /messages/batches/{message_batch_id}/cancel: post: summary: Anthropic Cancel Message Batch description: "Cancels a Message Batch that is currently being processed. Once cancellation is initiated, \nthe batch enters a canceling state. The system may complete any in-progress, non-interruptible \nrequests before finalizing cancellation.\n" operationId: cancelMessageBatch tags: - Message Batches parameters: - $ref: '#/components/parameters/AnthropicVersion' - $ref: '#/components/parameters/AnthropicBeta' - $ref: '#/components/parameters/MessageBatchId' responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/MessageBatch' examples: CanceledMessageBatchExample: $ref: '#/components/examples/CanceledMessageBatchExample' 4XX: $ref: '#/components/responses/ErrorResponse' x-microcks-operation: dispatcher: FALLBACK dispatcherRules: "{\n \"dispatcher\": \"FALLBACK\",\n \"fallback\": \"CanceledMessageBatchExample\"\n}\n" components: examples: MessageBatchResultsExample: summary: Message Batch Results value: '{"custom_id":"request-001","result":{"type":"succeeded","message":{"id":"msg_01FqfsLoHwgeFbguDgpz48m7","type":"message","role":"assistant","model":"claude-sonnet-4-20250514","content":[{"type":"text","text":"The capital of France is Paris."}],"stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":15,"output_tokens":8}}}} {"custom_id":"request-002","result":{"type":"succeeded","message":{"id":"msg_02GrsrtMhxghGfchvEhq59n8","type":"message","role":"assistant","model":"claude-sonnet-4-20250514","content":[{"type":"text","text":"Quantum computing uses quantum bits or qubits that can exist in multiple states simultaneously, unlike classical bits which are either 0 or 1."}],"stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":12,"output_tokens":35}}}} ' MessageBatchExample: summary: Message Batch Response value: id: msgbatch_013Zva2CMHLNnXjNJJKqJ2EF type: message_batch processing_status: in_progress request_counts: processing: 100 succeeded: 50 errored: 0 canceled: 0 expired: 0 created_at: '2024-08-20T18:37:24.100435Z' expires_at: '2024-08-21T18:37:24.100435Z' archived_at: null cancel_initiated_at: null ended_at: null results_url: null MessageBatchListExample: summary: Message Batch List Response value: data: - id: msgbatch_013Zva2CMHLNnXjNJJKqJ2EF type: message_batch processing_status: ended request_counts: processing: 0 succeeded: 150 errored: 0 canceled: 0 expired: 0 created_at: '2024-08-20T18:37:24.100435Z' expires_at: '2024-08-21T18:37:24.100435Z' archived_at: null cancel_initiated_at: null ended_at: '2024-08-20T19:45:00.000000Z' results_url: https://api.anthropic.com/v1/messages/batches/msgbatch_013Zva2CMHLNnXjNJJKqJ2EF/results - id: msgbatch_024Abw3DNIMOoYkKKLRrK3FG type: message_batch processing_status: in_progress request_counts: processing: 75 succeeded: 25 errored: 0 canceled: 0 expired: 0 created_at: '2024-08-21T10:15:00.000000Z' expires_at: '2024-08-22T10:15:00.000000Z' archived_at: null cancel_initiated_at: null ended_at: null results_url: null first_id: msgbatch_013Zva2CMHLNnXjNJJKqJ2EF has_more: true last_id: msgbatch_024Abw3DNIMOoYkKKLRrK3FG CanceledMessageBatchExample: summary: Canceled Message Batch Response value: id: msgbatch_013Zva2CMHLNnXjNJJKqJ2EF type: message_batch processing_status: canceling request_counts: processing: 50 succeeded: 40 errored: 5 canceled: 5 expired: 0 created_at: '2024-08-20T18:37:24.100435Z' expires_at: '2024-08-21T18:37:24.100435Z' archived_at: null cancel_initiated_at: '2024-08-20T19:00:00.000000Z' ended_at: null results_url: null ErrorExample: summary: Error Response value: type: invalid_request_error message: The message_batch_id provided is invalid or does not exist. CreateMessageBatchRequestExample: summary: Create Message Batch Request value: requests: - custom_id: request-001 params: model: claude-sonnet-4-20250514 max_tokens: 1024 messages: - role: user content: Hello, what is the capital of France? - custom_id: request-002 params: model: claude-sonnet-4-20250514 max_tokens: 1024 messages: - role: user content: Explain quantum computing in simple terms. - custom_id: request-003 params: model: claude-sonnet-4-20250514 max_tokens: 2048 messages: - role: user content: Write a haiku about programming. MessageBatchDeletedResponseExample: summary: Message Batch Deleted Response value: id: msgbatch_013Zva2CMHLNnXjNJJKqJ2EF type: message_batch_deleted schemas: ProcessingStatus: type: string enum: - in_progress - canceling - ended description: Current processing status of the Message Batch MessageBatchIndividualRequest: type: object required: - custom_id - params properties: custom_id: type: string description: Developer-provided ID for matching results to requests. Must be unique within the batch. params: $ref: '#/components/schemas/MessageParams' MessageBatchResultsStream: type: string description: JSONL formatted stream with one result object per line Error: type: object required: - type - message properties: type: type: string description: The type of error message: type: string description: A human-readable error message MessageBatchList: type: object required: - data - first_id - has_more - last_id properties: data: type: array description: List of Message Batch objects items: $ref: '#/components/schemas/MessageBatch' first_id: type: string nullable: true description: First ID in the data list for pagination has_more: type: boolean description: Indicates if there are more results available last_id: type: string nullable: true description: Last ID in the data list for pagination RequestCounts: type: object description: Tallies of requests categorized by their status required: - processing - succeeded - errored - canceled - expired properties: processing: type: integer description: Number of requests currently being processed succeeded: type: integer description: Number of requests that completed successfully errored: type: integer description: Number of requests that encountered an error canceled: type: integer description: Number of requests that were canceled expired: type: integer description: Number of requests that expired before processing Role: type: string enum: - user - assistant description: The role of the message sender Message: type: object required: - role - content properties: role: $ref: '#/components/schemas/Role' content: type: string description: The content of the message MessageBatchDeletedResponse: type: object required: - id - type properties: id: type: string description: ID of the deleted message batch type: type: string enum: - message_batch_deleted default: message_batch_deleted description: Deletion confirmation type MessageBatch: type: object required: - id - type - processing_status - request_counts - created_at - expires_at - archived_at - cancel_initiated_at - ended_at - results_url properties: id: type: string description: Unique object identifier. The format and length of IDs may change over time. type: type: string enum: - message_batch default: message_batch description: Object type. For Message Batches, this is always "message_batch". processing_status: $ref: '#/components/schemas/ProcessingStatus' request_counts: $ref: '#/components/schemas/RequestCounts' created_at: type: string format: date-time description: RFC 3339 datetime when the batch was created expires_at: type: string format: date-time description: RFC 3339 datetime when the batch will expire (24 hours after creation) archived_at: type: string format: date-time nullable: true description: RFC 3339 datetime when the batch was archived, or null if not archived cancel_initiated_at: type: string format: date-time nullable: true description: RFC 3339 datetime when cancellation was initiated, or null if not canceled ended_at: type: string format: date-time nullable: true description: RFC 3339 datetime when processing ended, or null if still processing results_url: type: string format: uri nullable: true description: URL to the .jsonl file containing batch results. Available only once processing ends. CreateMessageBatchRequest: type: object required: - requests properties: requests: type: array description: List of requests for message completion. Each is an individual Message request. minItems: 1 maxItems: 10000 items: $ref: '#/components/schemas/MessageBatchIndividualRequest' MessageParams: type: object description: Parameters for the individual Message creation request required: - model - max_tokens - messages properties: model: type: string description: The model that will complete your prompt max_tokens: type: integer description: Maximum number of tokens to generate before stopping minimum: 1 messages: type: array description: Input messages for the conversation minItems: 1 items: $ref: '#/components/schemas/Message' parameters: MessageBatchId: name: message_batch_id in: path required: true description: Unique identifier for the message batch schema: type: string example: msgbatch_013Zva2CMHLNnXjNJJKqJ2EF AnthropicVersion: name: anthropic-version in: header required: true description: The version of the Anthropic API to use schema: type: string example: '2023-06-01' BeforeId: name: before_id in: query required: false description: ID of the object to use as a cursor for pagination. Returns results immediately before this object. schema: type: string Limit: name: limit in: query required: false description: Number of items to return per page. Defaults to 20. Ranges from 1 to 1000. schema: type: integer default: 20 minimum: 1 maximum: 1000 AfterId: name: after_id in: query required: false description: ID of the object to use as a cursor for pagination. Returns results immediately after this object. schema: type: string AnthropicBeta: name: anthropic-beta in: header required: false description: 'Optional header to specify the beta version(s) you want to use. To use multiple betas, use a comma separated list or specify the header multiple times. ' schema: type: array items: type: string style: form explode: false responses: ErrorResponse: description: Error Response content: application/json: schema: $ref: '#/components/schemas/Error' examples: ErrorExample: $ref: '#/components/examples/ErrorExample' securitySchemes: AdminApiKeyAuth: type: apiKey in: header name: x-api-key description: Your Admin API key for authentication (starts with sk-ant-admin...).