All five classes, searchable — what each code means and where to start debugging.
| Range | Meaning | Who should act |
|---|---|---|
| 1xx | Informational — the request was received, keep going | Nobody; the exchange continues |
| 2xx | Success | Nobody |
| 3xx | Redirection — the resource is elsewhere | Client follows automatically |
| 4xx | Client error — the request itself is wrong | The caller must change something |
| 5xx | Server error — the request was fine, the server failed | The operator must fix something |
The 4xx versus 5xx split is the most useful distinction in practice. It tells you instantly whether to look at your own code or at the service you are calling.
| Code | Name | When you will see it |
|---|---|---|
| 200 | OK | The ordinary success case |
| 301 | Moved Permanently | A permanent URL change; search engines transfer ranking |
| 302 / 307 | Found / Temporary Redirect | Temporary routing; 307 preserves the HTTP method |
| 304 | Not Modified | Conditional request hit the cache |
| 400 | Bad Request | Malformed syntax or failed validation |
| 401 / 403 | Unauthenticated / Forbidden | Not logged in, versus logged in but not allowed |
| 404 | Not Found | The resource does not exist, or is hidden behind a 404 on purpose |
| 429 | Too Many Requests | Rate limiting — back off and retry with a delay |
| 500 | Internal Server Error | An unhandled exception on the server |
| 502 / 503 | Bad Gateway / Unavailable | An upstream is broken or deliberately down for maintenance |
A 301 is a permanent move: browsers cache it aggressively and search engines consolidate the old URL into the new one. A 302 is temporary and does not transfer ranking. Using a 302 for a permanent restructure, or a 301 for a temporary experiment, is a classic and expensive mix-up. If the redirect is expected to become permanent, use 301.
The same code can mean different things. A 404 is a bug on your own site and a normal signal from a well-behaved API that asked for a record that does not exist. A 403 from a scraper usually means detection, not a permission problem. Always pair the code with the endpoint and the payload before drawing conclusions.
401 is named "Unauthorized" but what it actually means is unauthenticated: the server does not know who you are. 403 means it does know, and you still may not proceed. Getting this backwards changes client behaviour — a 401 tells the caller to retry with credentials that will never help, while a 403 hides the fact that logging in would fix the problem.
The headers settle it. A 401 should carry WWW-Authenticate naming the expected scheme; a 403 must not, because fresh credentials would not change the outcome.
An API that answers 200 OK with {"success": false, "error": "not found"} breaks three things at once: caches store the failure as a success, dashboards count it as healthy traffic, and client retry logic has nothing to trigger on. Let the status code describe the outcome and the body describe the detail.
The legitimate exception is a batch endpoint where individual items fail while the request as a whole succeeded — there a 200 with per-item results is correct, provided the response says so explicitly rather than leaving the caller to guess.