HTTP response status codes indicate whether a specific HTTP request has been successfully completed. Responses are grouped into five classes: Informational responses (100 – 199), Successful responses (200 – 299), Redirection messages (300 – 399), Client error responses (400 – 499), and Server error responses (500 – 599).
Here are some common response status codes and their description.
HTTP status codes | Type | Description |
---|---|---|
200 | Success | This status code indicates that the server has successfully processed the request from the client. |
201 | Created | The request succeeded, and a new resource was created as a result. This is typically the response sent after POST requests, or some PUT requests. |
400 | Bad request | This error indicates that the server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing). |
401 | Unauthorized | This error indicates that the client has attempted to access a resource that requires authentication, but the provided credentials (or lack thereof) are invalid or not accepted by the server. It is often related to authentication issues, such as an incorrect username or password or a missing authentication token. |
403 | Forbidden | This error indicates that the client has requested a resource they are not authorized to access, even though it exists on the server. It usually means that the server has understood the request but refuses to fulfill it due to permission restrictions or authentication issues. |
404 | Resource not found | This error indicates that the server cannot find the requested resource. In the browser, this means the URL is not recognized. In an API, this can also mean that the endpoint is valid but the resource itself does not exist. Servers may also send this response instead of 403 Forbidden to hide the existence of a resource from an unauthorized client. |
500 | Internal server error | This general error code means something went wrong on the server, but the server could not be more specific about the exact problem. It's a catch-all response for unexpected conditions the server encounters while processing a request. This could be due to server software issues, misconfigured settings, or other internal errors. |
501 | Not Implemented | This error indicates that the request method is not supported by the server and cannot be handled. The only methods that servers are required to support (and therefore that must not return this code) are GET and HEAD. |
502 | Bad gateway | This error occurs when the server acts as a gateway or proxy and receives an invalid response from the upstream server to which it sent the request. It means the server received an invalid response from another server or service it was trying to communicate with. |
503 | Service Unavailable | This error indicates that the server is not ready to handle the request. Common causes are a server that is down for maintenance or that is overloaded. A user-friendly page explaining the problem is sent with this response and the Retry-After HTTP header would, wherever possible, contain the estimated time before the recovery of the service. |
504 | Gateway timeout | This occurs when the server is acting as a gateway and cannot get a response in time |