HTTP status codes
Every registered HTTP status code, what it means, when you see it and where it is defined.
Select a code
What are HTTP status codes?
Every HTTP response starts with a three-digit status code that says what happened to the request. The first digit gives the class: 1xx is informational, 2xx means success, 3xx means redirection, 4xx means the request was wrong and 5xx means the server failed.
The codes are defined in RFC 9110, HTTP Semantics, which replaced RFC 7231 in 2022, and in a few other RFCs such as RFC 6585 for 429 Too Many Requests. IANA keeps the official registry. RFC 9110 renamed two codes: 413 is now Content Too Large (formerly Payload Too Large) and 422 is Unprocessable Content (formerly Unprocessable Entity). The numbers and their behavior didn't change.
Some codes you meet aren't in the registry. nginx logs 499 when a client closes the connection before the response is ready, Cloudflare sends 520 to 526 when it can't get a usable response from the origin server, and Laravel sends 419 when a form's CSRF token has expired. They are listed separately, marked unofficial.
The status code is the first thing an API test should check, because the rest of the response depends on it. A 201 Created tells you a POST made a new resource, a 404 that the resource doesn't exist, and a 500 that the server failed, in which case the body may be an error page instead of the JSON you expected.
How to use this tool
- 1Browse the list, grouped from 1xx to 5xx with unofficial codes at the end, or filter it with the class buttons.
- 2Search by number, name or symptom, such as
404,5xx,redirect,timeoutor a former name likeUnprocessable Entity. Press / to jump to the search box from anywhere on the page. - 3Select a code, or move through the list with the arrow keys, to see what it means, when you'd see it, the specification that defines it and related codes to compare it with.
- 4Copy the
curlcommand under Try it to make the testingapis.com status endpoint return that code, or copy a link:/tools/http-status/#429opens 429 directly.
Troubleshooting
- A 401 even though you sent a token
- The token is expired, malformed, sent in the wrong header, or missing its
Bearerprefix. TheWWW-Authenticateresponse header often says which. A 403 instead means the token is valid but lacks permission. - A 415 for a JSON body
- The request has no
Content-Type: application/jsonheader, so the server doesn't treat the body as JSON. curl's-dsendsapplication/x-www-form-urlencodedunless you set the header. - A POST turns into a GET after a redirect
- Clients follow 301 and 302 by repeating the request as a GET without the body. Servers that must keep the method should send 307 or 308.
- A 502 or 504 from a load balancer
- The proxy in front of the application got no valid answer: 502 when the application crashed or closed the connection, 504 when it took longer than the proxy's timeout. The application's own logs show the cause.
- 499 in nginx logs
- The client gave up before the response was ready: a user navigated away, or a client or upstream proxy timed out. Slow backend requests are the usual cause.
Frequently asked questions
What is the difference between 401 and 403?
401 Unauthorized means the server doesn't know who you are: credentials are missing, expired or wrong. 403 Forbidden means it knows who you are, but that identity isn't allowed to do this. Logging in again can fix a 401, not a 403.
Should an API return 400 or 422 for invalid input?
Both are used. A common convention is 400 for a request the server can't read at all, such as malformed JSON, and 422 for well-formed data that breaks a rule, such as a missing required field or an invalid email.
What is the difference between 502, 503 and 504?
All three usually come from a proxy or load balancer in front of the application. 502 Bad Gateway means it got an invalid response from the server behind it, 503 Service Unavailable means the service is overloaded or down for maintenance, and 504 Gateway Timeout means the server behind it didn't answer in time.
Which redirect code should I use?
301 and 308 are permanent, 302 and 307 temporary. 307 and 308 require the client to repeat the request with the same method and body, while clients usually turn a POST into a GET after a 301 or 302. Use 303 See Other to send a client to a results page after a POST.
Is 418 I'm a teapot a real status code?
It comes from RFC 2324, an April Fools' joke from 1998 about controlling coffee pots. RFC 9110 lists 418 as unused but reserved, because so much software already recognizes it. It isn't meant for real errors.
How can I test how my app handles a specific status code?
Call an endpoint that returns the code you ask for. GET https://api.testingapis.com/api/status/503 responds with a 503 and the headers that status normally carries, such as Retry-After. Any code from 200 to 599 works.