API status codes are the HTTP codes which is received as part of response when an API call is requested to backend server or an API gateway.
What are the various types of API status codes?
The API status codes are broadly categorized under 5 types based on the numeric series of codes. These types are:
Here, XX represents any number between 00 to 99.
Let us go through each code series in detail…
1. 1XX status codes
This series of status codes are also known as Informational codes. This code means that the server has acknowledged the API request and is processing the request.
2. 2XX status codes
This series of status codes are also known as Success status codes. These codes are returned by the server when the server has successfully received, understood and processed the API request. Mostly used to return success responses when some data is correctly returned by the server.
3. 3XX status codes
This series of status codes are also known as Redirection status codes. If the server responds back with any of these codes e.g. 302, 301, etc; it denotes that the server has received the request, but the request is further redirected to somewhere else.
4. 4xx status codes
This series of status codes are also known as User or Client error codes. If the server responds with such codes, it denotes that there is some mistake in the request URL or data being passed by the User. For. e.g error 404 indicates the requested sub-URL is not found on server, which denotes that user is trying to hit a URL which doesn’t exist at all. Similarly error 402 is usually returned when the user makes mistake while passing the parameters in request body or request headers.
5. 5XX status codes
This series of status codes are also known as Server error codes. If a server responds with any of these codes, it means that there is some server side issue. The user or client made a correct request, but it errored out at the server backend. Possibly some server exception was thrown due to Null pointer exception, data issue or due to unavailability of any downstream APIs, etc.
If you liked this tutorial, consider sharing among your networks.
Fully customizable CRM Software for Freelancers and Small Businesses