HTTP Status Codes: Five Classes and Common Misuse

Open Tool HTTP Status Codes

The first digit sets the class

Status codes are three digits whose first digit names the class: informational, success, redirection, client error and server error. This page groups them that way and searches by number or reason phrase, so 404 or Not Found both land.

Steps

  1. Type a number or phrase into the search box.
  2. Or click a class filter across all five groups.
  3. Read each code's name, meaning and typical use.
  4. When debugging an API, identify the class first, then blame caller or server accordingly.

Codes most often misused

200 signals success, so returning errors under it forces clients to parse bodies and contradicts HTTP. 201 means created and belongs with a Location header. 204 means success with no body, fitting deletions. 301 is a cached permanent redirect — misuse strands traffic on old addresses — while 302 is temporary and uncached. 304 carries conditional caching meaning. And 400, 401 and 403 blur constantly: malformed request, unauthenticated, authenticated but forbidden.

404 versus 410

404 means absent, though many systems use it to hide insufficient permission. 410 says the resource is permanently gone, implying it once existed. 429 signals rate limiting and pairs with Retry-After. On the proxy path, 502 means an invalid upstream response, 503 unavailability and 504 a gateway timeout, so the question is which hop failed.

Common mistakes

Returning 200 for every error. Confusing 401 with 403, so clients never attempt login. Using 302 for permanent moves and paying an extra hop each visit. Reserving 500 as a catch-all when the server knows the request was malformed. Letting status and body disagree, such as 404 carrying a success shape. And ignoring cache semantics carried by 301 and 304.

Designing APIs around status:Status describes the protocol outcome while business errors live in the body, which keeps responsibilities clean. Batch operations return 200 with per-item results. Async work returns 202 with a polling location. Rate limits use 429 with timing. Validation failures use 422 naming the field. Logging status and duration supports error-rate statistics, and alerting thresholds belong on 5xx, since 4xx is usually the caller's fault.

⏫︎