Cancel Message Batch

VerifiedSafe

Cancel a message batch that is currently being processed. The batch transitions to a `canceling` state, and any in-progress non-interruptible requests may still complete. This is useful when you need to stop a batch early.

Sby Skills Guide Bot
DevelopmentIntermediate
6/2/2026
Claude Code
#anthropic-api#message-batches#batch-cancellation#api-management

Recommended for

Automated summary

Cancels a message batch currently being processed via the Anthropic API.

Strengths

  • Provides a clean way to stop batch processing without waiting for completion.
  • Immediately returns 'canceling' status and request counts.
  • Simple POST call requiring only the batch ID.

Limitations

  • Cancellation is not immediate: some non-interruptible requests may still finish.
  • Requires prior knowledge of the message_batch_id.
  • Only works if the batch is still being processed.
When to use it

Use this operation when a message batch needs to be stopped before completion, such as for error handling or priority changes.

When not to use it

Avoid using it to cancel individual requests or when absolute immediate cancellation is needed.

Security analysis

Safe
Quality score88/100

The skill provides documentation for a POST endpoint to cancel a message batch, using a localhost mock server. No dangerous commands, secrets handling, or execution risks are present. It is purely informational.

No concerns found

How this analysis is made

Examples

Cancel a batch by ID
Cancel the message batch with ID msgbatch_013Zva2CMHLNnXjNJJKqJ2EF.
Stop processing of a batch
Stop the processing of batch msgbatch_013Zva2CMHLNnXjNJJKqJ2EF using the Anthropic API.

Cancel Message Batch

Initiate cancellation of a Message Batch that is currently being processed. The batch enters a canceling state and any in-progress, non-interruptible requests may still complete.

API Details

Sandbox

Mock server URL: http://localhost:8080/rest/anthropic-message-batches-api/1.0.0/messages/batches/{message_batch_id}/cancel

Required Headers

  • anthropic-version: 2023-06-01
  • x-api-key: {api-key}

Path Parameters

| Parameter | Type | Required | Description | |-----------|------|----------|-------------| | message_batch_id | string | Yes | Unique identifier of the message batch to cancel |

Example Request

curl -X POST "http://localhost:8080/rest/anthropic-message-batches-api/1.0.0/messages/batches/msgbatch_013Zva2CMHLNnXjNJJKqJ2EF/cancel" \
  -H "anthropic-version: 2023-06-01" \
  -H "x-api-key: your-api-key"

Example Response

{
  "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:24Z",
  "cancel_initiated_at": "2024-08-20T19:00:00Z"
}

Instructions

When the user asks to cancel or stop a message batch, use this operation by making a POST request to /messages/batches/{message_batch_id}/cancel. Note that cancellation is not immediate — the batch enters canceling status and some requests may still complete.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/cancel-message-batch-mm78no3n/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/cancel-message-batch-mm78no3n' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/cancel-message-batch-mm78no3n/download' --output '.skill-downloads/cancel-message-batch-mm78no3n/SKILL.md.part' && mv '.skill-downloads/cancel-message-batch-mm78no3n/SKILL.md.part' '.skill-downloads/cancel-message-batch-mm78no3n/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

This file does not provide a usable name/description header for this native procedure. It remains available to download and inspect; use the manual method below.

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/cancel-message-batch-mm78no3n/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills