·7 min read
HTTP Status Codes: Complete Reference
HTTP status codes are three-digit numbers returned by servers to indicate the result of a request. Understanding them is essential for debugging APIs and web applications.
1xx — Informational
- 100 Continue — Server received headers, client should send body
- 101 Switching Protocols — Server is switching protocols (e.g., WebSocket upgrade)
- 102 Processing — Request is being processed (WebDAV)
2xx — Success
- 200 OK — Standard success response
- 201 Created — Resource created (POST requests)
- 202 Accepted — Request accepted for processing
- 204 No Content — Success, no response body (DELETE requests)
- 206 Partial Content — Range request fulfilled
3xx — Redirection
- 301 Moved Permanently — Resource permanently moved to new URL
- 302 Found — Temporary redirect
- 304 Not Modified — Cached version is still valid
- 307 Temporary Redirect — Temporary redirect, method preserved
- 308 Permanent Redirect — Permanent redirect, method preserved
4xx — Client Errors
- 400 Bad Request — Invalid syntax or parameters
- 401 Unauthorized — Authentication required
- 403 Forbidden — Server refuses to authorize
- 404 Not Found — Resource does not exist
- 405 Method Not Allowed — HTTP method not supported for this endpoint
- 408 Request Timeout — Server timed out waiting for request
- 409 Conflict — Conflict with current state (e.g., duplicate resource)
- 413 Payload Too Large — Request body exceeds server limit
- 422 Unprocessable Entity — Valid syntax but semantic errors
- 429 Too Many Requests — Rate limit exceeded
5xx — Server Errors
- 500 Internal Server Error — Generic server error
- 501 Not Implemented — Method not supported by server
- 502 Bad Gateway — Invalid response from upstream server
- 503 Service Unavailable — Server temporarily overloaded or down
- 504 Gateway Timeout — Upserver timed out
Most Common in APIs
GET /users/1 → 200 OK POST /users → 201 Created PUT /users/1 → 200 OK DELETE /users/1 → 204 No Content GET /users/999 → 404 Not Found POST /users → 422 (invalid data) GET /users → 429 (rate limited)
Tips for Developers
- Use 201 for successful resource creation, not 200
- Use 204 for successful deletes with no response body
- Use 422 for validation errors, 400 for malformed requests
- Use 401 for missing auth, 403 for insufficient permissions
- Always return meaningful error messages with 4xx/5xx codes