Status Code Classes
Every HTTP response carries a three digit status code whose first digit names the class.
- 1xx informational, such as one hundred Continue.
- 2xx success, such as two hundred OK and two hundred one Created.
- 3xx redirection, such as three hundred one Moved Permanently and three hundred four Not Modified.
- 4xx client error, such as four hundred Bad Request and four hundred four Not Found.
- 5xx server error, such as five hundred Internal Server Error and five hundred three Service Unavailable.
Codes You Will See Often
- Two hundred OK confirms a successful read.
- Two hundred one Created signals a resource was made, usually after POST.
- Three hundred four Not Modified lets a client reuse a cached copy.
- Four hundred one Unauthorized means authentication is missing or invalid.
- Four hundred three Forbidden means you are authenticated but lack permission.
- Four hundred four Not Found means the resource does not exist.
- Five hundred Internal Server Error is an unhandled server fault.
Why Classes Matter
Clients and proxies branch on the class. A four hundred class error is the caller's fault and should not be blindly retried, while many five hundred class errors are transient and worth retrying with backoff.
Key idea
The first digit of a status code tells you whether to celebrate, follow a redirect, fix your request, or retry the server.