Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Set your API key
Export your API key as an environment variable. The cURL command below reads it from $ANTHROPIC_API_KEY.
export ANTHROPIC_API_KEY="your-api-key-here"Make your first API call
Send a POST request to the Messages API:
curl https://api.anthropic.com/v1/messages \
-H "content-type: application/json" \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "claude-opus-4-8",
"max_tokens": 1000,
"messages": [
{
"role": "user",
"content": "What should I search for to find the latest developments in renewable energy?"
}
]
}'Claude returns a JSON response containing the assistant's message:
{
"id": "msg_013mHbppMPd2PrVJzGMZPt2D",
"type": "message",
"role": "assistant",
"model": "claude-opus-4-8",
"content": [
{
"type": "text",
"text": "Here are some effective search strategies to find the latest developments in renewable energy:\n\n## General Search Terms\n- \"Renewable energy news 2025\"\n- ..."
}
],
"stop_reason": "end_turn",
"usage": {
"input_tokens": 21,
"output_tokens": 305
}
}You made your first API call. Next, learn the Messages API patterns you'll use in every Claude integration.
Learn multi-turn conversations, system prompts, stop reasons, and other core patterns.
Once you're comfortable with the basics, explore further:
Compare Claude models by capability and cost.
Browse all Claude capabilities: tools, context management, structured outputs, and more.
Reference documentation for Python, TypeScript, C#, and other client libraries.
Was this page helpful?