# The HTTP status code
Maybe the most important metadata which is sent in the head of the response is the HTTP status code.
For example, a 404 code to indicate that the resource does not exist, and a 200 code to state that the resource exists and that the requested data is returned in the response body.
The status codes can be divided into these groups:
The class of 2XX (200, 201, 204) indicates that the data was received and the operation was performed.
The class of 3XX (301, 302) redirects the request to another URL.
The class of 4XX (403, 404) indicates that the resource was is not found or not available to the client.
The class of 5XX (500) to indicate a server error.
The following table summarizes the 10 most common response codes that every developer should know:
Code |
Message |
Description |
200 |
OK |
The data was received and the operation was performed. |
201 |
Created |
The data was received and a new resource was created. The response needs to return the data in the payload. |
204 |
No content |
The operation was successful but no data is returned in the response body. This is useful when deleting a resource. |
301 |
Moved permanently |
This and all the future requests should be redirected to a new URL. |
302 |
Moved temporarily |
The resource moved temporarily to another URL. |
400 |
Bad request |
The server cannot accept the request because something is wrong with the client or the request that it sent. |
403 |
Forbidden |
The client is not allowed to use the resource. |
404 |
Not found |
The computer is not able to find the resource. |
405 |
Method not allowed |
For example, when sending a DELETE request to a server that doesn't support the method. |
500 |
Internal server error |
Service unavailable due to error on the server side. |
To see the complete list of status codes go to Github.