๐Ÿ“‹

HTTP Status Codes

Reference guide for all HTTP status codes

๐Ÿ”

Showing 29 of 29 status codes

1xx Informational

100Continueโ–ผ
101Switching Protocolsโ–ผ
103Early Hintsโ–ผ

2xx Success

200OKโ–ผ
201Createdโ–ผ
202Acceptedโ–ผ
204No Contentโ–ผ
206Partial Contentโ–ผ

3xx Redirection

301Moved Permanentlyโ–ผ
302Found (Temporary Redirect)โ–ผ
304Not Modifiedโ–ผ
307Temporary Redirectโ–ผ
308Permanent Redirectโ–ผ

4xx Client Errors

400Bad Requestโ–ผ
401Unauthorizedโ–ผ
403Forbiddenโ–ผ
404Not Foundโ–ผ
405Method Not Allowedโ–ผ
408Request Timeoutโ–ผ
409Conflictโ–ผ
410Goneโ–ผ
422Unprocessable Entityโ–ผ
429Too Many Requestsโ–ผ

5xx Server Errors

500Internal Server Errorโ–ผ
501Not Implementedโ–ผ
502Bad Gatewayโ–ผ
503Service Unavailableโ–ผ
504Gateway Timeoutโ–ผ
507Insufficient Storageโ–ผ

What are HTTP status codes?

HTTP status codes are standardized three-digit codes that servers return with every HTTP response. They communicate, at a glance, whether a request succeeded, failed, or requires additional action. Understanding them is fundamental to web development, API integration, and debugging.

Status codes are grouped into five classes based on their first digit. This lets you quickly categorize a response even if you don't recognise the specific code.

How to use this reference

Search by code number or keyword โ€” typing "redirect" shows all 3xx codes, typing "500" shows server error codes, typing "auth" shows authentication-related codes.

Filter by category using the buttons to focus on a specific class of responses.

Click any code to expand it and see the full description with practical examples.

The five status code classes

1xx Informational โ€” the request was received and the process is continuing. These are rarely seen in normal browsing.

2xx Success โ€” the request was successfully received, understood, and accepted. 200 OK is the most common response for successful requests.

3xx Redirection โ€” further action is needed to complete the request, usually by following a redirect to a new URL.

4xx Client Errors โ€” the request contains bad syntax or cannot be fulfilled by the server. The problem is on the client side. 404 Not Found is the most recognizable example.

5xx Server Errors โ€” the server failed to fulfill an apparently valid request. The problem is on the server side.

Status codes in REST API design

Good API design uses status codes semantically โ€” the code alone should communicate what happened:

  • GET /users/123 โ†’ 200 OK with user data, or 404 Not Found if user doesn't exist
  • POST /users โ†’ 201 Created with the new user and a Location header
  • PUT /users/123 โ†’ 200 OK with updated user, or 204 No Content if no body is returned
  • DELETE /users/123 โ†’ 204 No Content on success
  • POST /login โ†’ 200 OK on success, 401 Unauthorized for wrong credentials
  • Validation failure โ†’ 422 Unprocessable Entity with error details
  • Rate limit exceeded โ†’ 429 Too Many Requests with retry information

Frequently Asked Questions

What is an HTTP status code?+
An HTTP status code is a three-digit number returned by a server in response to a client's request. The first digit indicates the response class โ€” 1xx is informational, 2xx is success, 3xx is redirection, 4xx is a client error, and 5xx is a server error. Status codes allow clients to understand what happened to their request without parsing the response body.
What is the difference between 401 and 403?+
401 Unauthorized means the client is not authenticated โ€” they haven't logged in or their credentials are invalid. Despite the name "Unauthorized", it really means "Unauthenticated". 403 Forbidden means the client is authenticated but doesn't have permission to access the resource โ€” they're logged in but not allowed. Think of 401 as "I don't know who you are" and 403 as "I know who you are, but you can't come in."
What is the difference between 301 and 302 redirects?+
301 (Moved Permanently) tells browsers and search engines that the resource has permanently moved. Browsers cache this redirect, and search engines transfer ranking signals to the new URL. 302 (Found/Temporary Redirect) indicates a temporary redirect โ€” browsers don't cache it, and search engines don't transfer ranking. Use 301 for permanent URL changes like HTTP to HTTPS, and 302 for temporary redirects.
What does 429 Too Many Requests mean for API usage?+
A 429 response means you've exceeded the API's rate limit โ€” too many requests in a given time window. The response usually includes a Retry-After header indicating when you can try again, and X-RateLimit headers showing your limit and remaining quota. Implement exponential backoff in your code to handle 429 responses gracefully.
What should I return when a resource is not found vs when a user lacks permission?+
Return 404 when the resource genuinely doesn't exist for any user. Return 403 when the resource exists but the requesting user lacks permission. However, for sensitive resources, it's sometimes better to return 404 even when the resource exists but the user lacks permission โ€” this prevents information disclosure about which resources exist.
What is the 418 status code?+
418 "I'm a teapot" is an April Fools' joke status code from RFC 2324 (Hyper Text Coffee Pot Control Protocol). It means "I am a teapot; I cannot brew coffee". Despite being a joke, it's in the official IANA registry and some developers use it for easter eggs. It has no practical use in real APIs.
What is the difference between 500 and 503?+
500 Internal Server Error is a generic catch-all for unexpected server-side errors โ€” unhandled exceptions, misconfigurations, bugs. The server encountered an error it didn't know how to handle. 503 Service Unavailable means the server is intentionally unable to handle requests โ€” due to maintenance, overload, or a dependency being down. 503 implies the condition is temporary and includes a Retry-After header when possible.
httpstatus codes404200301500rest api