In our last lesson, we examined the structure of an HTTP response, noting that the very first piece of information a server sends back is the status line, containing a critical three-digit status code. This code is the server's immediate verdict on the request you sent. For a QA engineer, this is the first and most fundamental piece of feedback to validate in any API test.
Today, we will dive deep into the world of these status codes. You'll learn to interpret the full range of responses, from a successful 200 OK to a critical 500 Internal Server Error. Understanding what each category of code signifies is essential for diagnosing issues, writing meaningful test assertions, and communicating effectively with development teams.
By the end of this lesson, you will be able to interpret the common HTTP status codes across all five major categories (1xx, 2xx, 3xx, 4xx, and 5xx) and understand their implications in API testing.
The Five Categories of Status Codes
HTTP status codes are not random; they are organized into five distinct classes, identified by their first digit. This classification gives you an immediate high-level understanding of the response before you even look at the specific code.
To get a quick and engaging overview of these categories, let's start with a short video.
HTTP Status Codes Explained In 5 Minutes
This video from ByteByteGo provides a fast-paced, well-animated explanation of the most common status codes and what they mean in practice.
Watch the entire video from the beginning to the end. It will introduce you to the 2xx, 4xx, 5xx, 3xx, and 1xx series with helpful analogies.
As you saw, each series has a specific role:
- 1xx (Informational): The request was received and the process is continuing.
- 2xx (Success): The request was successfully received, understood, and accepted.
- 3xx (Redirection): Further action needs to be taken by the client to complete the request.
- 4xx (Client Error): The request contains bad syntax or cannot be fulfilled.
- 5xx (Server Error): The server failed to fulfill an apparently valid request.
The image below provides a useful cheat sheet that organizes many of the common codes you'll encounter.

