- 19 Jul 2024
- 5 Minutes to read
- Print
- DarkLight
HTTP Response Standards
- Updated on 19 Jul 2024
- 5 Minutes to read
- Print
- DarkLight
Successful responses (200 – 299)
The request succeeded. The result meaning of "success" depends on the HTTP method:
GET: The resource has been fetched and transmitted in the message body.
HEAD: The representation headers are included in the response without any message body.
PUT or POST: The resource describing the result of the action is transmitted in the message body.
TRACE: The message body contains the request message as received by the server.
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.
The request has been received but not yet acted upon. It is noncommittal, since there is no way in HTTP to later send an asynchronous response indicating the outcome of the request. It is intended for cases where another process or server handles the request, or for batch processing.
This response code means the returned metadata is not exactly the same as is available from the origin server, but is collected from a local or a third-party copy. This is mostly used for mirrors or backups of another resource. Except for that specific case, the 200 OK response is preferred to this status.
There is no content to send for this request, but the headers may be useful. The user agent may update its cached headers for this resource with the new ones.
Client error responses (400-499)
The server cannot or will not process the request due to something that is perceived to be a client error (e.g., payload incorrect, invalid request message framing, or deceptive request routing).
Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response.
The client does not have access rights to the content; that is, it is unauthorized, so the server is refusing to give the requested resource. Unlike 401 Unauthorized, the client's identity is known to the server.
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. This response code is probably the most well known due to its frequent occurrence on the web.
The request method is known by the server but is not supported by the target resource. For example, an API may not allow calling DELETE to remove a resource.
This response is sent when the web server, after performing server-driven content negotiation, doesn't find any content that conforms to the criteria given by the user agent.
This is similar to 401 Unauthorized but authentication is needed to be done by a proxy.
408 Request Timeout
This response is sent on an idle connection by some servers, even without any previous request by the client. It means that the server would like to shut down this unused connection. This response is used much more since some browsers, like Chrome, Firefox 27+, or IE9, use HTTP pre-connection mechanisms to speed up surfing. Also note that some servers merely shut down the connection without sending this message.
This response is sent when a request conflicts with the current state of the server.
Server rejected the request because the Content-Length header field is not defined and the server requires it.
The client has indicated preconditions in its headers which the server does not meet.
Request entity is larger than limits defined by server. The server might close the connection or return an Retry-After header field.
The URI requested by the client is longer than the server is willing to interpret.
The media format of the requested data is not supported by the server, so the server is rejecting the request.
The range specified by the Range header field in the request cannot be fulfilled. It's possible that the range is outside the size of the target URI's data.
This response code means the expectation indicated by the Expect request header field cannot be met by the server.
The request was directed at a server that is not able to produce a response. This can be sent by a server that is not configured to produce responses for the combination of scheme and authority that are included in the request URI.
Indicates that the server is unwilling to risk processing a request that might be replayed.
The user has sent too many requests in a given amount of time ("rate limiting").
The server is unwilling to process the request because its header fields are too large. The request may be resubmitted after reducing the size of the request header fields.
Server error responses (500-599)
The server has encountered a situation it does not know how to handle.
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.
This error response means that the server, while working as a gateway to get a response needed to handle the request, got an invalid response.
The server is not ready to handle the request. Common causes are a server that is down for maintenance or that is overloaded.
This error response is given when the server is acting as a gateway and cannot get a response in time.
The HTTP version used in the request is not supported by the server.
Indicates that the client needs to authenticate to gain network access.