← REST API Development learning path
REST API Development · Module 3 of 10

Status codes

Tell clients what happened with the right HTTP status code.

📖 Key ideas

  1. 2xx success: 200 OK, 201 Created, 204 No Content.
  2. 3xx redirect: 301, 302, 304 Not Modified.
  3. 4xx client errors: 400, 401, 403, 404, 409, 422, 429.
  4. 5xx server errors: 500, 502, 503.
  5. Pair the code with a clear error body.
💡 Real-life example: Status codes are traffic lights: green (2xx) go, yellow (3xx) go elsewhere, red (4xx/5xx) stop.
201Resource created
401Not authenticated
403Authenticated but not allowed
429Too many requests