HTTP Status Codes Demystified
Understand request success, errors, and redirection patterns through standardized HTTP status codes.
1. Status Code Categories
1xx - Informational
Request received, continuing process.
2xx - Success
Request completed successfully.
3xx - Redirection
Further action required to complete request.
4xx - Client Error
Malformed request syntax or unresolvable semantics.
5xx - Server Error
Server failed to fulfill valid request.
2. Common Status Codes
Code | Phrase | Context |
---|---|---|
200 | OK | Successful request |
400 | Bad Request | Malformed request syntax |
401 | Unauthorized | Missing/invalid credentials |
403 | Forbidden | Valid auth, but no perms |
404 | Not Found | No resource exists |
500 | Internal Server Error | Unexpected server condition |
3. Status Code Examples
Success
HTTP/1.1 201 Created
Location: /new-resource/abc123
Content-Type: application/json
{ "id": "abc123", "status": "active" }
Error
HTTP/1.1 409 Conflict
Content-Type: application/problem+json
{
"error": "InvalidOperation",
"message": "Duplicate resource ID"
}
4. Response Lifecycle
Status Flow
Request
→ 200 OK
Client-Server Interaction
Client sends:
GET /data
Server responds:
304 Not Modified
Client retries:
GET /data@if-modified-since
Server delivers:
200 OK
with content