HTTP Status Code
# HTTP Status Code
HTTP status codes are issued by the server to the client to indicate whether a specific HTTP request has been successfully completed.
We can find the full list of HTTP response codes here in MDN docs (opens new window). Below I've included the most commonly used ones.
# 100 Informational
# 100 Continue
You're good. Keep going.
Indicates that everything so far is OK and client should continue with whatever it was doing.
# 101 Switch protocols
Upgrade!
Indicates a protocol to which the server switches. Can be used to upgrade from HTTP to Websocket connection.
HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
# 200 Successful Responses
# 200 OK
Your request was a success! Here is the data you asked.
Indicates that the request has succeeded. A 200 response is cacheable by default. The resource has been fetched and is transmitted in the message body.
# 201 Created
We've created the item/record you provided us.
This is commonly used as a result of a POST
request.
# 202 Accepted
We got your request, but still working on it.
Indicates that the request has been accepted for processing, but the processing has not been completed; in fact, processing may not have started yet.
# 204 No content
Your request was a success but you can stay where you are.
This is commonly used for PUT
or DELETE
responses.
A 204 response is cacheable by default (an Etag
header is included in such a response).
# 300 Redirection
# 300 Multiple choices
We've got several responses for you. Pick one from them.
Indicates that the request has more than one possible response. The user-agent or the user should choose one of them. This is rarely used in practice though.
# 301 Moved permanently
Go here instead from now on.
Indicates that the requested resource has been definitely moved to the URL given by the Location
headers. A browser redirects to the new URL and search engines update their links to the resource.
# 302 Found
Go here temporarily.
Indicates that the resource requested has been temporarily moved to the URL given by the Location header. A browser redirects to this page but search engines don't update their links to the resource (in 'SEO-speak', it is said that the 'link-juice' is not sent to the new URL).
Only use 302 for GET
or HEAD
methods and use 307
Temporary redirect for the rest.
# 304 Not modified
Hey, you already have what you asked for. No need for us to send it again.
Indicates there is no need to retransmit the requested resources. It is an implicit redirection to a cached resource. The response will not contain a body.
# 307 Temporary redirect
We've temporarily moved here.
Indicates that the resource requested has been temporarily moved to the URL given by the Location headers.
# 308 Permanent redirect
We've definitely moved here for good.
# 400 Client Error
# 400 Bad Request
We don't understand your request.
Indicates that the server cannot and will not process the request due to something that is perceived to be a client error.
For example:
- malformed request syntax
- invalid request message framing
- deceptive request routing
# 401 Unauthorized
Hey, you don't have access to this.
Indicates that the client lacks valid authentication credentials for the requested resource.
# 403 Forbidden
Similar to 401
, except for 403
status code, re-authenticating makes no difference. The access is tied to the application logic, such as insufficient rights to a resource.
# 404 Not found
Oh... sorry we can't find what you asked for.
Indicates that the server cannot find the requested resource. This only indicates absence, if you want to indicate permanent absence, use 410
.
# 405 Method not allowed
We found the resource you asked but we can't perform the action you asked on it.
Indicates that the server know the request method, but the target resource doesn't support this method. The server will generate an Allow
header field in the response that contains a list of methods that the target resource currently supports.
# 408 Request timeout
Yo, talk to you later.
Indicates that the server wants to shut down this unused connection.
# 429 Too many requests
Woa..wow slow down there.
Indicates the user has sent too many requests in a given amount of time. It is commonly used as a response when the client is rate limited.
A Retry-After
header might be included to this response indicating how long to wait before making a new request.
# 500 Server Error
# 500 Internal server error
Something is wrong on our end.
Indicates that the server encountered an unexpected condition that prevented it from fulfilling the request. This is a generic catch-all response, used when the server cannot find a better 5xx error code to respond.
# 501 Not implemented
We don't support the method you provided.
Indicates that the server does not support the functionality required to fulfilled the request. For example, the server only handles GET
request and not POST
request.
# 502 Bad gateway
Something is wrong with the server I'm representing.
Indicates that the server, while acting as a gateway or proxy, received an invalid response from the upstream server.
# 503 Service unavailable
We are in maintenance, try again later.
Indicates that the server is not ready to handle the request. Either the server is down for maintenance or it's being overloaded at this point.