All insights

Model APIs

Anthropic API Endpoint: URL, Method, and First Request

The direct Anthropic Messages API endpoint is POST https://api.anthropic.com/v1/messages. See the required authentication and version headers, a minimal curl request, and how direct API access differs from gateways and cloud-provider routes.

Illustration for Anthropic api endpoint

Direct answer: Anthropic API endpoint

For a direct request to Claude’s Messages API, send an HTTP POST to:

https://api.anthropic.com/v1/messages

The base URL is https://api.anthropic.com; the endpoint path is /v1/messages. Anthropic’s API overview identifies this host and method for Messages requests. (platform.claude.com)

This is the direct Anthropic API route—not a URL for Claude Code, an organization’s LLM gateway, or a cloud provider’s API. Those routes may use different hosts, credentials, and configuration. (code.claude.com)

Make a first request

You need a Claude Console account and an API key, or another supported authentication method. Anthropic’s Console supports API-key creation and billing setup; API access is subject to its Commercial Terms of Service. (platform.claude.com)

For direct HTTP requests, Anthropic currently documents API keys as bearer tokens in the Authorization header. Requests also need an anthropic-version header. The versioning documentation says to use the latest API version where possible; the current reference identifies 2026-10-21. (platform.claude.com)

Set your key in an environment variable, then run this example:

export ANTHROPIC_API_KEY="your-api-key"

curl https://api.anthropic.com/v1/messages \
  -H "Authorization: Bearer $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2026-10-21" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-opus-5-5",
    "max_tokens": 256,
    "messages": [
      {"role": "user", "content": "Hello, Claude"}
    ]
  }'

The request uses the Messages API’s required model, max_tokens, and messages fields. The model name appears in Anthropic’s current Messages API guide; use a model available to your account, and consult the Models API if you need to list available models. (platform.claude.com)

A successful response is a message object with assistant content; for a plain-text reply, look for a text block in content. Anthropic’s guide shows this response shape. (platform.claude.com)

Production note: keep the API key out of browser code and source control, store it in your server’s secret-management system, and pin or review API-version changes through your normal testing process. Never commit the example key placeholder as a real credential.

Direct API versus Claude Code, gateways, and cloud providers

The URL above applies when your application calls Anthropic’s API directly. Claude Code configured to use an organizational gateway is a separate setup: the client points to the gateway’s base URL and uses credentials supplied for that gateway. Current Claude Code documentation describes gateway compatibility and supported API formats; do not assume the direct Anthropic host or direct-API credentials apply unchanged. (code.claude.com)

Likewise, calling Claude through a cloud provider uses that provider’s endpoint and authentication. For example, Amazon Bedrock documents its own Messages API endpoints and AWS-specific authentication options. Follow the provider’s integration guide rather than substituting the direct Anthropic URL. (docs.aws.amazon.com)

Sources

API overview — Claude Platform Docs

Create a Message — Claude API Reference

Versions — Claude Platform Docs

Authentication — Claude Platform Docs

Using the Messages API — Claude Platform Docs

How can I access the Claude API? — Claude Help Center

Connect Claude Code to an LLM gateway — Claude Code Docs

Claude Code gateway compatibility guide

Inference using Anthropic Messages API — Amazon Bedrock

Contact us