{"id":1349,"date":"2022-04-29T20:26:03","date_gmt":"2022-04-29T20:26:03","guid":{"rendered":"https:\/\/apimike.com\/?p=1349"},"modified":"2022-12-12T21:58:46","modified_gmt":"2022-12-12T21:58:46","slug":"list-of-http-response-status-codes","status":"publish","type":"post","link":"https:\/\/apimike.com\/list-of-http-response-status-codes","title":{"rendered":"List of HTTP response status codes"},"content":{"rendered":"\n
In computer networking, a server may send a response code to indicate the status of a request sent by a client. The response code may also be called an HTTP status code, an HTTP response code, or an HTTP status message.<\/p>\n\n\n\n
API coders should be aware of HTTP error codes because they can indicate whether a request was successful or not. If an error code is returned, the coder can then take appropriate action to fix the problem.<\/p>\n\n\n\n
There are many possible HTTP status codes that could be returned from a RESTful API, but some of the most common ones are 404 (Not Found), 401 (Unauthorized), and 400 (Bad Request).<\/p>\n\n\n\n
The first digit of the status code defines the class of response. The second and third digits indicate a specific response within that class. The HTTP 1.1 specification defines the following classes of response codes:<\/p>\n\n\n\n
This class of status code indicates a provisional response, consisting only of the Status-Line and optional headers, and is terminated by an empty line. Since HTTP\/1.0 did not define any 1xx status codes, servers MUST NOT send a 1xx response to an HTTP\/1.0 client unless the client has made a request with the Expect request header field set to 100-continue as described in section 8.2.3 of [RFC2616].<\/p>\n\n\n\n
A client must be prepared to accept one or more 1xx status responses prior to a regular response, even if the client does not expect a 100 (Continue) status message. Unexpected 1xx status responses MAY be ignored by a user agent.<\/p>\n\n\n\n
Proxies MUST forward 1xx responses, unless the connection between the proxy and its client has been closed, or unless the proxy itself requested the generation of the 1xx response. (For example, if a proxy adds a “Expect: 100-continue” field to a request, it is not required to forward the corresponding 100 (Continue) response(s).)<\/p>\n\n\n\n
The client should continue with its request. This interim response is used to inform the client that the initial part of the request has been received and has not yet been rejected by the server. The client should continue by sending the remainder of the request or, if the request has already been completed, ignore this response. The server MUST NOT send a 100 (Continue) response if the request already includes People usually expect to get 100-continue before this interim response, but they didn’t get 100 (continue) before this interim response.<\/p>\n\n\n\n
The server understands and is willing to comply with the client’s request, via the Upgrade message header field (section 14.42 of [RFC2616]), for a change in the application protocol being used on this connection. The server will switch protocols to those defined by the response’s upgrade header field immediately after the empty line that terminates the 101 response.<\/p>\n\n\n\n
The protocol should be switched only when it is advantageous to do so. People who use resources that need real-time or synchronous features might want to use a real-time protocol instead of an older version of HTTP to send them.<\/p>\n\n\n\n
A 101 response may be used to inform the client about the new capabilities of a server that were not previously known to the client. The server should include any new or changed capability information in the 101 response. If the client uses the Upgrade header field and the server does not recognize the request method used, it should respond with a status code of 502 (Bad Gateway).<\/p>\n\n\n\n
As a WebDAV request may contain many sub-requests involving file operations, it may take a long time to complete the request. This code indicates that the server has received and is processing the request, but no response is available yet. This prevents the client from timing out and assuming the request was lost.<\/p>\n\n\n\n
This type of status code shows that the client’s request was received, understood, and agreed to.<\/p>\n\n\n\n
The request has succeeded. The information returned with the response is dependent on the method used in the request. For example,<\/p>\n\n\n\n
In the response, an entity corresponding to the requested resource is sent in the response;<\/p>\n\n\n\n
HEAD The entity-header fields corresponding to the requested resource are sent in the response without any message body;<\/p>\n\n\n\n
POST an entity describing or containing the action’s result;<\/p>\n\n\n\n
Trace an entity containing the request message as received by the end server.<\/p>\n\n\n\n
The request has been accepted for processing, but the processing has not yet been completed. The request might or might not eventually be acted upon, as it might be disallowed when processing actually takes place. There isn’t a way to send a status code again from an asynchronous operation like this one.<\/p>\n\n\n\n
The returned metainformation in the entity-header is not the definitive set as available from the origin server, but is gathered from a local or a third-party copy. The set presented MAY be a subset or superset of the original version. For example, including local annotation information about the resource might result in a superset of the metainformation known by the origin server. The origin server should generate a Vary header field if it performs content negotiation on the request headers.<\/p>\n\n\n\n
The server has fulfilled the request but does not need to return an entity-body and might want to return updated metainformation. There may be new or updated metainformation in the form of entity-headers, which if present, should be linked to the variant you requested.<\/p>\n\n\n\n
If the client is a user agent, it should not change its document view from that which caused the request to be sent. This response is mostly for people who want to be able to input actions that don’t change the user agent’s active document view. However, any new or updated metainformation should be applied to the document that is currently in the user agent’s active view.<\/p>\n\n\n\n
The 204 response MUST NOT include a message-body, and thus is always terminated by the first empty line after the header fields.<\/p>\n\n\n\n
The server has fulfilled the request, and the user agent should reset the document view that caused the request to be sent. This response is primarily intended to allow input for actions to take place via user input, followed by a clearing of the form in which the user input was given so that the user can easily initiate another input action. The response must not include an entity.<\/p>\n\n\n\n
The server is delivering only part of the resource (byte serving) due to a range header sent by the client. The range header is used by tools like wget to make it possible to download large files even on slow connections.<\/p>\n\n\n\n
The two most common status codes used by servers to indicate the range of a file are:<\/p>\n\n\n\n
When the server must return only part of the file, due to a range header sent by the client.<\/p>\n\n\n\n
416 Requested Range Not Satisfiable: When the client has requested a range of the file that the server cannot provide, due to the size of the file or the configuration of the server.<\/p>\n\n\n\n
The client needs to take additional action to complete the request. This class of status code indicates that further action needs to be taken by the user agent in order to fulfill the request. The action required MAY be carried out by the user agent without interaction with the user if and only if the method used in the second request is GET or HEAD. A client should be able to detect infinite redirection loops, since such loops generate network traffic for each redirection.<\/p>\n\n\n\n
Note: previous versions of this specification recommended a maximum of five redirections. Content developers should be aware that there might be clients that implement such a fixed limitation.<\/p>\n\n\n\n
It can be any one of a set of representations, each with a specific location, and agent-driven negotiation information (section 12) is being given so that the user (or user agent) can choose the representation that best fits their needs and send their request to that location.<\/p>\n\n\n\n
Responses to requests that are not HEAD should include a list of resource characteristics and locations from which the user or user agent can choose the one that is right for them.The entity format is specified by the media type given in the Content-Type header field. Depending on the format and the capabilities of the user agent, the best choice may be made for you.However, this specification does not define any standard for such automatic selection.<\/p>\n\n\n\n
If the server has a preferred choice of representation, it should include the specific URL for that representation in the Location field; user agents MAY use the Location field value for automatic redirection. This response is cacheable unless indicated otherwise.<\/p>\n\n\n\n
The requested resource has been assigned a new permanent URI and any future references to this resource should use one of the returned URIs. Clients with link-editing capabilities ought to automatically re-link references to the Request-URI to one or more of the new references returned by the server, where possible. This response is cacheable unless indicated otherwise.<\/p>\n\n\n\n
The new permanent URI should be given by the Location field in the response. Unless the request method was HEAD, the response entity SHOULD include a brief hypertext note with a hyperlink to the new URI(s).<\/p>\n\n\n\n
Requests other than GET or HEAD should not be automatically redirected by the user agent unless they can be confirmed by the user. This could change what conditions the user was in when the request was made, and this could be bad for the user.<\/p>\n\n\n\n
This response code means that the URI of the requested resource has been changed temporarily. Probably, the new URI would be given by the Location field in the response.<\/p>\n\n\n\n
This response code is probably the most famous one due to its frequent occurrence on the web. Some Web applications and frameworks use the 302 status code as an HTTP status code for their own redirect logic.<\/p>\n\n\n\n
The response to the request can be found under another URI using the GET method. When a POST (or PUT\/DELETE) message is sent, it should be assumed that the server has received the data and the redirect should be sent with a separate GET message.<\/p>\n\n\n\n
If the client has made a conditional GET request and access is allowed but the document has not been modified, the server should respond with this status code. The 304 response MUST NOT contain a message body and thus is always terminated by the first empty line after the header fields.<\/p>\n\n\n\n
The response MUST include the following header fields:<\/p>\n\n\n\n
date, unless its omission is required by section 14.18.1.<\/p>\n\n\n\n
If a clock less origin server obeys these rules, and proxies and clients add their own date to any response received without one, caches will operate correctly.<\/p>\n\n\n\n
The requested resource MUST be accessed through the proxy given by the Location field. The Location field gives the URI of the proxy. The recipient is expected to repeat this single request via the proxy. 305 responses must only be generated by origin servers.<\/p>\n\n\n\n
The 306 status code was used in a previous version of the specification, is no longer used, and the code is reserved.<\/p>\n\n\n\n
The requested resource temporarily resides under a different URI. Since the redirection might be altered on occasion, the client should continue to use the Request-URI for future requests. This response is only cacheable if indicated by a Cache-Control or Expires header field.<\/p>\n\n\n\n
The temporary URI should be given by the Location field in the response. Unless the request method was head, the response entity should include a brief hypertext note with a hyperlink to the new URI(s).<\/p>\n\n\n\n
307 is a status code for a request that isn’t GET or head. If the user agent receives this code, it should not automatically redirect the request unless they can confirm it with the user. This could change the conditions under which the request was made.<\/p>\n\n\n\n
The request, and all future requests, should be directed to the given URI.<\/p>\n\n\n\n
The permanent URI should be given by the Location field in the response. No matter what kind of request method was used, unless it was head, the response should have some text that says what new URIs have been added and links to them.<\/p>\n\n\n\n
This response is cacheable unless indicated otherwise.<\/p>\n\n\n\n
The 4xx class of status code is intended for cases in which the client seems to have erred. Only if the server is replying to a head request should the server include an entity that explains what happened and whether it is a temporary or long-term problem. These status codes are applicable to any request method. User agents should display any included entity to the user.<\/p>\n\n\n\n
The request could not be understood by the server due to malformed syntax. The client should not repeat the request without modifications.<\/p>\n\n\n\n
The request requires user authentication. The response must include a WWW-Authenticate header field containing a challenge applicable to the requested resource. The client MAY retry the request with a different authorization header field. If the request already included authorization credentials, then the 401 response indicates that authorization has been refused for those credentials. As long as the user agent has tried to authenticate at least once before getting this response, the user should be able to get in.<\/p>\n\n\n\n
The user should be presented with the entity that was given in the response since that entity may include relevant diagnostic information. HTTP access authentication is explained in “HTTP Authentication: Basic and Digest Access Authentication”<\/strong>.<\/p>\n\n\n\n This code is reserved for future use.<\/p>\n\n\n\n The server understood the request, but is refusing to fulfill it. Authorization will be ineffective, and the request SHOULD NOT BE REPEATED. If the request method was not head and the server wishes to make public why the request has not been fulfilled, it should describe the reason for the refusal in the entity. If the server does not wish to make this information available to the client, the status code 404 (Not Found) can be used instead.<\/p>\n\n\n\n The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent. The 410 (Gone) status code should be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address. This status code is used when the server doesn’t want to say why the request was turned down, or when there is no other way to respond.<\/p>\n\n\n\n The method specified in the Request-Line is not allowed for the resource identified by the Request-URI. The response must include an Allow header with a list of methods that can be used to get the resource.<\/p>\n\n\n\n The resource identified by the request is only capable of generating response entities that have content characteristics that are not acceptable according to the accepted headers sent in the request.<\/p>\n\n\n\n Unless the request was a head request, the response should include an entity containing a list of available entity characteristics and location(s) from which the user or user agent can select the most appropriate. The entity format is specified by the media type given in the Content-Type header field. The selection of the most appropriate choice may be performed automatically, depending on the format and capabilities of the user agent. However, this specification does not define any standard for such automatic selection.<\/p>\n\n\n\n This code is similar to 401 (Unauthorized), but indicates that the client must first authenticate itself with the proxy. The proxy MUST return a Proxy-Authenticate header field containing a challenge applicable to the proxy for the requested resource. The client MAY REPLY with a suitable Proxy-Authorization header field. HTTP access authentication is explained in “HTTP Authentication: Basic and Digest Access Authentication”<\/strong>.<\/p>\n\n\n\n The client did not produce a request within the time that the server was prepared to wait. The client may repeat the request without modifications at any later time.<\/p>\n\n\n\n The request could not be completed due to a conflict with the current state of the resource. This code is only allowed in situations where it is expected that the user might be able to resolve the conflict and resubmit the request. The response body should include enough information for the user to recognize the source of the conflict. Ideally, the response entity would include enough information for the user or user agent to fix the problem. However, that might not be possible and is not required.<\/p>\n\n\n\n Conflicts are most likely to occur in response to a PUT request. For example, if versioning were being used and the entity being PUT included changes to a resource that conflicted with those made by an earlier (third-party) request, the server might use the 409 response to indicate that it can’t complete the PUT at this time.<\/p>\n\n\n\n A 409 response is cacheable by default.<\/p>\n\n\n\n The requested resource is no longer available at the server, and no forwarding address is known. This condition should be considered permanent. Clients with link editing capabilities should delete references to the Request-URI after user approval. If the server does not know, or has no facility to determine, whether or not the condition is permanent, the status code 404 (Not Found) should be used instead. This response is cacheable by default.<\/p>\n\n\n\n The server refuses to accept the request without a defined content length. The client MAY repeat the request if it includes a valid Content-Length header field in the request message containing the length of the message body.<\/p>\n\n\n\n The precondition given in one or more of the request-header fields was evaluated as false when it was tested on the server. This response code lets the client set up rules for the current resource metainformation (header field data) so that the method can’t be used on a resource other than the one it was meant for.<\/p>\n\n\n\n The server is refusing to process a request because the request entity is larger than the server is willing or able to process. The server may close the connection to prevent the client from continuing the request.<\/p>\n\n\n\n If the condition is temporary, the server should include a Retry-After header field to indicate that it is temporary and after what time the client MAY try again.<\/p>\n\n\n\n The server is refusing to service the request because the Request-URI is longer than the server is willing to interpret. It’s very rare for this to happen, but it can happen when a client converts a POST request to a GET request with long query information, or when the client descends into a “URI black hole” of redirection (e.g., a redirected URI prefix that points to the end of itself).<\/p>\n\n\n\n The server isn’t going to serve the request because the request is in a format that isn’t supported by the requested resource for the method that the server wants.<\/p>\n\n\n\n A server should return a response with this status code if a request included a range request header field, and none of the range-specifier values in this field overlap the current extent of the selected resource, and the request did not include an if-range request header field. (For byte-ranges, this means that the first-byte-pos of all of the byte-range-spec values is greater than the current length of the selected resource.)<\/p>\n\n\n\n To get a byte-range request, you need to get this status code. The response should include a Content-Range entity-header field that tells you how many bytes you’ve chosen.This response MUST NOT use the multipart\/byterange content-type.<\/p>\n\n\n\n The expectation given in the Expect request-header field could not be met by this server, or, if the server is a proxy, the server has unambiguous evidence that the request could not be met by the next-hop server.<\/p>\n\n\n\n This code was defined in 1998 as one of the traditional IETF April Fools’ jokes in RFC 2324, Hyper Text Coffee Pot Control Protocol, and is not expected to be implemented by actual HTTP servers. The RFC specifies that this code should be returned by teapots requested to brew coffee. This HTTP status is used as an Easter egg on some websites, including Google.com.<\/p>\n\n\n\n Unofficial code<\/p>\n\n\n\n Unofficial code<\/p>\n\n\n\n Not part of the HTTP standard, but defined by Spring in the HttpStatus class to be used when a method fails. This status code is deprecated by Spring.<\/strong><\/p>\n<\/div><\/div>\n<\/div><\/div>\n\n\n\n The request was directed at a server that was not able to produce a response. (for example, because of connection reuse).<\/p>\n\n\n\n The request was well-formed but was unable to be followed due to semantic errors.<\/p>\n\n\n\n The resource that is being accessed is locked.<\/p>\n\n\n\n The request failed due to the failure of a previous request (e.g., a PROPPATCH).<\/p>\n\n\n\n The server does not want to risk executing a request that may be replayed.<\/p>\n\n\n\n The client should switch to a different protocol, such as TLS\/1.0, given in the Upgrade header field.<\/p>\n\n\n\n The origin server requires the request to be conditional. It is intended to prevent “the ‘lost update’ problem, where a client GETS a resource’s state, modifies it, and PUTs it back to the server, while in the meantime, a third party has modified the state on the server, leading to a conflict.”<\/p>\n\n\n\n The user has sent too many requests in a given amount of time. intended for use with rate-limiting schemes.<\/p>\n\n\n\n Rather than the 429 Too Many Requests response code, Shopify uses this one instead. When too many URLs are requested in a certain amount of time, this response code is used.<\/p>\n\n\n\n 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.<\/p>\n\n\n\n402 Payment Required<\/h2>\n\n\n\n
403 Forbidden<\/h2>\n\n\n\n
404 Not Found<\/h2>\n\n\n\n
405 Method Not Allowed<\/h2>\n\n\n\n
406 Not Acceptable<\/h2>\n\n\n\n
407 Proxy Authentication Required<\/h2>\n\n\n\n
408 Request Timeout<\/h2>\n\n\n\n
409 Conflict<\/h2>\n\n\n\n
410 Gone<\/h2>\n\n\n\n
411 Length Required<\/h2>\n\n\n\n
412 Precondition Failed<\/h2>\n\n\n\n
413 Request Entity Too Large<\/h2>\n\n\n\n
414 Request-URI Too Long<\/h2>\n\n\n\n
415 Unsupported Media Type<\/h2>\n\n\n\n
416 Requested Range Not Satisfiable<\/h2>\n\n\n\n
417 Expectation Failed<\/h2>\n\n\n\n
418 I’m a teapot ????<\/h2>\n\n\n\n
419 Authentication Timeout<\/h2>\n\n\n\n
420 Method Failure<\/h2>\n\n\n\n
421 Misdirected Request<\/h2>\n\n\n\n
422 Unprocessable Entity<\/h2>\n\n\n\n
423 Locked<\/h2>\n\n\n\n
424 Failed Dependency<\/h2>\n\n\n\n
425 Too Early<\/h2>\n\n\n\n
426 Upgrade Required<\/h2>\n\n\n\n
428 Precondition Required<\/h2>\n\n\n\n
429 Too Many Requests<\/h2>\n\n\n\n
430 Request Header Fields Too Large<\/h2>\n\n\n\n
431 Request Header Fields Too Large<\/h2>\n\n\n\n
451 Unavailable For Legal Reasons<\/h2>\n\n\n\n