← REST API Development learning pathREST API Development · Module 3 of 10
Status codes
Tell clients what happened with the right HTTP status code.
📖 Key ideas
- 2xx success: 200 OK, 201 Created, 204 No Content.
- 3xx redirect: 301, 302, 304 Not Modified.
- 4xx client errors: 400, 401, 403, 404, 409, 422, 429.
- 5xx server errors: 500, 502, 503.
- 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