Status codes are a language
Learn to read what the server is saying with response codes
⏱ Est. ~5 min
01 · Read
Every HTTP response starts with a status code. It's the server's first sentence — before you even read the body.
Status codes are grouped by their first digit: - 2xx = success (no problem) - 4xx = client error (you did something wrong) - 5xx = server error (they did something wrong)
Know these and you can diagnose any API problem in seconds.
Key points
- 200 = OK — request succeeded, body contains data
- 401 = Unauthorized — you need to authenticate
- 403 = Forbidden — authenticated, but you don't have permission
- 404 = Not Found — that path doesn't exist
- 429 = Too Many Requests — you've been rate-limited
- 500 = Internal Server Error — their bug, not yours
02 · Terminal exercise
Let's intentionally trigger errors and look at the responses. Use -i to see the status line. First, request a path that doesn't exist.
(This section is interactive — please enable JavaScript.)
03 · Terminal exercise
Now trigger a 401 — a protected endpoint that requires authentication.
(This section is interactive — please enable JavaScript.)
04 · Terminal exercise
Now a 500 — this one is the server's problem, not yours.
(This section is interactive — please enable JavaScript.)
05 · Match
Match each HTTP status code to what it means.
(This section is interactive — please enable JavaScript.)
06 · Quiz
You call an API and get HTTP/2 429. What should you do?
- Fix your code — you sent a malformed request
- Check your API key — it's probably expired
- Wait and retry — you've been rate-limited
- The server is down — try a different endpoint
Other lessons in this chapter
⚠ The full interactive experience needs JavaScript. Please enable it and reload.
※ This is an independent Traditional Chinese teaching project — not an official Anthropic product. Claude™ is a trademark of Anthropic, PBC.