Now, let's explore the most important codes for a test engineer within each category. The following video uses Postman, a tool you're already familiar with, to demonstrate how these responses look in a real testing environment.
Common HTTP or REST request status codes
The "Common HTTP or REST request status codes" video from the qavbox channel is particularly useful because it demonstrates status codes directly within Postman, linking theory to the practical work of API testing.
As we go through the categories below, you'll be asked to watch specific segments of this video. For now, watch the introduction from the beginning to get an overview of how the presenter categorizes the codes.
2xx Success: The "Everything Worked" Codes
This is the category you want to see most often in your tests. A 2xx code confirms that the API successfully performed the action requested.
200 OK: The standard response for a successful HTTP request. You'll typically assert for a200on successfulGET,PUT, orPATCHrequests.201 Created: This specifically indicates that the request was successful and resulted in the creation of a new resource. It's the expected response for aPOSTrequest that creates a new entity (e.g., a new user or a new order). The response body usually contains a representation of the new resource, and theLocationheader often points to its URL.204 No Content: This code means the server successfully processed the request but has no content to send back in the response body. This is a common and correct response for aDELETErequest. Your test should assert for the204status code and also verify that the response body is empty.
Watch this segment of the qavbox video to see these success codes in action.
Common HTTP or REST request status codes
This part of the video demonstrates successful GET and POST requests in Postman.
Please watch from 02:52 to 06:05. Observe how a GET request returns a 200 OK and a POST request returns a 201 Created.
4xx Client Error: The "You Made a Mistake" Codes
When you receive a 4xx error, the server is telling you that the problem lies with the request you sent. As a QA engineer, this is your cue to investigate the request data, headers, or URL. This is rarely a server-side bug.
400 Bad Request: The generic "catch-all" client error. It means the server couldn't understand the request due to malformed syntax, an invalid request message, etc. For example, sending a JSON body with a missing quote or a required field left empty might trigger a400.401 Unauthorized: The request lacks valid authentication credentials. This means you either didn't provide credentials (like an API key or token) or the ones you provided were incorrect or expired.403 Forbidden: The server understood the request, but refuses to authorize it. This is different from401. With a403, the server knows who you are (you're authenticated), but your user level does not have permission to access the resource. For example, a regular user trying to access an admin-only endpoint.404 Not Found: The server cannot find the requested resource. This is one of the most famous codes. It could mean a typo in the URL or you're requesting a resource that doesn't exist (e.g.,/users/99999where user 99999 has been deleted).
Let's see how these client errors manifest in Postman.
Common HTTP or REST request status codes
This segment shows examples of 401 Unauthorized, 404 Not Found, and 405 Method Not Allowed.
Watch from 06:29 to 12:12. Pay attention to how an invalid bearer token causes a 401 and an incorrect endpoint leads to a 404.
5xx Server Error: The "We Made a Mistake" Codes
A 5xx error indicates that something went wrong on the server. The request appeared valid, but the server was unable to process it due to an internal issue. These codes almost always represent bugs that need to be logged and investigated by the development team.
500 Internal Server Error: A generic error message indicating an unexpected condition on the server. It's a server-side "catch-all" that often means an unhandled exception occurred in the application code. Your bug report should include the exact request that caused the500to help developers reproduce and debug it.503 Service Unavailable: The server is temporarily unable to handle the request. This could be due to it being overloaded with traffic or down for maintenance. It's a temporary condition, and the request can often be retried later.
This final clip from the video explains the nature of server-side errors.
Common HTTP or REST request status codes
This section discusses the 5xx series of errors.
Watch from 12:13 to 14:13 to understand why these errors are the server's responsibility.
3xx Redirection and 1xx Informational Codes
The remaining two categories are less common in day-to-day REST API testing but are still important to recognize.
- 3xx Redirection: These codes tell the client that the requested resource has moved. A
301 Moved Permanentlyindicates a permanent move, while a307 Temporary Redirectis for short-term moves. The response will include aLocationheader with the new URL. - 1xx Informational: These are transient responses indicating that the server has received the initial part of the request and the client should continue. You will rarely need to test for these directly.
For a comprehensive reference on all status codes, the following article is an excellent resource.
HTTP Status Codes - REST API Tutorial
This article from restfulapi.net provides a detailed list of status codes and, importantly, a section dedicated to how they are used specifically within REST APIs.
Skim through the tables for each category (1xx, 2xx, 3xx, 4xx, and 5xx) to familiarize yourself with the range of available codes. Then, focus your reading on the section REST Specific HTTP Status Codes, as it provides excellent context for the codes most relevant to your work.
Hands-On Practice with HttpBin
Now it's time to put this knowledge into practice. We'll use a service called HttpBin, which is a request and response service designed for testing. It has special endpoints that allow you to request a specific status code and receive it in the response. This is a perfect way to see these codes for yourself.
HttpBin - An Attp Request and Response Service - Practice HTTP
This page introduces HttpBin and provides exercises for practice. We'll be focusing on the status code exercise.
Read the introduction to understand what HttpBin is, then find the section titled Explore the Status Codes.
Using Postman, try sending GET requests to the following HttpBin URLs. Observe the status code, the reason phrase, and any body content that comes back.
https://httpbin.org/status/200https://httpbin.org/status/404https://httpbin.org/status/401https://httpbin.org/status/500
Try a few others on your own! Pick any code from the reference chart and see what HttpBin returns. This hands-on experimentation will solidify your understanding far better than just reading about them.
Conclusion
In this lesson, we demystified HTTP status codes and organized them into their five distinct classes. You now have the vocabulary to interpret an API's response and diagnose the outcome of a request at a glance.
Here are the key takeaways:
- Status codes are classified into five groups: 1xx (Informational), 2xx (Success), 3xx (Redirection), 4xx (Client Error), and 5xx (Server Error).
- 2xx codes mean success. Your tests for creating, reading, and updating data should expect codes like
200 OK,201 Created, or204 No Content. - 4xx codes indicate a client-side problem. When you see one, check your request URL, headers, and body before assuming it's a server bug.
400,401,403, and404are the most common. - 5xx codes indicate a server-side failure. These are almost always bugs that need to be reported to the development team.
500is the most common.
So far, we've covered the basic mechanics of HTTP: methods, request structure, and response structure. In our next lesson, we will build on this foundation to discuss the core architectural principles that define REST (Representational State Transfer), such as resources, endpoints, and statelessness. This will provide the conceptual framework for the API testing you will do with REST Assured.