---
title: "Cancel message batch (Anthropic-compatible)"
method: POST
path: "/v1/messages/batches/{message_batch_id}/cancel"
tags: ["Anthropic"]
---

# Cancel message batch (Anthropic-compatible)

`POST /v1/messages/batches/{message_batch_id}/cancel`

## Request

- Base URL: `https://api.tokenlab.sh`
- URL: `https://api.tokenlab.sh/v1/messages/batches/{message_batch_id}/cancel`
- Auth: HTTP bearer

Cancels an Anthropic Message Batch when cancellation is still available for that batch.

## Path parameters

- `message_batch_id` string, required

## Response `200`

Cancelled message batch

- AnthropicMessageBatch: Anthropic-compatible message batch object.
  - `id` string, required: Message batch identifier
  - `type` 'message_batch', required
  - `processing_status` string, required: Current processing status for the batch
  - `request_counts` object, required: Request count summary for the batch
  - `ended_at` string, nullable, required: ISO timestamp when processing ended, when available
  - `created_at` string, required: ISO timestamp when the batch was created, when available
  - `expires_at` string, required: ISO timestamp when the batch expires, when available
  - `cancel_initiated_at` string, nullable, required: ISO timestamp when cancellation was initiated, when available
  - `archived_at` string, nullable, required: ISO timestamp when the batch was archived, when available
  - `results_url` string, nullable, required: Results URL, when available

## Other responses

- `400`: Bad Request - Invalid input
- `401`: Unauthorized - Invalid or missing API key
- `402`: Payment Required - Insufficient balance or quota exceeded
- `429`: Rate Limit Exceeded
- `500`: Internal Server Error
- `502`: Service Error

---

[API](https://skmtc.dev/tokenlab/apis/tokenlab-ai-gateway.md) · [All operations](https://skmtc.dev/tokenlab/apis/tokenlab-ai-gateway/llms.txt) · [OpenAPI document](https://skmtc.dev/tokenlab/apis/tokenlab-ai-gateway/revisions/3208bfbcda22?raw)
