HTTP Status Codes Reference
What are HTTP Status Codes?
HTTP status codes are three-digit numbers returned by a web server in response to every HTTP request. They tell the client whether the request succeeded, failed, or needs further action. The first digit indicates the category: 1xx informational, 2xx success, 3xx redirect, 4xx client error, 5xx server error.
Status codes are the universal language between clients and servers. Returning the right code matters for API consumers, monitoring systems, caching layers, load balancers, and SEO crawlers — all of which interpret these codes automatically.
Most commonly encountered: 200 OK, 201 Created, 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found, 422 Unprocessable Entity, 429 Too Many Requests, and 500 Internal Server Error.
1xx — Informational
| Code | Name | Common Use |
|---|---|---|
| 100 | Continue | Client should send request body |
| 101 | Switching Protocols | WebSocket upgrade handshake |
| 102 | Processing | Server processing long operation (WebDAV) |
2xx — Success
| Code | Name | JSON API Use |
|---|---|---|
| 200 | OK | GET, PUT, PATCH success with response body |
| 201 | Created | POST creates a resource — include Location header |
| 202 | Accepted | Async job queued — body contains job ID |
| 204 | No Content | DELETE success — no response body |
| 206 | Partial Content | Range requests, file streaming |
3xx — Redirection
| Code | Name | Use |
|---|---|---|
| 301 | Moved Permanently | Resource permanently relocated — update links |
| 302 | Found | Temporary redirect (POST becomes GET) |
| 303 | See Other | POST/PUT → redirect to result via GET |
| 304 | Not Modified | Client cache is fresh — skip response body |
| 307 | Temporary Redirect | Same method preserved on redirect |
| 308 | Permanent Redirect | Same method preserved, permanent |
4xx — Client Errors
| Code | Name | JSON API Use |
|---|---|---|
| 400 | Bad Request | Invalid JSON, missing required fields, validation errors |
| 401 | Unauthorized | Missing or invalid auth token |
| 403 | Forbidden | Valid token but insufficient permissions |
| 404 | Not Found | Resource doesn't exist |
| 405 | Method Not Allowed | POST to a GET-only endpoint |
| 409 | Conflict | Duplicate resource, version conflict |
| 410 | Gone | Resource permanently deleted |
| 413 | Content Too Large | Request body exceeds size limit |
| 415 | Unsupported Media Type | Content-Type is not application/json |
| 422 | Unprocessable Entity | Valid JSON but fails business validation |
| 429 | Too Many Requests | Rate limit exceeded — include Retry-After header |
5xx — Server Errors
| Code | Name | JSON API Use |
|---|---|---|
| 500 | Internal Server Error | Unhandled exception — log and return generic message |
| 501 | Not Implemented | Endpoint defined but not built yet |
| 502 | Bad Gateway | Upstream service returned invalid response |
| 503 | Service Unavailable | Server overloaded or in maintenance |
| 504 | Gateway Timeout | Upstream service timed out |
REST API Status Code Guide
| HTTP Method | Success Code | Not Found | Validation Error |
|---|---|---|---|
| GET /resources | 200 OK | 404 Not Found | 400 Bad Request |
| GET /resources/:id | 200 OK | 404 Not Found | — |
| POST /resources | 201 Created | — | 400 / 422 |
| PUT /resources/:id | 200 OK | 404 Not Found | 400 / 422 |
| PATCH /resources/:id | 200 OK | 404 Not Found | 400 / 422 |
| DELETE /resources/:id | 204 No Content | 404 Not Found | — |