A beta version of this method exists and may have additional functionality.
View the beta version
.
API reference

Messages
Create a Message

POST
/v1/messages
Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation.
The Messages API can be used for either single queries or stateless multi-turn conversations.
Learn more about the Messages API in our
user guide
Headers
"anthropic-user-profile-id"
:
optional
string

The user profile ID to attribute this request to. Use when acting on behalf of a party other than your organization. Requires the
user-profiles
beta header.

"anthropic-workspace-id"
:
optional
string

Optional header to select the Workspace for this request.

minimum
0
maximum
1
Returns

Message
object
{
type
:
"message"
,
id
,
container
,
8
more
}


RawMessageStreamEvent
=
RawMessageStartEvent
or
RawMessageDeltaEvent
or
RawMessageStopEvent
or
3
more

One of the following:

Create a Message
cURL


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
"
\
--max-time
600
\
-d
'{
"max_tokens": 1024,
"messages": [
{
"content": "Hello, world",
"role": "user"
}
],
"model": "claude-opus-5",
"stream": false,
"system": [
{
"text": "Today'
\'
's date is 2024-06-01.",
"type": "text"
}
],
"temperature": 1,
"thinking": {
"type": "adaptive"
},
"tools": [
{
"input_schema": {
"type": "object",
"properties": {
"location": "bar",
"unit": "bar"
},
