Anthropic Messages API

Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation. The Messages API supports text, images, tool use, extended thinking, streaming, structured outputs, prompt caching, compaction, and the new advisor tool for pairing executor and higher-intelligence advisor models.

Operations 16

Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay

POST /v1/messages Generate Claude's next message in a conversation · Create a Message #
Ask an LLM
“How do I send a prompt to Claude and get a reply back?”
“Can I stream the response and set a system prompt, temperature and max tokens?”
Tell an agent
Ask model {model} to reply to {messages} in at most {max_tokens} tokens.
Send {messages} to {model} with system prompt {system}, capped at {max_tokens} tokens, and stream the answer.
POST /v1/messages/batches Submit a batch of message requests · Create a Message Batch #
Ask an LLM
“How do I run many Claude prompts at once asynchronously?”
“Does a message batch start processing as soon as I submit it?”
Tell an agent
Submit message batch requests {requests}.
Queue these prompts {requests} as one asynchronous message batch.
GET /v1/messages/batches List message batches in a workspace · List Message Batches #
Ask an LLM
“Which message batches have I submitted in this workspace, newest first?”
“Can I page backward or forward through my batch list by ID?”
Tell an agent
List my {limit} most recent message batches.
Show the message batches created after batch {after_id}.
GET /v1/messages/batches/{message_batch_id} Check a message batch's processing status · Retrieve a Message Batch #
Ask an LLM
“Is my message batch done processing yet?”
“Where do I find the results URL for a finished batch?”
Tell an agent
Check the status of message batch {message_batch_id}.
Poll batch {message_batch_id} until it finishes processing.
DELETE /v1/messages/batches/{message_batch_id} Delete a finished message batch · Delete a Message Batch #
Ask an LLM
“Can I delete a message batch that's still processing?”
“How do I clean up an old message batch once it's finished?”
Tell an agent destructive · confirm first
Delete finished message batch {message_batch_id}.
Clean up completed batch {message_batch_id} from my workspace.
POST /v1/messages/batches/{message_batch_id}/cancel Cancel an in-progress message batch · Cancel a Message Batch #
Ask an LLM
“How do I stop a message batch before it finishes?”
“What state does a batch go into right after I cancel it?”
Tell an agent destructive · confirm first
Cancel message batch {message_batch_id}.
Stop processing the rest of batch {message_batch_id} now.
POST /v1/messages/batches/{message_batch_id}/cancel?beta=true Cancel a message batch via the beta flag · Cancel a Message Batch #
Ask an LLM
“Can I cancel a running batch through the beta message batches endpoint?”
“Which beta-flag call halts a batch that's still processing?”
Tell an agent destructive · confirm first
Cancel beta message batch {message_batch_id}.
With the beta flag, halt in-flight batch {message_batch_id}.
GET /v1/messages/batches/{message_batch_id}/results Download a message batch's results · Retrieve Message Batch results #
Ask an LLM
“How do I get the responses back from a completed message batch?”
“Are batch results returned in the same order as my requests?”
Tell an agent
Download the results of batch {message_batch_id}.
Stream the .jsonl results file for message batch {message_batch_id}.
GET /v1/messages/batches/{message_batch_id}/results?beta=true Download batch results via the beta flag · Retrieve Message Batch results #
Ask an LLM
“Can I pull a batch's .jsonl results through the beta endpoint?”
“What's the beta-flag way to read every result line of a batch?”
Tell an agent
Get beta results for message batch {message_batch_id}.
With the beta flag, fetch the result lines for batch {message_batch_id}.
GET /v1/messages/batches/{message_batch_id}?beta=true Check a batch's status via the beta flag · Retrieve a Message Batch #
Ask an LLM
“How do I poll a batch's progress through the beta message batches endpoint?”
“Does the beta batch lookup return the results URL too?”
Tell an agent
Get beta message batch {message_batch_id}.
With the beta flag, check whether batch {message_batch_id} has ended.
DELETE /v1/messages/batches/{message_batch_id}?beta=true Delete a message batch via the beta flag · Delete a Message Batch #
Ask an LLM
“Can I delete a completed batch through the beta endpoint?”
“What's the beta-flag call to remove an old message batch?”
Tell an agent destructive · confirm first
Delete beta message batch {message_batch_id}.
With the beta flag, remove ended batch {message_batch_id}.
POST /v1/messages/batches?beta=true Submit a message batch via the beta flag · Create a Message Batch #
Ask an LLM
“Can I create a message batch with beta features using the beta endpoint?”
“Which beta-flag call queues many message requests in one go?”
Tell an agent
Create a beta message batch from {requests}.
With the beta flag, send {requests} for asynchronous processing.
GET /v1/messages/batches?beta=true List message batches via the beta flag · List Message Batches #
Ask an LLM
“Which batches does the beta message batches listing show for my workspace?”
“Can I page the beta batch list using a before ID?”
Tell an agent
List beta message batches, {limit} per page.
With the beta flag, show batches created before {before_id}.
POST /v1/messages/count_tokens Count the tokens in a message before sending · Count tokens in a Message #
Ask an LLM
“How many tokens will my prompt use before I actually send it to Claude?”
“Does the token count include tools, images and documents?”
Tell an agent
Count the tokens {messages} would use on {model}.
Estimate input tokens for {messages} with system prompt {system} and tools {tools} on {model}.
POST /v1/messages/count_tokens?beta=true Count message tokens including MCP servers (beta) · Count tokens in a Message #
Ask an LLM
“Can I count tokens for a prompt that uses MCP servers or context management?”
“What's the beta-flag token counter for requests with an output format?”
Tell an agent
With the beta flag, count tokens for {messages} on {model} including MCP servers {mcp_servers}.
Tally beta token usage for {messages} on {model} with context management {context_management}.
POST /v1/messages?beta=true Create a message with beta features · Create a Message #
Ask an LLM
“How do I call Claude with MCP servers connected directly in the request?”
“Can I set fallback models or an output format on a message using the beta endpoint?”
Tell an agent
With the beta flag, have {model} reply to {messages} in up to {max_tokens} tokens using MCP servers {mcp_servers}.
Send beta message {messages} to {model}, max {max_tokens} tokens, falling back to {fallbacks}.

