Rendered Source Note

Anthropic Messages API Reference

Generated HTML view. Markdown remains canonical.

Anthropic Messages API Reference

Type: official-doc Tier: 1 (Official Doc) Author(s): Anthropic Date: Accessed 2026-06-01 (API version 2023-06-01) URL: https://platform.claude.com/docs/en/api/messages (redirected from https://docs.anthropic.com/en/api/messages) Accessed: 2026-06-01

Why This Source Matters

This is the definitive specification for how an application talks to a Claude model. Every chatbot, RAG system, and agent built on Claude issues POST /v1/messages requests under the hood. It establishes the request/response contract, the stateless multi-turn model, and the token-accounting fields that drive cost. For Project 1, this is the primary truth layer.

Key Claims

Endpoint

Request — required fields

Request — common optional fields

The stateless multi-turn model (CENTRAL CONCEPT for Project 1)

Response structure

{
  "id": "msg_013Zva2CMHLNnXjNJJKqJ2EF",
  "type": "message",
  "role": "assistant",
  "content": [{"type": "text", "text": "The capital of France is Paris."}],
  "model": "claude-opus-4-8",
  "stop_reason": "end_turn",
  "stop_sequence": null,
  "usage": {
    "input_tokens": 25,
    "output_tokens": 12,
    "cache_creation_input_tokens": 0,
    "cache_read_input_tokens": 0
  }
}

Stop reasons

Token accounting

Example request

curl https://api.anthropic.com/v1/messages \
  -H 'Content-Type: application/json' \
  -H 'anthropic-version: 2023-06-01' \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -d '{
    "model": "claude-opus-4-8",
    "max_tokens": 1024,
    "system": "You are a helpful assistant.",
    "messages": [
      {"role": "user", "content": "What is the capital of France?"}
    ],
    "temperature": 0.7
  }'

Relevant To

Notes