HTTP status codes
The list of all HTTP status codes, their name, and their meaning.
About HTTP status codes
A searchable reference of every standard HTTP status code, grouped into the five classes (1xx informational, 2xx success, 3xx redirection, 4xx client error, 5xx server error), with the official name and a short explanation of each.
When you would use it
- Looking up an unfamiliar code seen in a log, a browser's network panel or an API response.
- Choosing the right code to return from an API endpoint, for example 204 versus 200, or 401 versus 403.
- Refreshing the difference between similar codes such as 301, 302, 307 and 308.
How to use it
- Type a code, a name or a keyword in the search box; results update as you type and match approximately.
- Leave the search empty to browse all codes by class.
- Read the name and description of the code you need.
Things worth knowing
- The first digit tells the class: 2xx the request worked, 3xx look elsewhere, 4xx the client got something wrong, 5xx the server failed. Unknown codes should be handled by their class.
- 401 means not authenticated (no or invalid credentials), 403 means authenticated but not allowed. Picking the wrong one confuses clients and leaks information.
- 301 and 308 are permanent redirects, 302 and 307 temporary. 307 and 308 keep the request method and body, while browsers may turn a POST into a GET on 301 and 302.
- Some codes are specific to one protocol extension or are unofficial (such as 418 and 451); check that your framework and clients support a code before relying on it.
Frequently asked questions
- Which code should an API return when a resource is not found?
- 404 for a missing resource at a valid path, and 410 when it existed but was deliberately removed. Use 400 or 422 when the problem is the request body rather than the path.
- What is the difference between 500, 502, 503 and 504?
- 500 is a generic server error, 502 means a gateway received an invalid response from an upstream server, 503 means the service is temporarily unavailable or overloaded, and 504 means the upstream did not answer in time.