Send a Message
Endpoints
Send a Message
Send a structured message to Claude and receive a response.
POST
Send a Message
Overview
The/v1/messages endpoint is the core of the Claude API. Every interaction — basic messages, multi-turn conversations, streaming responses, and tool use — goes through this single endpoint.
Required Headers
Every request requires these three headers:The
anthropic-version header pins your integration to a specific API contract. 2023-06-01 is the current stable version. Always include it — requests without it return a 400 error.Stop Reasons
Always checkstop_reason before processing Claude’s output — a 200 OK does not guarantee a complete response:
Error Reference
All errors follow the same structure:Every error response includes a
request_id field. If you contact Anthropic support about a failed request, this ID is what their team needs to investigate.Further Reading
Messages
Understand the messages array and multi-turn context
Tokens
How tokens are counted and how they affect cost
System Prompts
Shape Claude’s behavior with system-level instructions
Tool Use
Connect Claude to real-time data and external services
Authorizations
Headers
Example:
"2023-06-01"
Body
application/json
Response
Successful response
Example:
"msg_01XFDUDYJgAACzvnptvVoYEL"
Example:
"message"
Example:
"assistant"
Example:
"claude-sonnet-4-6"
Available options:
end_turn, max_tokens, stop_sequence, tool_use Example:
"end_turn"