Documentation

Specifications

Schemas & Data

Other Resources

🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/anthropic/refs/heads/main/json-ld/anthropic-context.jsonld
🔗
APIsJSON
https://raw.githubusercontent.com/api-evangelist/anthropic/refs/heads/main/apis.yml
🔗
Arazzo
https://raw.githubusercontent.com/api-evangelist/anthropic/refs/heads/main/arazzo/anthropic-batch-cancel-and-confirm-workflow.yml
🔗
Arazzo
https://raw.githubusercontent.com/api-evangelist/anthropic/refs/heads/main/arazzo/anthropic-batch-create-poll-results-workflow.yml
🔗
Arazzo
https://raw.githubusercontent.com/api-evangelist/anthropic/refs/heads/main/arazzo/anthropic-count-tokens-then-message-workflow.yml
🔗
Arazzo
https://raw.githubusercontent.com/api-evangelist/anthropic/refs/heads/main/arazzo/anthropic-create-workspace-and-add-member-workflow.yml
🔗
Arazzo
https://raw.githubusercontent.com/api-evangelist/anthropic/refs/heads/main/arazzo/anthropic-discover-model-and-message-workflow.yml
🔗
Arazzo
https://raw.githubusercontent.com/api-evangelist/anthropic/refs/heads/main/arazzo/anthropic-invite-org-member-and-confirm-workflow.yml
🔗
Arazzo
https://raw.githubusercontent.com/api-evangelist/anthropic/refs/heads/main/arazzo/anthropic-list-batches-and-fetch-latest-results-workflow.yml
🔗
Arazzo
https://raw.githubusercontent.com/api-evangelist/anthropic/refs/heads/main/arazzo/anthropic-onboard-member-to-workspace-workflow.yml
🔗
Arazzo
https://raw.githubusercontent.com/api-evangelist/anthropic/refs/heads/main/arazzo/anthropic-provision-and-promote-workspace-member-workflow.yml
🔗
Arazzo
https://raw.githubusercontent.com/api-evangelist/anthropic/refs/heads/main/arazzo/anthropic-upload-list-and-cleanup-file-workflow.yml
🔗
Arazzo
https://raw.githubusercontent.com/api-evangelist/anthropic/refs/heads/main/arazzo/anthropic-upload-verify-download-file-workflow.yml

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/anthropic-messages-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

anthropic-messages-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Anthropic Messages API
servers:
- url: https://api.anthropic.com
tags:


# --- truncated at 32 KB (624 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/anthropic/refs/heads/main/openapi/anthropic-messages-api-openapi.yml