Glossary

HTTP Status Codes

Three-digit codes returned by HTTP servers to indicate the outcome of a client request. The first digit defines the class: 1xx informational, 2xx success, 3xx redirection, 4xx client error, 5xx server error. Status codes are defined in RFC 9110.

HTTP status codes are three-digit integers returned in every HTTP response to indicate the outcome of the request. The first digit defines the response class; the remaining two provide more specificity. Defined in RFC 9110 (HTTP Semantics), status codes are the primary mechanism for communicating success, failure, or redirection between HTTP clients and servers.

Five Classes

RangeClassDescription
1xxInformationalRequest received, processing continues
2xxSuccessRequest received, understood, and accepted
3xxRedirectionFurther action needed to complete request
4xxClient ErrorRequest contains bad syntax or cannot be fulfilled
5xxServer ErrorServer failed to fulfill a valid request

Most Common Codes

CodeNameWhen Used
200OKSuccessful GET, PUT, PATCH
201CreatedResource created via POST
204No ContentSuccessful DELETE or PUT with no response body
301Moved PermanentlyPermanent redirect (preserves SEO equity)
304Not ModifiedCached response is still valid (ETag match)
400Bad RequestInvalid request syntax or parameters
401UnauthorizedAuthentication required or failed
403ForbiddenAuthenticated but lacking permission
404Not FoundResource does not exist
409ConflictState conflict (duplicate resource, version mismatch)
422Unprocessable EntityValid syntax but failed business logic validation
429Too Many RequestsRate limit exceeded
500Internal Server ErrorUnhandled server exception
502Bad GatewayUpstream server returned invalid response
503Service UnavailableServer overloaded or under maintenance
504Gateway TimeoutUpstream server timed out

401 vs 403

  • 401 Unauthorized: the client is not authenticated. The response should include a WWW-Authenticate header.
  • 403 Forbidden: the client is authenticated but lacks permission to access the resource.

REST API Best Practices

POST /users → 201 Created (with Location header)
GET /users/123 → 200 OK
GET /users/999 → 404 Not Found
DELETE /users/123 → 204 No Content
PUT /users/123 (validation fails) → 422 Unprocessable Entity
POST /auth/login (wrong password) → 401 Unauthorized
GET /admin (user is not admin) → 403 Forbidden

Look up any HTTP status code with the HTTP Status Code Reference Tool.