2xx: the request succeeded
200 OKNormal response, with content.201 CreatedA resource was created (after a POST). Give its address in the Location header.202 AcceptedRequest accepted, background processing not finished yet.204 No ContentSucceeded, with nothing to send back (after a DELETE, for example).206 Partial ContentOnly part of the file, to play a video or resume a download.
3xx: redirects
301 Moved PermanentlyThe address changed for good. Search engines move the ranking over.302 FoundTemporary redirect. The old address stays the indexed one.303 See OtherAfter a form is sent, points to a page to open with GET.304 Not ModifiedThe browser can reuse its cached copy.307 / 308Like 302 and 301, but the method (POST, PUT…) and the request body are kept.
4xx: client-side error
400 Bad RequestMalformed request: invalid JSON, missing parameter.401 UnauthorizedSign-in needed: credentials missing or invalid.403 ForbiddenSigned in, but not allowed to access this resource.404 Not FoundNothing at this address.405 Method Not AllowedThe address exists, but not for this method (a POST on a read-only page).409 ConflictConflicts with the current state: email already used, simultaneous edit.410 GoneDeleted for good. Search engines drop it faster than with a 404.413 Content Too LargeFile or request body too large.415 Unsupported Media TypeFormat not accepted (a .png where a PDF is expected).422 Unprocessable ContentWell-formed request but invalid data: wrong email, past date.429 Too Many RequestsToo many requests. Add a Retry-After header to say when to try again.
5xx: server-side error
500 Internal Server ErrorUnexpected error in the server code. Check the logs.501 Not ImplementedThe server cannot handle this method.502 Bad GatewayA server in between got an invalid response from the next one.503 Service UnavailableServer under maintenance or overloaded. Retry-After is recommended.504 Gateway TimeoutThe next server took too long to answer.
Which code to send?
Page moved301 (or 308 for an API). Never send every old page to the home page.User not signed in401. Signed in but not allowed: 403. To hide that a resource exists: 404.Invalid form422 with the list of fields in error, or 400 if the request itself is broken.Custom error pageIt must keep its 404 or 500 code. An error page sent as 200 misleads search engines.1xxInformational codes (100 Continue, 101 Switching Protocols) handled by the server: you almost never send them yourself.
Other resources
Need help with your website?
See the services I build your custom website.
Showcase site, online shop, management tool: let’s talk about your project.