Fix Claude API Missing Anthropic Version Header
Updated 9/8/2026
The Importance of the Anthropic-Version Header
Every direct API call to the Anthropic servers requires a specific header indicating the API version you want to target. This header is called anthropic-version. If this header is missing, malformed, or outdated, the Anthropic API returns a 400 Bad Request error with an error object explaining that the header is mandatory:
`json { "error": { "type": "invalid_request_error", "message": "anthropic-version: header is required" } } `
This error most frequently occurs when developers bypass the official SDKs to write raw HTTP integrations, or when using an outdated library version. Follow this guide to properly format and configure this header across your API requests.
Step 1: Add the Header to Raw HTTP Requests
If you are interacting with Claude through raw curl commands, custom Python requests modules, or Node fetch clients, you must explicitly pass the anthropic-version header in your request configuration.
As of the current API release, the accepted version identifier is 2023-06-01. Include this exact date string in your headers array alongside your API key and content-type declarations.
Example cURL implementation: `bash curl https://api.anthropic.com/v1/messages \ -H "x-api-key: YOUR_API_KEY" \ -H "anthropic-version: 2023-06-01" \ -H "content-type: application/json" \ -d '{ "model": "claude-3-5-sonnet-20241022", "max_tokens": 1024, "messages": [{"role": "user", "content": "Hello, Claude"}] }' `
Step 2: Use and Update Official SDKs
The easiest way to prevent version header errors is to use the official @anthropic-ai/sdk (TypeScript/JavaScript) or anthropic (Python) libraries. These SDKs automatically manage and inject the correct anthropic-version header behind the scenes.
If you are using an older version of the SDK, it may be sending an obsolete version header no longer supported by the API endpoint, resulting in validation failures. Update your dependencies to the latest release:
For Python: `bash pip install --upgrade anthropic `
For Node.js: `bash npm install @anthropic-ai/sdk@latest `
Once updated, restart your development server to clear cached builds or package locks.
Step 3: Handle Headers in Custom HTTP Clients
If your architecture requires custom API wrappers (for instance, using Axios in Node.js or the requests library in Python), ensure that your client configuration includes the custom header structure correctly.
Python custom requests setup: `python import requests
url = "https://api.anthropic.com/v1/messages" headers = { "x-api-key": "YOUR_API_KEY", "anthropic-version": "2023-06-01", "content-type": "application/json" } data = { "model": "claude-3-5-sonnet-20241022", "max_tokens": 100, "messages": [{"role": "user", "content": "Ping"}] }
response = requests.post(url, headers=headers, json=data) print(response.json()) `
Ensure that header names are completely lowercase if your proxy framework requires strict HTTP/2 protocol formatting, though standard HTTP engines will parse Anthropic-Version case-insensitively.
Step 4: Inspect Proxy and Gateway Stripping
In some enterprise environments, API requests pass through internal forward proxies, corporate firewalls, or custom API gateways (like AWS API Gateway or Kong). Some configurations strip out unrecognized or custom headers before routing the request outward.
- Check your gateway configuration to ensure custom headers containing hyphens (like anthropic-version and x-api-key) are allowed to pass through unimpeded.
- Run a network capture or log the outgoing headers directly from the edge server to verify that the header is still present when the request leaves your internal network.
When to Escalate
If you have explicitly set the anthropic-version: 2023-06-01 header, updated your official SDKs to the latest stable release, and verified that your environment is not stripping headers, but you still receive errors stating the version is invalid or missing, contact your organization's network administrator to trace outgoing HTTP packets. If the payload is reaching Anthropic intact, reach out to Anthropic Support with your code snippet, payload details, and the API request tracking ID.
Quick fixes
- Claude is down or not loading
- Claude Pro billing or payment problem
- Can't sign in to Claude