HTTP response status codes are used to communicate the result of a server’s attempt to process a request. These codes are categorized into five classes based on the first digit of the code. Here’s a breakdown of each category and the meaning of common status codes:
Table of Contents
1xx: Informational Responses – Response Status Codes
These status codes indicate that the request has been received and the process is continuing. They are rarely seen in normal use, but they do have a purpose in certain protocols.
- 100 Continue
The server has received the request headers, and the client should proceed to send the request body. - 101 Switching Protocols
The server is switching protocols as requested by the client (e.g., upgrading from HTTP/1.1 to WebSocket). - 102 Processing (WebDAV)
The server is processing the request but has not yet completed it.
2xx: Successful Responses
These codes indicate that the request has been successfully received, understood, and processed by the server.
- 200 OK
The request was successful, and the server returned the requested data (for GET) or confirmed the request (for POST, PUT, DELETE, etc.). - 201 Created
The request was successful and resulted in the creation of a new resource (typically used with POST requests). - 202 Accepted
The request has been accepted for processing, but the processing has not been completed. This doesn’t guarantee that the request will be completed. - 204 No Content
The request was successful, but there is no content to return. Often used for DELETE requests. - 205 Reset Content
The server has fulfilled the request and the client should reset the document view. - 206 Partial Content
The server is sending only part of the resource, typically used for partial downloads (e.g., with theRange
header).
3xx: Redirection Response Status Codes
These codes indicate that further action is needed by the client to complete the request, often because the requested resource has moved.
- 300 Multiple Choices
The request has more than one possible response. The client can choose which resource to follow. - 301 Moved Permanently
The resource has permanently moved to a new URL. The client should use the new URL in future requests. - 302 Found (Previously “Moved Temporarily”)
The resource has been temporarily moved to a different URL. The client should continue to use the original URL for future requests. - 303 See Other
The response to the request can be found under a different URL, using the GET method. - 304 Not Modified
The resource has not been modified since the last request. The client can use the cached version of the resource. - 307 Temporary Redirect
The resource is temporarily located at a different URL, but future requests should still use the original URL. - 308 Permanent Redirect
The resource has been permanently moved to a new URL, and future requests should use this URL.
4xx: Client Error Response Status Codes
These status codes indicate that there was a problem with the request made by the client (the user or the client application).
- 400 Bad Request
The server cannot process the request because of malformed syntax or invalid data. - 401 Unauthorized
The request lacks proper authentication credentials (e.g., missing or invalid API key, token, or login credentials). - 402 Payment Required
This code is reserved for future use; however, it may be used for payment-related issues. - 403 Forbidden
The server understood the request but refuses to authorize it. This is different from401
(Unauthorized) because it indicates that authentication was successful, but the server denies access. - 404 Not Found
The server cannot find the requested resource. The URL may be incorrect, or the resource does not exist. - 405 Method Not Allowed
The HTTP method used is not allowed for the resource (e.g., trying to POST to a read-only resource). - 406 Not Acceptable
The server cannot generate a response that is acceptable according to theAccept
headers sent in the request. - 407 Proxy Authentication Required
The client must authenticate with a proxy server before making the request. - 408 Request Timeout
The server timed out waiting for the request from the client. This can happen when the client takes too long to send data. - 409 Conflict
The request could not be completed due to a conflict with the current state of the resource (e.g., attempting to create a duplicate resource). - 410 Gone
The resource is no longer available and has been permanently removed from the server. - 411 Length Required
The request did not specify theContent-Length
header, which is required by the server. - 412 Precondition Failed
One of the conditions in theIf-*
headers (e.g.,If-Match
,If-None-Match
) failed. - 413 Payload Too Large
The request entity is larger than the server is willing or able to process (e.g., uploading a very large file). - 414 URI Too Long
The URL requested by the client is too long for the server to process. - 415 Unsupported Media Type
The server cannot process the request because the content type is not supported. - 416 Range Not Satisfiable
The server cannot fulfill the range request (e.g., requested byte range is beyond the file size). - 417 Expectation Failed
The server cannot meet the expectations specified in theExpect
header. - 418 I’m a teapot
This is a joke status code defined in the Hyper Text Coffee Pot Control Protocol (RFC 2324). It’s not used in real-world applications. - 422 Unprocessable Entity (WebDAV)
The server understands the content type of the request entity, but it is unable to process the contained instructions (e.g., semantic errors). - 429 Too Many Requests
The user has sent too many requests in a given amount of time (“rate limiting”).
5xx: Server Error Responses
These status codes indicate that the server failed to fulfill a valid request.
- 500 Internal Server Error
A generic error message when the server encounters an unexpected condition that prevents it from fulfilling the request. - 501 Not Implemented
The server does not support the functionality required to fulfill the request (e.g., the server does not support the HTTP method). - 502 Bad Gateway
The server received an invalid response from an upstream server while processing the request (typically in a proxy or gateway setup). - 503 Service Unavailable
The server is temporarily unable to handle the request (e.g., due to being overloaded or down for maintenance). - 504 Gateway Timeout
The server did not receive a timely response from an upstream server or some other auxiliary server. - 505 HTTP Version Not Supported
The server does not support the HTTP protocol version that was used in the request. - 507 Insufficient Storage (WebDAV)
The server is unable to store the representation needed to complete the request. - 510 Not Extended
The server requires further extensions to fulfill the request.
Summary of Key Status Codes
Status Code | Description |
---|---|
200 OK | Request succeeded, data returned. |
301 Moved Permanently | Resource has moved permanently. |
302 Found | Resource temporarily moved. |
400 Bad Request | Malformed request. |
401 Unauthorized | Authentication required. |
403 Forbidden | Access denied. |
404 Not Found | Resource not found. |
500 Internal Server Error | Server error, something went wrong. |
502 Bad Gateway | Invalid response from upstream server. |
503 Service Unavailable | Server temporarily down or overloaded. |
These status codes give a lot of insight into what is going on with an HTTP request and response, helping developers debug and manage server-client communication efficiently. You can test your APIs by using Postman, HTTPie, Hoppscotch
Other Keywords
[…] Understanding Response Status Codes :A complete guide […]
[…] Understanding Response Status Codes :A complete guide […]
[…] Understanding Response Status Codes :A complete guide […]