Skip to content

HTTP Status Code Reference

The HTTP status codes you actually run into in web development, organised by class — for API design, debugging and error handling.

What an HTTP status code is

An HTTP status code is the three-digit number a server returns to describe the outcome of a request from a client (a browser or an API client). The first digit sets the category, giving five classes from 1xx to 5xx. Returning the right code matters a great deal in RESTful API design.

1xx 2xx 3xx 4xx 5xx 1xx Informational (100, 101, 103) 2xx Success (200, 201, 204) 3xx Redirection (301, 302, 304) 4xx Client Error (400, 404, 422) 5xx Server Error (500, 502, 503)
Diagram: HTTP status code classification (5 classes)

1xx — Informational

The request was received and processing continues. Browsers handle these automatically, so developers rarely deal with them directly.

CodeNameMeaning
100ContinueThe first part of the request was received; the client may continue
101Switching ProtocolsProtocol switch accepted; used when establishing a WebSocket connection
103Early HintsA hint that lets the client start preloading resources before the final response

2xx — Success

The request was accepted and processed. This is the class you use most in API development.

CodeNameMeaningTypical use
200OKRequest succeededA successful GET, PUT or PATCH
201CreatedRequest succeeded and a new resource was createdA POST that created a resource
202AcceptedRequest accepted but not yet processedAccepting an asynchronous job
204No ContentRequest succeeded with no content to returnA successful DELETE, or a PUT that only updates
206Partial ContentPartial response to a range requestResuming a large file download

3xx — Redirection

Further action is needed to complete the request, usually following a redirect. These matter most for SEO and URL migrations.

CodeNameMeaningTypical use
301Moved PermanentlyThe resource moved permanentlyURL changes and domain migrations; passes on SEO signals
302FoundTemporarily redirected to another URLA temporary move during maintenance
303See OtherFetch a different URL with GETRedirect after a POST (the PRG pattern)
304Not ModifiedThe resource has not changedUses the browser cache and saves bandwidth
307Temporary RedirectTemporary redirect that preserves the methodA temporary HTTP to HTTPS move
308Permanent RedirectPermanent redirect that preserves the methodPermanently moving an API endpoint

4xx — Client error

The problem is on the client side — usually the request body or the credentials.

CodeNameMeaningTypical use
400Bad RequestThe request syntax is invalidValidation errors, malformed JSON
401UnauthorizedAuthentication requiredNot signed in, or an expired token
403ForbiddenNo permission to accessAuthenticated but not allowed to reach the resource
404Not FoundThe resource was not foundA URL that does not exist, or a deleted resource
405Method Not AllowedHTTP method not allowedPOSTing to a GET-only endpoint
408Request TimeoutThe request timed outWhen the client sends data too slowly
409ConflictResource conflictDuplicate records, optimistic-lock collisions
413Payload Too LargeThe request body is too largeExceeding the upload size limit
415Unsupported Media TypeUnsupported media typeAn incorrect Content-Type
422Unprocessable EntitySyntactically valid but semantically unprocessableValidation errors (with detail)
429Too Many RequestsRate limit exceededAPI call quotas

5xx — Server error

Processing failed on the server — usually a configuration mistake or an application bug.

CodeNameMeaningTypical use
500Internal Server ErrorInternal server errorUnhandled exceptions, application bugs
501Not ImplementedThe server does not support the featureAn API endpoint that is not implemented yet
502Bad GatewayThe gateway received an invalid responseThe upstream server behind a reverse proxy is unreachable
503Service UnavailableService unavailableUnder maintenance or overloaded
504Gateway TimeoutGateway timeoutThe upstream server did not answer in time

Frequently asked questions

What is the difference between 401 and 403?

401 Unauthorized means authentication is required and prompts the client to sign in or present a token. 403 Forbidden means the client is authenticated but lacks permission for the resource. A regular user hitting an admin-only page should get a 403.

What is the difference between 301 and 308?

Both are permanent redirects, but with 301 the HTTP method may be rewritten to GET along the way. 308 forwards the request with its method intact. Use 308 when a POST must stay a POST at the redirect target.

What should I do about a 413?

When an upload returns 413 Payload Too Large, check the limits at every layer: the web server (Nginx client_max_body_size, Apache LimitRequestBody) and PHP (upload_max_filesize, post_max_size). DevLab's threshold test files let you confirm the effective limit.