What are the common status codes?
HTTP status codes are three-digit numbers sent by a server in response to a client's request. They are divided into five distinct classes based on their first digit:
- 1xx (Informational): Request received, continuing process.
- 2xx (Success): The action was successfully received, understood, and accepted.
- 3xx (Redirection): Further action must be taken to complete the request.
- 4xx (Client Error): The request contains bad syntax or cannot be fulfilled due to a client-side issue.
- 5xx (Server Error): The server failed to fulfill a valid request.
Below is a breakdown of the most common HTTP status codes you will encounter, as documented by the MDN Web Docs and the standard RFC 9110 specification.
2xx Success
- 200 OK: The standard response for successful HTTP requests. The requested data has been fetched and transmitted to the client.
- 201 Created: The request has been fulfilled and has resulted in one or more new resources being successfully created.
- 204 No Content: The server successfully processed the request, but there is no data to return in the response body (common for DELETE operations).
3xx Redirection
- 301 Moved Permanently: This and all future requests should be directed to the new given URL.
- 302 Found (Temporary Redirect): The resource resides temporarily under a different URL, but the client should continue to use the original URL for future requests.
- 304 Not Modified: Indicates that the resource has not been modified since the last request, allowing clients to use their cached version to save bandwidth.
4xx Client Errors
- 400 Bad Request: The server cannot process the request due to something perceived to be a client error (e.g., malformed request syntax, invalid request routing).
- 401 Unauthorized: The request requires user authentication. This is explicitly returned when credentials are missing or invalid.
- 403 Forbidden: The server understood the request, but refuses to authorize it. Unlike 401, the client's identity is known, but they lack permission to access the resource.
- 404 Not Found: The server cannot find the requested resource. This is the most famous status code and usually means the URL is mistyped or the resource has been deleted.
- 405 Method Not Allowed: A request was made using a request method (like GET, POST, or DELETE) that the target resource does not support.
- 429 Too Many Requests: The user has sent too many requests in a given amount of time (rate-limiting).
5xx Server Errors
- 500 Internal Server Error: A generic catch-all error message indicating that the server encountered an unexpected condition that prevented it from fulfilling the request.
- 502 Bad Gateway: The server, while acting as a gateway or proxy, received an invalid response from the upstream server it accessed while attempting to fulfill the request.
- 503 Service Unavailable: The server cannot handle the request, usually because it is down for maintenance or overloaded with traffic.
- 504 Gateway Timeout: The server, while acting as a gateway or proxy, did not receive a timely response from the upstream server.
What are all the 200 status codes?
The 2xx class of HTTP status codes indicates that the client's request was successfully received, understood, and accepted.
Here is the complete list of standard 2xx Success status codes defined by the IETF (Internet Engineering Task Force) and the WebDAV extensions:
Standard 2xx Success Status Codes
- 200 OK: The standard response for a successful HTTP request. The actual payload returned depends on the request method (e.g., a GET returns the requested resource, while a POST returns the result of an action).
- 201 Created: The request succeeded and resulted in the creation of a new resource. The server typically provides a Location header pointing to the new resource.
- 202 Accepted: The request has been accepted for processing, but the processing is not yet complete. This is commonly used for asynchronous or background tasks.
- 203 Non-Authoritative Information: The request was successful, but the payload was modified or transformed by a transforming proxy (like a CDN) from the origin server's 200 OK response.
- 204 No Content: The server successfully processed the request, but does not need to return a response body. It is frequently used for DELETE actions or PUT updates where no feedback is required.
- 205 Reset Content: The server successfully processed the request and requires the requesting user agent to reset the document view (for example, clearing a form field). It returns no response body.
- 206 Partial Content: The server is delivering only part of the resource because of a range header sent by the client. This is heavily utilized for pausing and resuming downloads, or streaming video/audio.
WebDAV Success Status Codes
These additional 2xx status codes were introduced by extensions like WebDAV (Web Distributed Authoring and Versioning):
- 207 Multi-Status: The response body contains an XML or JSON document that encapsulates multiple independent status codes, depending on how many sub-requests were made.
- 208 Already Reported: Used inside a WebDAV 207 Multi-Status response to avoid repeating the status of an internal member that was already enumerated in an earlier part of the response.
- 226 IM Used: The server has fulfilled a GET request for the resource, and the response is a representation of the result of one or more instance-manipulations applied to the current instance.
What are the types of status codes?
HTTP status codes are three-digit numbers sent by a server to a browser or client to show the result of a request.
They are divided into five main classes based on their first digit:
1. 1xx (Informational)
- Meaning: The server received the request and is continuing to process it.
- Example: 100 Continue (the client can keep sending the rest of the request).
2. 2xx (Success)
- Meaning: The server successfully received, understood, and handled the request.
- Examples:
- 200 OK (standard success, data returned).
- 201 Created (a new resource was successfully made).
- 204 No Content (success, but no body data to return).
3. 3xx (Redirection)
- Meaning: The client must take extra steps or a new URL to finish the request.
- Examples:
- 301 Moved Permanently (the page has a new permanent address).
- 302 Found (temporary redirect).
4. 4xx (Client Error)
- Meaning: The request has bad syntax or cannot be fulfilled due to an issue on the user or client side.
- Examples:
- 400 Bad Request (the server cannot parse the request).
- 401 Unauthorized (missing or bad login credentials).
- 403 Forbidden (valid credentials, but access is denied).
- 404 Not Found (the requested web page does not exist).
- 429 Too Many Requests (rate limit exceeded).
5. 5xx (Server Error)
- Meaning: The request was valid, but the server failed to complete it due to an internal problem.
- Examples:
- 500 Internal Server Error (a general catch-all server crash or bug).
- 502 Bad Gateway (an upstream server sent an invalid response).
- 503 Service Unavailable (the server is overloaded or down for maintenance).
What are status codes 2xx, 3xx, 4xx, 5xx in API?
HTTP status codes in an API are three-digit responses sent by a server to communicate the outcome of a client's request. The first digit defines the "class" or category of the response.
Here is the breakdown of what the 2xx, 3xx, 4xx, and 5xx status code families mean, along with their most common real-world examples:
🟢 2xx: Success (Everything Worked)
A 2xx status code means the client's request was successfully received, understood, and accepted by the server.
- 200 OK: The standard response for a successful request (e.g., retrieving data via a GET request).
- 201 Created: The request succeeded, and a new resource was successfully created (common after a POST request).
- 204 No Content: The request was successful, but the server is purposefully not returning any content in the response body (common after a DELETE request).
🔵 3xx: Redirection (The Resource Moved)
A 3xx status code means the client must take additional actions—usually URL redirection—to complete the request.
- 301 Moved Permanently: The target resource has been assigned a new permanent URL.
- 302 Found / 307 Temporary Redirect: The resource is temporarily located at a different URL.
- 304 Not Modified: Used for caching; it tells the client that the resource hasn't changed, so they can keep using the cached version.
🟠 4xx: Client Error (You Made a Mistake)
A 4xx status code points the finger at the client. It means there is an issue with the request itself, such as a typo, incorrect credentials, or missing data.
- 400 Bad Request: The server cannot process the request due to malformed syntax or bad input data.
- 401 Unauthorized: The request lacks valid authentication credentials (you need to log in).
- 403 Forbidden: The server understands who you are, but you do not have permission to access the requested resource.
- 404 Not Found: The server cannot find the requested resource or endpoint.
- 429 Too Many Requests: The client has sent too many requests in a given amount of time (rate-limiting).
🔴 5xx: Server Error (The Server Failed)
A 5xx status code means the request was perfectly valid, but the server encountered an internal error or is otherwise incapable of performing the request.
- 500 Internal Server Error: A generic error message indicating something went wrong on the server side.
- 502 Bad Gateway: The server, while acting as a gateway or proxy, received an invalid response from an upstream server.
- 503 Service Unavailable: The server is currently unable to handle the request, usually because it is overloaded or down for maintenance.
- 504 Gateway Timeout: The server was acting as a proxy and timed out waiting for a response from the upstream server.
💡 Summary Rule of Thumb
When debugging an API according to community resources like AI for Growth on LinkedIn:
- 2xx → "Your request worked!"
- 3xx → "Look somewhere else."
- 4xx → "Check your code/request."
- 5xx → "Fix the server."
(Note: There is also a 1xx class, which represents Informational responses used for early-stage protocol processing, though these are rarely handled directly in day-to-day API development).
What is 1xx, 2xx, 3xx, 4xx, and 5xx?
HTTP status codes are three-digit responses sent by a web server to a browser to indicate the outcome of a request. They are divided into five distinct categories based on the first digit (1 through 5).
| Category | Meaning | Description | Common Example |
|---|---|---|---|
| 1xx | Informational | The request was received, and the process is continuing. | 101 Switching Protocols |
| 2xx | Success | The action was successfully received, understood, and accepted. | 200 OK |
| 3xx | Redirection | Further action must be taken by the browser to complete the request. | 301 Moved Permanently |
| 4xx | Client Error | The request contains bad syntax or cannot be fulfilled due to a user error. | 404 Not Found |
| 5xx | Server Error | The server failed to fulfill an apparently valid request. | 500 Internal Server Error |
HTTP Status Codes Explained In 5 Minutes
What is the difference between a 200 and a 304 status code?
The primary difference is that 200 OK means the server is sending the full requested resource back to the client, while 304 Not Modified means the server is telling the client to reuse its own cached version because the file hasn't changed.
Both codes indicate a successful interaction, but they handle data transfer and caching completely differently.
Comparison Overview
| Feature | 200 OK | 304 Not Modified |
|---|---|---|
| Response Body | Contains the full payload (HTML, JSON, image, etc.). | Empty. No response body is sent. |
| Network Traffic | High bandwidth usage (downloads the whole file). | Minimal bandwidth usage (only sends headers). |
| Trigger Mechanism | Normal request, or a conditional request where the file has changed. | A conditional request where the file has not changed. |
| Speed | Standard loading time. | Much faster because the client skips downloading the asset. |
How They Work (The Caching Workflow)
To understand why you get a 304 instead of a 200, it helps to look at how browsers and servers talk to each other:
- The First Request (200 OK): Your browser requests an image (e.g., logo.png). The server finds it, responds with a 200 OK status, and sends the actual image file. Along with the image, the server sends headers like ETag (a unique file hash) or Last-Modified (a timestamp). The browser saves the image and those headers in its cache.
- The Subsequent Request (304 Not Modified): When the browser needs that same image again, it sends a conditional request. It asks the server: "Hey, I have this version from Tuesday. Has it changed?" using headers like If-None-Match (sending the ETag) or If-Modified-Since.
- The Server's Decision:
- If the file is identical, the server doesn't waste time resending it. It replies with a 304 Not Modified. Your browser instantly loads the image from its own hard drive/memory.
- If the file has been updated, the server responds with a 200 OK and sends the brand-new file.
A Note on 200 (from cache) / 200 (from memory cache)
In browser developer tools (like Chrome DevTools or Firefox Network tab), you might sometimes see a status listed as 200 (from cache).
- 200 (from cache): The browser didn't even bother asking the server if the file changed. It checked its own freshness headers (like Cache-Control: max-age), realized the local copy was still valid, and loaded it instantly without making a network call at all. This is the absolute fastest response type.
- 304 Not Modified: The browser did make a network call to check with the server, but the server told it to use the cache.
What are all the 400 errors?
HTTP 4xx status codes represent client-side errors, meaning the request contains bad syntax or cannot be fulfilled by the server.
Standard HTTP 4xx Error Codes
- 400 Bad Request: The server cannot process the request due to malformed request syntax or invalid framing.
- 401 Unauthorized: The request lacks valid authentication credentials for the target resource.
- 402 Payment Required: Reserved for future use, occasionally utilized by digital payment or monetization systems.
- 403 Forbidden: The server understood the request but refuses to authorize it due to insufficient permissions.
- 404 Not Found: The server cannot find the requested resource or URL.
- 405 Method Not Allowed: The request method (like GET or POST) is not supported for the target resource.
- 406 Not Acceptable: The server cannot generate a response matching the criteria defined in the client's Accept headers.
- 407 Proxy Authentication Required: The client must first authenticate itself with the proxy server.
- 408 Request Timeout: The server timed out waiting for the request from the client.
- 409 Conflict: The request could not be completed because of a conflict in the resource's current state (such as an edit conflict).
- 410 Gone: The requested content has been permanently deleted from the server with no forwarding address.
- 411 Length Required: The server refuses to accept the request without a defined Content-Length header.
- 412 Precondition Failed: One or conditions specified in the request header fields evaluated to false on the server.
- 413 Payload Too Large / Request Entity Too Large: The request is larger than the server is willing or able to process.
- 414 URI Too Long: The provided URI/URL is longer than the server is willing to interpret.
- 415 Unsupported Media Type: The media format of the requested data is not supported by the server.
- 416 Range Not Satisfiable: The portion of the resource requested via the Range header cannot be supplied by the server.
- 417 Expectation Failed: The expectation given in the request's Expect header cannot be met by the server.
- 418 I'm a teapot: A humorous April Fools' joke standard defined in RFC 2324; the server refuses to brew coffee because it is a teapot.
- 421 Misdirected Request: The request was directed at a server that is not able to produce a response.
- 422 Unprocessable Entity: The request was well-formed but contained semantic errors that prevented processing (WebDAV).
- 423 Locked: The resource being accessed is locked (WebDAV).
- 424 Failed Dependency: The request failed due to a failure of a previous request (WebDAV).
- 425 Too Early: Indicates the server is unwilling to risk processing a request that might be replayed.
- 426 Upgrade Required: The client should switch to a different protocol such as TLS/1.0.
- 428 Precondition Required: The origin server requires the request to be conditional.
- 429 Too Many Requests: The user has sent too many requests in a given amount of time (rate limiting).
- 431 Request Header Fields Too Large: The server is unwilling to process the request because its header fields are too large.
- 451 Unavailable For Legal Reasons: The resource is blocked as a result of legal demands or government censorship.
Common Non-Standard / Extension 4xx Codes
- 419 Page Expired (Laravel): Used by the Laravel framework when a CSRF token has expired.
- 420 Enhance Your Calm / Method Failure (Spring / Twitter): Rate limiting or older API constraints.
- 440 Login Time-out (IIS): Microsoft extension indicating the session has expired.
- 449 Retry With (IIS): The request should be retried after performing the appropriate action.
- 444 Connection Closed Without Response (Nginx): Nginx proprietary code to drop the connection without sending headers.
- 498 Invalid Token (ArcGIS): Returned by ArcGIS when an expired or invalid token is presented.
- 499 Client Closed Request (Nginx): Used when the client closed the request while the server was still processing.
What is a 402 status code?
A 402 status code means Payment Required, an HTTP error indicating that a request cannot be processed until the client makes a financial payment or resolves a billing issue.
History and Purpose
- Reserved code: The List of HTTP status codes originally set aside 402 as a placeholder for digital cash or micropayment systems.
- Dormant past: For nearly 30 years, the code lacked an official, standardized implementation in web browsers.
- Modern revival: Protocols like Coinbase's x402 and Stripe/Tempo's MPP now use it to let AI agents and automated systems pay for web resources.
Common Real-World Uses
- API limits: Web services and APIs return a 402 when you exhaust your free credits, hit usage quotas, or need to upgrade your subscription plan.
- Failed billing: Payment gateways and platforms like Stripe use it for declined cards, expired subscriptions, or unpaid invoices.
- Store restrictions: E-commerce platforms like Shopify use 402 to signal a frozen store due to an unpaid balance.
What is status 200 and 201?
HTTP status codes 200 and 201 are both successful responses from a server, but they mean different things based on what the request achieved.
Status 200 (OK)
- Meaning: The request succeeded.
- Usage: The server processed the request and is returning the requested data.
- Example: When you load a web page (GET request) or fetch a user profile from an MDN Web Docs API, the server sends back a 200 OK with the data.
Status 201 (Created)
- Meaning: The request succeeded and resulted in a new resource being created.
- Usage: Used primarily after a POST request when a new item (like a user account, file, or database record) is successfully built.
- Example: When you submit a signup form and a new user is saved to the database, the server responds with 201 Created and often includes a Location header pointing to the new item.
Key Differences
- Core Action: Status 200 handles general success and retrieval; status 201 specifically handles successful creation.
- Common Method: Status 200 usually pairs with GET, PUT, or PATCH; status 201 usually pairs with POST.
What does each status code mean?
HTTP status codes are three-digit numbers sent by a web server in response to a client's request (like a browser or an API call) to indicate whether the request was successfully completed.
These response codes are maintained by the Internet Assigned Numbers Authority (IANA) and are divided into five distinct classes based on the first digit of the code.
Overview of the 5 Status Code Classes
| Class | Type | General Meaning |
|---|---|---|
| 1xx | Informational | Request received and understood; processing is continuing. |
| 2xx | Success | The action requested by the client was successfully received, understood, and accepted. |
| 3xx | Redirection | Further action or a different URL is required to complete the request. |
| 4xx | Client Error | The request contains bad syntax or cannot be fulfilled due to a client-side fault. |
| 5xx | Server Error | The server failed to fulfill a valid request due to an internal error or temporary down-time. |
Common Status Codes Explained
ℹ️ 1xx: Informational
- 100 Continue: Everything is fine so far; the client should continue with the request or ignore this response if the request is already finished.
- 101 Switching Protocols: The server is changing protocols to the one requested by the client (e.g., switching from HTTP to WebSockets).
✅ 2xx: Success
- 200 OK: The standard success code. The request succeeded, and the server returned the requested data.
- 201 Created: The request succeeded, and a new resource was successfully created as a result (commonly used for database insertions or file uploads).
- 204 No Content: The request was processed successfully, but the server is deliberately returning no content in the response body.
🔀 3xx: Redirection
- 301 Moved Permanently: The requested resource has been assigned a new permanent URL. Future requests should use the updated link.
- 302 Found (Temporary Redirect): The resource resides temporarily under a different URL, but future requests should still use the original link.
- 304 Not Modified: Used for caching. It tells the browser that the resource hasn't changed, so it can safely load the copy stored in its local cache.
❌ 4xx: Client Error
- 400 Bad Request: The server cannot process the request due to something perceived to be a client error (e.g., malformed request syntax, invalid parameters).
- 401 Unauthorized: Proper authentication credentials are required and either failed or were not provided.
- 403 Forbidden: The client is authenticated, but they do not have the necessary permission or access rights to view the resource.
- 404 Not Found: The ultimate classic web error. The server cannot find the requested resource because the URL does not exist or has been deleted.
- 429 Too Many Requests: The user has sent too many requests in a given amount of time (rate-limiting).
⚠️ 5xx: Server Error
- 500 Internal Server Error: A generic catch-all error message indicating that the server encountered an unexpected condition that prevented it from fulfilling the request.
- 502 Bad Gateway: The server, while acting as a gateway or proxy, received an invalid response from the upstream server it attempted to contact.
- 503 Service Unavailable: The server is currently unable to handle the request, usually because it is overloaded or down for maintenance.
- 504 Gateway Timeout: The server, acting as a gateway or proxy, did not receive a timely response from the upstream server.
Detailed specifications and documentation for all 60+ variations can be tracked via the MDN Web Docs Reference Guide.