Status Code Classes

Status codes are grouped into five classes by their first digit:

1xx — InformationalRequest received, processing continues
2xx — SuccessRequest received, understood, and accepted
3xx — RedirectionFurther action needed to complete the request
4xx — Client ErrorThe request contains bad syntax or cannot be fulfilled
5xx — Server ErrorThe server failed to fulfil a valid request

2xx — Success Codes

2xx Success
200 OKStandard success responseGET, PUT, PATCH responses with body
201 CreatedResource successfully createdPOST that creates a new resource; include Location header
202 AcceptedRequest accepted but not yet processedAsync operations — task queued, processing later
204 No ContentSuccess, no response bodyDELETE, or PUT/PATCH with no body returned
206 Partial ContentPartial range of resource returnedVideo streaming, file download resume (Range header)

3xx — Redirect Codes

3xx Redirects
301 Moved PermanentlyPermanent redirect — cache itDomain migrations, URL restructuring, SEO-safe redirect
302 FoundTemporary redirect — don't cacheLogin redirects, A/B testing, maintenance pages
303 See OtherRedirect to GET after POSTPost-form-submit redirect (PRG pattern)
304 Not ModifiedCached version is still validBrowser sends If-Modified-Since; server confirms no change
307 Temporary RedirectTemp redirect, preserve methodUnlike 302, guarantees POST stays POST (not downgraded to GET)
308 Permanent RedirectPerm redirect, preserve methodLike 301 but method-preserving (POST stays POST)

4xx — Client Error Codes

4xx Client Errors
400 Bad RequestMalformed requestInvalid JSON, missing required fields, wrong data type
401 UnauthorizedAuthentication requiredNo token, expired token, invalid credentials
403 ForbiddenAuthenticated but not authorizedRegular user accessing admin endpoint
404 Not FoundResource does not existWrong URL, deleted resource, ID not found
405 Method Not AllowedHTTP method not supportedPUT on a read-only endpoint
409 ConflictRequest conflicts with current stateDuplicate email, version conflict, edit conflict
410 GoneResource permanently deletedLike 404, but explicitly communicates permanent removal
422 Unprocessable EntityValidation errorInvalid email format, date out of range, business rule violation
429 Too Many RequestsRate limit exceededInclude Retry-After header indicating when to retry

5xx — Server Error Codes

5xx Server Errors
500 Internal Server ErrorUnhandled exceptionApplication code crashed; always log these
502 Bad GatewayInvalid upstream responseApp server crashed mid-response; proxy got garbage
503 Service UnavailableTemporarily unavailableOverloaded or in maintenance; include Retry-After header
504 Gateway TimeoutUpstream timeoutProxy waited too long for app server; slow DB query

Common Confusions Clarified

401 vs 403

  • 401: "Who are you?" — not logged in, or credentials invalid
  • 403: "I know who you are, but you can't do this" — authenticated but unauthorized

400 vs 422

  • 400: Request is structurally wrong — missing field, invalid JSON, wrong content type
  • 422: Request is structurally fine but data values fail validation — invalid email, future date required but past date given

301 vs 302

  • 301: Permanent — browsers cache this, Google transfers page rank. Use for real URL changes.
  • 302: Temporary — browsers do not cache. Use for login redirects, A/B tests.

💡 API Design Tip

Return consistent error bodies alongside your status codes: {"error": "VALIDATION_FAILED", "message": "email must be a valid email address", "field": "email"}. The status code tells clients what went wrong at a protocol level; the body gives actionable detail for debugging.

⚠️ Never Return 200 for Errors

Some older APIs return 200 OK with an error in the JSON body ({"success": false, "error": "..."}). This breaks HTTP clients, monitoring tools, and caches. Always use the correct 4xx or 5xx status code so standard tooling works correctly.

How We Research and Update This Guide

We test the underlying formula or workflow, compare outputs with reliable references, and revise examples whenever the page content changes.

  • The workflow or formula is tested directly in the tool and compared against independent reference examples.
  • Examples are kept practical so readers can verify the result without hidden assumptions.
  • Pages are revised whenever the interface, calculation flow, or surrounding guidance materially changes.

Frequently Asked Questions — HTTP Status Codes