Skip to content

HTTP Status Codes Reference

A categorised reference of the HTTP status codes you'll meet during web development. Useful for API design, debugging, and error handling.

What are HTTP status codes?

HTTP status codes are 3-digit numbers returned by a server to indicate the result of a client request. The first digit determines the class — there are five classes from 1xx to 5xx. Returning the right status code is foundational to good RESTful API design.

1xx — Informational

The request was received and processing is continuing. Browsers usually handle these automatically.

CodeNameDescription
100ContinueInitial part of the request received; client may continue
101Switching ProtocolsProtocol switch accepted (used by WebSocket)
103Early HintsHints to start preloading resources before the final response

2xx — Success

The request was successfully received and processed. Most common category in API development.

CodeNameDescriptionTypical use
200OKRequest succeededGET / PUT / PATCH success
201CreatedRequest succeeded and a new resource was createdPOST creating a resource
202AcceptedRequest accepted but processing not completeAccepting an async job
204No ContentSuccess, no body to returnDELETE success, PUT-only updates
206Partial ContentPartial response to a range requestResuming large downloads

3xx — Redirection

Further action is needed to complete the request (such as following a redirect). Important for SEO and URL migration.

CodeNameDescriptionTypical use
301Moved PermanentlyResource has moved permanentlyURL change / domain migration; passes SEO equity
302FoundTemporary redirect to another URLMaintenance redirects
303See OtherRefer to another URL via GETPost-Redirect-Get pattern after POST
304Not ModifiedResource has not changedBrowser cache reuse; saves bandwidth
307Temporary RedirectTemporary redirect (preserves method)HTTP→HTTPS temporary forwarding
308Permanent RedirectPermanent redirect (preserves method)API endpoint permanent move

4xx — Client Error

Something is wrong with the client request — bad input, missing auth, etc.

CodeNameDescriptionTypical use
400Bad RequestMalformed requestValidation errors, malformed JSON
401UnauthorizedAuthentication requiredNot logged in, expired token
403ForbiddenNo permission to accessAuthenticated but lacking access
404Not FoundResource not foundNon-existent URL, deleted resource
405Method Not AllowedHTTP method not allowedPOST against a GET-only endpoint
408Request TimeoutRequest timed outSlow client data transfer
409ConflictResource conflictDuplicate registration, optimistic-lock collision
413Payload Too LargeRequest body too largeUpload limit exceeded
415Unsupported Media TypeUnsupported media typeWrong Content-Type
422Unprocessable EntitySyntax OK but semantically invalidValidation errors (detailed)
429Too Many RequestsRate limit exceededAPI call rate limiting

5xx — Server Error

The server failed to process a valid request. Caused by misconfiguration or application bugs.

CodeNameDescriptionTypical use
500Internal Server ErrorInternal server errorUnhandled exception, application bug
501Not ImplementedServer doesn't support the featureUnimplemented API endpoint
502Bad GatewayBad response from upstreamReverse proxy upstream failure
503Service UnavailableService unavailableMaintenance, overload
504Gateway TimeoutUpstream timeoutUpstream server response timeout

FAQ

What's the difference between 401 and 403?

401 Unauthorized means authentication is required — prompt the user to log in or provide a token. 403 Forbidden means the user is authenticated but lacks permission for this resource. A regular user accessing an admin-only page should get 403.

What's the difference between 301 and 308?

Both are permanent redirects, but 301 may convert the HTTP method to GET on redirect. 308 preserves the request method. Use 308 when you need POST requests to remain POST after redirection.

What should I do about a 413 error?

If you get 413 Payload Too Large on file upload, check your server (Nginx client_max_body_size, Apache LimitRequestBody) and PHP (upload_max_filesize, post_max_size) settings. DevLab's threshold test files can help verify the limit.