HTTP status codes cheat sheet

The status codes you will actually meet, what each means and when your API should send it. Meanings follow RFC 9110, the current HTTP standard.

checked 30 November 2026

2xx: Success

CodeNameMeaning and when to use it
200OKThe request worked. The body holds the result.
201CreatedA new resource was made. Send its URL in the Location header.
202AcceptedQueued for processing, not done yet. Good for background jobs.
204No ContentWorked, and there is nothing to send back. Common for DELETE.
206Partial ContentPart of a file, in answer to a Range request. Used for video and resumable downloads.

3xx: Redirection

CodeNameMeaning and when to use it
301Moved PermanentlyThe URL has changed for good. Search engines move ranking to the new URL. Browsers may turn a POST into a GET.
302FoundTemporary redirect. Browsers may also turn a POST into a GET.
303See OtherGo and GET this other URL. The classic response after a form POST.
304Not ModifiedThe cached copy is still good, so no body is sent. Answers If-None-Match or If-Modified-Since.
307Temporary RedirectLike 302, but the method and body must not change.
308Permanent RedirectLike 301, but the method and body must not change (RFC 9110).

4xx: Client errors

CodeNameMeaning and when to use it
400Bad RequestThe request is malformed: bad JSON, a missing field, a wrong type.
401UnauthorizedNot authenticated: no credentials, or bad ones. Send a WWW-Authenticate header.
403ForbiddenAuthenticated, but not allowed to do this. Logging in again will not help.
404Not FoundNothing at this URL. Also used to hide that a resource exists from someone not allowed to see it.
405Method Not AllowedThe URL exists but not for this method. List the allowed ones in the Allow header.
409ConflictClashes with the current state: a duplicate username, an edit to a stale version.
410GoneRemoved on purpose and not coming back. Search engines drop it faster than a 404.
413Content Too LargeThe upload is over the size limit (called Payload Too Large before RFC 9110).
415Unsupported Media TypeThe server does not accept this Content-Type.
422Unprocessable ContentWell-formed, but the values fail validation, such as an end date before the start date.
429Too Many RequestsRate limited (RFC 6585). Say when to retry with a Retry-After header.

5xx: Server errors

CodeNameMeaning and when to use it
500Internal Server ErrorSomething broke on the server. Log the detail; do not send a stack trace to the client.
501Not ImplementedThe server does not support this method at all.
502Bad GatewayA proxy or load balancer got a bad answer from the app behind it. Often the app crashed or is restarting.
503Service UnavailableOverloaded or down for maintenance. A Retry-After header helps clients and crawlers.
504Gateway TimeoutA proxy gave up waiting for the app behind it.

Codes people mix up

401 or 403?

401 means "who are you?": the client is not logged in or the token is bad. 403 means "I know who you are, and no": the user lacks permission.

400 or 422?

400 for a request the server cannot parse. 422 for one it parsed fine but whose values break a rule. Many APIs use 400 for both, which is also acceptable; pick one and be consistent.

301 or 308? 302 or 307?

For plain page redirects, 301 and 302 are fine. For API endpoints that receive POST or PUT, use 308 and 307 so the method and body survive the redirect.

404 or 410?

410 when you deleted something on purpose and want it out of search results. 404 for everything else.

Debugging an API response? Format the body with the JSON formatter, or read an auth token with the JWT decoder.