๐ก HTTP Status Codes
Complete reference of HTTP status codes with descriptions, use cases, and examples. Search and filter by category.
Continue
1xxThe server has received the request headers and the client should proceed to send the request body.
Use case: Used when the client needs to send a large request body.
Switching Protocols
1xxThe server is switching protocols as requested by the client.
Use case: Used when upgrading from HTTP to WebSocket.
Processing
1xxThe server has received and is processing the request, but no response is available yet.
Use case: Used for long-running requests to prevent timeout.
Early Hints
1xxUsed to return some response headers before final HTTP message.
Use case: Allows browser to preload resources while server prepares response.
OK
2xxThe request has succeeded.
Use case: Standard response for successful HTTP requests.
Example: GET /api/users
Created
2xxThe request has been fulfilled and a new resource has been created.
Use case: Returned after successfully creating a resource.
Example: POST /api/users
Accepted
2xxThe request has been accepted for processing, but processing has not been completed.
Use case: Used for asynchronous processing.
Example: POST /api/jobs
No Content
2xxThe server successfully processed the request but is not returning any content.
Use case: Used for successful DELETE requests or updates that don't return data.
Example: DELETE /api/users/123
Partial Content
2xxThe server is delivering only part of the resource due to a range header sent by the client.
Use case: Used for partial content requests (e.g., video streaming).
Example: GET /api/video with Range header
Moved Permanently
3xxThe requested resource has been permanently moved to a new URL.
Use case: Use when a resource has permanently moved to a new location.
Example: Old URL redirects to new URL
Found
3xxThe requested resource has been temporarily moved to a different URL.
Use case: Temporary redirect, commonly used for login redirects.
Example: Redirect after login
Not Modified
3xxThe resource has not been modified since the last request.
Use case: Used with conditional GET requests to save bandwidth.
Example: GET with If-Modified-Since header
Temporary Redirect
3xxThe request should be repeated with another URL, but the method must not be changed.
Use case: Similar to 302 but preserves HTTP method.
Example: POST redirect preserving method
Permanent Redirect
3xxThe request and all future requests should be repeated using another URL.
Use case: Similar to 301 but preserves HTTP method.
Example: Permanent redirect preserving method
Bad Request
4xxThe server cannot process the request due to a client error (e.g., malformed syntax).
Use case: Return when request syntax is invalid or missing required parameters.
Example: Invalid JSON in request body
Unauthorized
4xxAuthentication is required and has failed or has not been provided.
Use case: Return when authentication is required or has failed.
Example: Missing or invalid API token
Forbidden
4xxThe server understood the request but refuses to authorize it.
Use case: Return when user is authenticated but lacks permission.
Example: User tries to access admin resource
Not Found
4xxThe requested resource could not be found on the server.
Use case: Return when the requested resource does not exist.
Example: GET /api/users/999 (user doesn't exist)
Method Not Allowed
4xxThe request method is not allowed for the requested resource.
Use case: Return when HTTP method is not supported for the endpoint.
Example: POST to GET-only endpoint
Not Acceptable
4xxThe server cannot produce a response matching the list of acceptable values.
Use case: Return when server cannot satisfy Accept header requirements.
Example: Client requests XML but server only has JSON
Conflict
4xxThe request could not be completed due to a conflict with the current state of the resource.
Use case: Return when there is a conflict (e.g., duplicate email).
Example: Creating user with existing email
Gone
4xxThe requested resource is no longer available and will not be available again.
Use case: Return when resource existed but is permanently removed.
Example: Deleted resource that won't be restored
Payload Too Large
4xxThe request entity is larger than limits defined by the server.
Use case: Return when request body exceeds size limit.
Example: File upload exceeds 10MB limit
URI Too Long
4xxThe URI provided was too long for the server to process.
Use case: Return when URL exceeds maximum length.
Example: GET request with extremely long query string
Unsupported Media Type
4xxThe media format of the requested data is not supported by the server.
Use case: Return when Content-Type is not supported.
Example: Sending XML when server expects JSON
Unprocessable Entity
4xxThe request was well-formed but contains semantic errors.
Use case: Return when validation fails (e.g., invalid email format).
Example: POST with invalid email address
Too Many Requests
4xxThe user has sent too many requests in a given amount of time (rate limiting).
Use case: Return when rate limit is exceeded.
Example: More than 100 requests per minute
Internal Server Error
5xxThe server encountered an unexpected condition that prevented it from fulfilling the request.
Use case: Return for unexpected server errors.
Example: Unhandled exception in server code
Not Implemented
5xxThe server does not support the functionality required to fulfill the request.
Use case: Return when server doesn't support the requested feature.
Example: Server doesn't support requested HTTP method
Bad Gateway
5xxThe server, while acting as a gateway or proxy, received an invalid response from an upstream server.
Use case: Return when gateway/proxy receives invalid response.
Example: API gateway receives error from backend
Service Unavailable
5xxThe server is currently unable to handle the request due to temporary overload or maintenance.
Use case: Return when service is temporarily unavailable.
Example: Server is down for maintenance
Gateway Timeout
5xxThe server, while acting as a gateway or proxy, did not receive a timely response from an upstream server.
Use case: Return when upstream server times out.
Example: Database query exceeds timeout
HTTP Version Not Supported
5xxThe server does not support the HTTP protocol version used in the request.
Use case: Return when HTTP version is not supported.
Example: Client uses HTTP/3 but server only supports HTTP/1.1
About HTTP Status Codes
HTTP status codes are three-digit numbers returned by a server to indicate the result of a request. They are grouped into five categories:
- 1xx Informational: Request received, continuing process
- 2xx Success: Request successfully received, understood, and accepted
- 3xx Redirection: Further action needs to be taken to complete the request
- 4xx Client Error: Request contains bad syntax or cannot be fulfilled
- 5xx Server Error: Server failed to fulfill a valid request