Your first Claude API call
What you’ll learn
Section titled “What you’ll learn”The Track 22 opener. The single capability this lesson builds: make a working Claude API call from your own code and read the structured response confidently. Concretely, you will know the one endpoint (https://api.anthropic.com/v1/messages), the three required headers and three required body fields, the shape of the response object (id, content as an array of blocks, stop_reason, usage), how multi-turn conversations work (the API is stateless, your code sends the full conversation history with every call), where standing instructions belong (the system parameter, separate from the messages list), and the five common pitfalls that catch most first-time callers. The lesson stays on the smallest possible primitive; every later lesson in Track 22 (eleven more across four phases) is a more interesting variation on what this lesson establishes.
This is the structural mirror of the opening sections of Anthropic Academy’s “Building with the Claude API” course at anthropic.skilljar.com, with every substantive claim verified against the public Anthropic Claude documentation at platform.claude.com/docs/en/get-started.
Where this fits
Section titled “Where this fits”This is lesson 1 of 12 of Track 22, the first lesson of Phase 1 (foundations), and the track opener. It is the smallest possible primitive: one endpoint, one request shape, one response shape, one multi-turn pattern. Lesson 2 extends it (streaming, batches, error handling); lesson 3 extends the model-selection side (Opus / Sonnet / Haiku, extended thinking, the effort dial). Together they are Phase 1; the foundation every Phase 2, 3, and 4 lesson extends.
The cross-track companion is Track 21 (LLM Ops and Production), which covers the provider-agnostic shipping discipline T22 cross-references in lesson 8 (the agent loop) and lesson 12 (the production move).
Before you start
Section titled “Before you start”Prerequisites: none in Track 22 (this is the track opener). Soft recommended prior: you have used Claude (or another LLM) through a chat interface at least once and have a vague sense of what one is. Some HTTP / JSON / Python or TypeScript comfort helps; you do not need a deep developer background to follow the lesson, but the try-it-yourself exercise in the practice artifact assumes you can run a Python script or a cURL command.
Optional setup before reading: create a free Anthropic Console account at platform.claude.com and an API key at platform.claude.com/settings/keys. The lesson works without; the try-it-yourself exercise is more concrete with one in hand. Cost for the lesson’s exercise is a fraction of a cent.
About the math
Section titled “About the math”None. The lesson is conceptual + practical: an HTTP request, a response object, a conversation pattern, a sidecar parameter. No derivations, no arithmetic beyond token-cost framing (which lesson 12 picks up properly).
By the end, you’ll be able to
Section titled “By the end, you’ll be able to”The single capability this lesson builds: make a working Claude API call from your own code and read the structured response confidently (the lesson’s first-end-state capability, per the Phase 0 lesson 1 capability mapping). Concretely, you will be able to:
- Build a working Claude API call from local code in cURL or Python
- Read the structured response (id, content array of blocks, stop_reason, usage) and dispatch on each field
- Hold a multi-turn conversation by sending the full message history on every call (the API is stateless)
- Place standing instructions in the system parameter, not in the messages list
- Name and recognize the five common pitfalls of a first API call
Time and difficulty
Section titled “Time and difficulty”- Read time: about 12 minutes
- Practice time: about 15 minutes (the try-it-yourself runs three concrete API calls, plus flashcards for retrieval)
- Difficulty: standard (no math; the work is making the calls and understanding the shape. The lesson is the easiest in Track 22; later lessons build on it.)