List of HTTP Status Codes Cheat Sheet
HTTP status codes are numerical values that are returned by a web server in response to a request made by a client. These codes indicate the status of the request and can provide information about what went wrong, if anything did. There are a variety of different codes that can be returned, but understanding the most common ones is essential for anyone working with or developing for the web.
Each code indicates a specific condition or result of a request. The developers are free to create and modify status codes as they see fit. But it can lead to a lot of confusion. So a list of common codes are maintained by IANA. You can find a list of all status codes here.
HTTP status codes are an important part of any API. They tell the client what happened and can help them troubleshoot any issues. There are a few status codes that are especially important for APIs. The purpose of status codes is to tell the client (which can be a browser, another web app, a mobile app etc) how the response should be processed.
HTTP Status Codes play an important role in HTTP communications by providing status information about the request and response messages. They also help web servers and browsers to communicate with each other. HTTP Status Codes are placed in the header of an HTTP response message, and they specify the result of the request.
For an example, the `401` status code means that the the server could not authorise the requester. The `200` status code means that the request was successful. The `500` status code means that the server encountered an error while processing the request. So if the server sends a `500` status code, usually it's a server error, and there's nothing you (or the Client) can do to fix it. But on the other hand, `401` status code means that the server requires authentication before it will allow the request to be processed. So you should attempt to authenticate the request again before sending it to the server.
HTTP Status Code Groups
While it's not practical to memorise all of the status codes, you must memorise all the status code groups.
Status Code Range | Group | What it Says |
---|---|---|
1xx | Informational | This class of status codes indicates a provisional response, intended to be displayed only while the user-agent is retrieving the resource, or waiting for a server's response. |
2xx | Success | This class of status codes indicates that the client's request was successfully received, understood, and accepted. |
3xx | Redirection | This class of status codes indicates that further action needs to be taken by the user agent in order to fulfill the request. The action required may be carried out by the client in the same request, or may be requested by the server in a subsequent request. |
4xx | Client Error | This class of status codes indicate that the client's request contains bad syntax or cannot be fulfilled. |
5xx | Server Error | This class of status codes indicates that a server error has occurred. The server may be unreachable or be in an internal overloaded state. |
List of All Common HTTP Status Codes
Status Code | Description |
---|---|
100 | Continue |
101 | Switching Protocols |
102 | Processing |
103 | Early Hints |
200 | OK |
201 | Created |
202 | Accepted |
203 | Non-Authoritative Information |
204 | No Content |
205 | Reset Content |
206 | Partial Content |
207 | Multi-Status |
208 | Already Reported |
226 | IM Used |
300 | Multiple Choices |
301 | Moved Permanently |
302 | Found |
303 | See Other |
304 | Not Modified |
305 | Use Proxy |
307 | Temporary Redirect |
308 | Permanent Redirect |
400 | Bad Request |
401 | Unauthorized |
402 | Payment Required |
403 | Forbidden |
404 | Not Found |
405 | Method Not Allowed |
406 | Not Acceptable |
407 | Proxy Authentication Required |
408 | Request Timeout |
409 | Conflict |
410 | Gone |
411 | Length Required |
412 | Precondition Failed |
413 | Content Too Large |
414 | URI Too Long |
415 | Unsupported Media Type |
416 | Range Not Satisfiable |
417 | Expectation Failed |
418 | I'm a teapot |
421 | Misdirected Request |
422 | Unprocessable Content |
423 | Locked |
424 | Failed Dependency |
425 | Too Early |
426 | Upgrade Required |
428 | Precondition Required |
429 | Too Many Requests |
431 | Request Header Fields Too Large |
451 | Unavailable For Legal Reasons |
500 | Internal Server Error |
501 | Not Implemented |
502 | Bad Gateway |
503 | Service Unavailable |
504 | Gateway Timeout |
505 | HTTP Version Not Supported |
506 | Variant Also Negotiates |
507 | Insufficient Storage |
508 | Loop Detected |
510 | Not Extended |
511 | Network Authentication Required |