The Claude API is a RESTful API at https://api.anthropic.com that provides programmatic access to Claude models. The primary API is the Messages API (POST /v1/messages) for conversational interactions.
New to Claude? Start with Get started for prerequisites and your first API call, or see Working with Messages for request/response patterns and examples.
To use the Claude API, you'll need:
For step-by-step setup instructions, see Get started.
The Claude API includes the following APIs:
General Availability:
POST /v1/messages)POST /v1/messages/batches)POST /v1/messages/count_tokens)GET /v1/models)Beta:
POST /v1/files, GET /v1/files)POST /v1/skills, GET /v1/skills)For the complete API reference with all endpoints, parameters, and response schemas, explore the API reference pages listed in the navigation. To access beta features, see Beta headers.
All requests to the Claude API must include these headers:
| Header | Value | Required |
|---|---|---|
x-api-key | Your API key from Console | Yes |
anthropic-version | API version (e.g., 2023-06-01) | Yes |
content-type | application/json | Yes |
If you are using the Client SDKs, the SDK will send these headers automatically. For API versioning details, see API versions.
The API is made available via the web Console. You can use the Workbench to try out the API in the browser and then generate API keys in Account Settings. Use workspaces to segment your API keys and control spend by use case.
Anthropic provides official SDKs that simplify API integration by handling authentication, request formatting, error handling, and more.
Benefits:
Example (Python):
from anthropic import Anthropic
client = Anthropic() # Reads ANTHROPIC_API_KEY from environment
message = client.messages.create(
model="claude-sonnet-4-5",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello, Claude"}]
)For a list of client SDKs and their respective installation instructions, see Client SDKs.
Claude is available through Anthropic's direct API and through partner platforms. Choose based on your infrastructure, compliance requirements, and pricing preferences.
Access Claude through AWS, Google Cloud, or Microsoft Azure:
| Platform | Provider | Documentation |
|---|---|---|
| Amazon Bedrock | AWS | Claude on Amazon Bedrock |
| Vertex AI | Google Cloud | Claude on Vertex AI |
| Azure AI | Microsoft Azure | Claude on Azure AI |
For feature availability across platforms, see the Features overview.
The API has different maximum request sizes depending on the endpoint:
| Endpoint | Maximum Size |
|---|---|
| Standard endpoints (Messages, Token Counting) | 32 MB |
| Batch API | 256 MB |
| Files API | 500 MB |
If you exceed these limits, you'll receive a 413 request_too_large error.
The Claude API includes the following headers in every response:
request-id: A globally unique identifier for the requestanthropic-organization-id: The organization ID associated with the API key used in the requestThe API enforces rate limits and spend limits to prevent misuse and manage capacity. Limits are organized into usage tiers that increase automatically as you use the API. Each tier has:
You can view your organization's current limits in the Console. For higher limits or Priority Tier (enhanced service levels with committed spend), contact sales through the Console.
For detailed information about limits, tiers, and the token bucket algorithm used for rate limiting, see Rate limits.
The Claude API is available in many countries and regions worldwide. Check the supported regions page to confirm availability in your location.
Here's a minimal request using the Messages API:
curl https://api.anthropic.com/v1/messages \
--header "x-api-key: $ANTHROPIC_API_KEY" \
--header "anthropic-version: 2023-06-01" \
--header "content-type: application/json" \
--data '{
"model": "claude-sonnet-4-5",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "Hello, Claude"}
]
}'Response:
{
"id": "msg_01XFDUDYJgAACzvnptvVoYEL",
"type": "message",
"role": "assistant",
"content": [
{
"type": "text",
"text": "Hello! How can I assist you today?"
}
],
"model": "claude-sonnet-4-5",
"stop_reason": "end_turn",
"usage": {
"input_tokens": 12,
"output_tokens": 8
}
}For complete examples and tutorials, see Get started and Working with Messages.
Request/response patterns, multi-turn conversations, and best practices