HTTP status codes
Searchable reference for all HTTP status codes from 1xx informational to 5xx server errors
HTTP Status Codes
Reference for all standard HTTP status codes
1xx Informational
Continue
The server has received the request headers and the client should proceed to send the request body.
Switching Protocols
The requester has asked the server to switch protocols and the server has agreed to do so.
Processing
The server has received and is processing the request, but no response is available yet.
2xx Success
OK
The request has succeeded.
Created
The request has succeeded and a new resource has been created.
Accepted
The request has been received but not yet acted upon.
No Content
There is no content to send for this request.
Partial Content
The server is delivering only part of the resource due to a range header sent by the client.
3xx Redirection
Moved Permanently
The URL of the requested resource has been changed permanently.
Found
The URI of requested resource has been changed temporarily.
Not Modified
The response has not been modified, client can use cached version.
Temporary Redirect
The request should be repeated with another URI, method unchanged.
Permanent Redirect
The resource is now permanently located at another URI, method unchanged.
4xx Client Errors
Bad Request
The server cannot or will not process the request due to a client error.
Unauthorized
Authentication is required and has failed or has not yet been provided.
Forbidden
The client does not have access rights to the content.
Not Found
The server cannot find the requested resource.
Method Not Allowed
The request method is known by the server but not supported by the target resource.
Request Timeout
The server would like to shut down this unused connection.
Conflict
The request conflicts with the current state of the server.
Gone
The requested content has been permanently deleted from the server.
Content Too Large
Request entity is larger than limits defined by server.
Unsupported Media Type
The media format of the requested data is not supported by the server.
Unprocessable Content
The request was well-formed but could not be followed due to semantic errors.
Too Many Requests
The user has sent too many requests in a given amount of time.
5xx Server Errors
Internal Server Error
The server has encountered a situation it does not know how to handle.
Not Implemented
The request method is not supported by the server and cannot be handled.
Bad Gateway
The server, while acting as a gateway, received an invalid response.
Service Unavailable
The server is not ready to handle the request.
Gateway Timeout
The server is acting as a gateway and cannot get a response in time.
HTTP Version Not Supported
The HTTP version used in the request is not supported by the server.
TL;DR
What is HTTP status codes?
HTTP status codes are three-digit numbers returned by a server in response to a client request. They are grouped into five classes: 1xx (informational), 2xx (success), 3xx (redirection), 4xx (client errors), and 5xx (server errors). They are defined in RFC 9110 (HTTP Semantics).
Common use cases
- ‣API development: choose the correct status code to return for each response scenario (201 Created vs 200 OK, 400 vs 422)
- ‣Debugging: look up an unfamiliar code returned by a third-party API or CDN
- ‣Error handling: implement client-side retry logic based on specific codes (retry on 503, not on 400)
Frequently asked questions
What is the difference between 401 and 403?
401 Unauthorized means the request lacks valid authentication credentials: the client has not logged in or the token is invalid/expired. 403 Forbidden means the server understood the request and the client is authenticated, but does not have permission to access the resource.
When should I use 422 instead of 400?
400 Bad Request indicates the request is syntactically malformed (unparseable JSON, missing required headers). 422 Unprocessable Entity indicates the request is syntactically valid but semantically incorrect (valid JSON but failing business validation rules). Many REST APIs use 400 for both; 422 is more precise.
What does 418 mean?
418 I'm a Teapot is defined in RFC 2324 (the Hyper Text Coffee Pot Control Protocol), an April Fools' RFC from 1998. A server can return 418 when asked to brew coffee with a teapot. It is not intended for serious use but has been preserved in HTTP specifications as a joke.
See also
- ‣URL parser: parse a request URL to isolate the path and query parameters when diagnosing the cause of a 4xx or 5xx response
- ‣URL encoder: properly percent-encode query parameters to avoid 400 Bad Request errors caused by unescaped special characters