What are the main HTTP status code categories and key codes?
HTTP status codes are three-digit integers grouped into five classes by their leading digit. Understanding the distinction between classes, and the semantics of individual codes, is essential for building correct APIs and debugging client-server interactions.
**1xx Informational** codes indicate a provisional response. The most common is `101 Switching Protocols`, returned when a server agrees to upgrade to WebSocket.
**2xx Success** codes confirm the request was received, understood, and accepted. `200 OK` is the general success response for GET and POST. `201 Created` signals that the request resulted in a new resource; the `Location` header should point to it. `204 No Content` confirms success with no body—used for DELETE or PATCH when nothing needs to be returned. `206 Partial Content` is returned for range requests (e.g., video streaming).
**3xx Redirection** codes require the client to take additional action. `301 Moved Permanently` and `302 Found` are the classic redirects; browsers cache 301 permanently, making it hard to revert. `304 Not Modified` is returned on conditional GET when the cached copy is still fresh—it carries no body, saving bandwidth. `307` and `308` are the method-preserving equivalents of 302 and 301 respectively: the HTTP method must not change during the redirect.
**4xx Client Error** codes indicate the request was malformed or unauthorized. `400 Bad Request` is a generic parse/validation failure. `401 Unauthorized` means authentication is required or failed—despite the name, it is about authentication, not authorization. `403 Forbidden` means authenticated but not permitted. `404 Not Found` means the resource does not exist at that URI. `409 Conflict` signals a state conflict (e.g., duplicate resource). `422 Unprocessable Entity` is preferred for semantic validation failures in REST APIs. `429 Too Many Requests` signals rate limiting.
**5xx Server Error** codes indicate the server failed to fulfil a valid request. `500 Internal Server Error` is the generic catch-all. `502 Bad Gateway` means an upstream proxy received an invalid response. `503 Service Unavailable` means the server is temporarily overloaded or in maintenance—should include a `Retry-After` header. `504 Gateway Timeout` means the upstream did not respond in time.
| Class | Range | Meaning | Key Example | Client Action |
|---|---|---|---|---|
| 1xx | 100-199 | Informational / provisional | 101 Switching Protocols | Continue or upgrade |
| 2xx | 200-299 | Success | 200 OK, 201 Created | Process response body |
| 3xx | 300-399 | Redirection | 301 Moved, 304 Not Modified | Follow Location header |
| 4xx | 400-499 | Client error | 401, 403, 404, 429 | Fix request; don't auto-retry |
| 5xx | 500-599 | Server error | 500, 502, 503, 504 | Retry with backoff if safe |
Correctly names all five classes and gives two or more specific codes per class with accurate semantics.
Covers all classes, distinguishes 401 vs. 403, 301 vs. 307, and 502 vs. 503 vs. 504, and explains when to use 204 vs. 200.
Reading the answer is step one. Explaining it unprompted — under interview pressure — is what actually matters. Get AI-graded feedback on your answer with follow-up probes on your weak points.
Get Graded — Free Assessment