Messages API
Claude Messages API deep dive: request/response format, system prompts, multi-turn conversations, and best practices.
Last updated
After this section you can
- Build a Messages API request and say which fields are required and which were removed on current models
- Read a response by block type, act on every stop_reason and cost a call from its usage
- Handle errors with the SDK's typed exceptions and built-in retries, and choose a model for a workload
Messages API: Your First Claude Call
Every Claude integration, from a chatbot to a long-running agent, is built from one HTTP call. Learn what goes into it, what comes back, how it fails, and which model to put in the model field.
You send the whole conversation, Claude sends back one message. That message is a list of typed blocks plus a stop_reason telling your code what to do next, and a usage object telling you what it cost.