What Is API Testing? A Beginner’s Guide with Real-Life Examples
Every time you pay with UPI, track a Swiggy order or check the weather on your phone, dozens of APIs talk to each other behind the screen. If one of them sends wrong data, the app breaks, even when the screen looks perfect. In this lesson you will learn what API testing is, why companies depend on it, what exactly a tester checks, and you will send your first real API request on a free practice API.
What is an API? (The Restaurant Waiter Example)
API stands for Application Programming Interface. It is a contract that lets one piece of software ask another piece of software for data or for an action, using a fixed set of rules.
Map that to software:
| Restaurant | Software world | Example |
|---|---|---|
| Customer | Client (mobile app, browser, another service) | Swiggy app on your phone |
| Waiter | API | POST /orders |
| Kitchen | Server, database, business logic | Order service + restaurant system |
| Menu | API documentation (Swagger / OpenAPI) | List of endpoints and fields |
| Your order slip | Request (method, URL, headers, body) | JSON with item ids and address |
| The dish or “item finished” | Response (status code + body) | 201 Created or 409 Conflict |
What Is API Testing?
API testing means acting like the client: you send requests to the API and verify that every response is correct. You are not clicking buttons. You are checking the layer that every button eventually calls.
When you test an API you ask questions like:
- Does
GET /users/1return200 OKand the right user? - Does
GET /users/999return404 Not Foundwith a clear error message, not a500crash? - Does creating an order with a negative quantity get rejected?
- Can a user without permission delete someone else’s data?
- Does the API answer in under 500 ms when 1,000 users call it together?
Why API Testing Is So Important
Modern applications are built as many small services talking over APIs. A single Flipkart checkout can call the cart service, pricing service, coupon service, payment gateway, inventory and delivery partner APIs. The UI is just a thin layer on top.
| Factor | UI testing | API testing |
|---|---|---|
| Speed | Seconds per test (browser must load) | Milliseconds per test |
| Stability | Breaks when locators or layout change | Stable as long as the contract stays the same |
| When you can start | Only after the UI is built | As soon as the endpoint exists (even before UI) |
| Coverage | Limited to what the screen allows | Every field, every error, every role |
| Bug location | “Something is wrong on the checkout page” | “POST /orders returns total 0 when coupon is 100%” |
| Cost of maintenance | High | Low |
Because of this, API testing is one of the most requested skills in QA job descriptions in 2026, for both manual testers and automation engineers.
Real-Life Example: Testing a Food Delivery Order API
Imagine you are the tester for a food delivery app. The developer tells you the new endpoint POST /orders is ready, but the UI will take another two weeks. With API testing you do not wait. You test it today.
- Happy path: send a valid order with 2 items. Expect
201 Created, an order id, the correct total and status"placed". - Calculation check: 2 x Rs 799 + 1 x Rs 349 = Rs 1,947. Add 18% tax and the total must be Rs 2,297.46. (This exact order exists on the practice API as
GET /orders/5001.) - Negative tests: quantity 0, unknown item id, missing address. Each should return
400or422with a clear message. - Security: call without a login token (expect
401), call with another customer’s token for this order (expect403or404). - Performance: response time under the agreed SLA, for example 800 ms.
By the time the UI arrives, the business logic is already proven. UI testers only need to check that the screen shows what the API returns.
What Do You Check in API Testing?
| What to verify | Example check | Why it matters |
|---|---|---|
| Status code | 201 after create, 404 for missing id | Clients decide what to do based on it |
| Response body values | name is “Asha Verma”, total is 2297.46 | Wrong data = wrong screen or wrong bill |
| Schema / structure | Every user has id (integer), email (string) | Missing fields crash mobile apps |
| Headers | Content-Type: application/json, Location | Caching, security and parsing depend on them |
| Error handling | Bad input gives 422 with field errors, not 500 | Users must see helpful messages |
| Authentication and authorization | No token = 401, wrong role = 403 | Prevents data leaks |
| Performance | Response under 500 ms; rate limit gives 429 | Slow APIs make slow apps |
| Data persistence | After POST, a GET returns the same data | Proves the database really changed |
You will learn each of these in detail in the next lessons, especially HTTP status codes and HTTP headers.
Your First API Test in 3 Ways
SQA Tools gives you a free practice REST API with no sign-up. Its base URL is https://sqatools.in/wp-json/sqa-api/v1. Let’s fetch user number 1.
1. In the browser (press Send request)
https://sqatools.in/wp-json/sqa-api/v1/users/1curl -i \
"https://sqatools.in/wp-json/sqa-api/v1/users/1"You should see 200 OK and a JSON body with "name": "Asha Verma", "role": "admin" and "city": "Pune". This data is hardcoded, so the response is always the same, which makes it perfect for practising assertions.
2. In Postman (manual testing)
- Open Postman and click New → HTTP Request.
- Keep the method as GET and paste
https://sqatools.in/wp-json/sqa-api/v1/users/1. - Click Send. Check the status (200), time (ms) and body.
- Now change the id to
999and send again. You get404with the message “User 999 does not exist. Valid ids are 1 to 12.” That is your first negative test.
3. With Playwright and TypeScript (automation)
import { test, expect } from '@playwright/test';
const BASE = 'https://sqatools.in/wp-json/sqa-api/v1';
test('GET /users/1 returns Asha Verma', async ({ request }) => {
const response = await request.get(`${BASE}/users/1`);
expect(response.status()).toBe(200);
expect(response.headers()['content-type']).toContain('application/json');
const body = await response.json();
expect(body.data).toMatchObject({ id: 1, name: 'Asha Verma', role: 'admin', city: 'Pune' });
});
test('GET /users/999 returns 404 with a clear message', async ({ request }) => {
const response = await request.get(`${BASE}/users/999`);
expect(response.status()).toBe(404);
const body = await response.json();
expect(body.error.code).toBe('not_found');
});
Run it with npx playwright test. No browser opens: Playwright’s request fixture sends pure HTTP calls. You will build full frameworks with this later in the course, and you can already read Playwright API testing basics.
Manual vs Automated API Testing
| Manual API testing | Automated API testing | |
|---|---|---|
| Tools | Postman, SoapUI, cURL, Swagger UI | Playwright, REST Assured, pytest + requests, Newman |
| Best for | Exploring a new endpoint, quick checks, bug reproduction | Regression, CI/CD pipelines, data-driven and load tests |
| Skill needed | HTTP basics, JSON, test design | All of that plus a programming language |
| Speed at scale | Slow for 500 test cases | 500 tests in under a minute |
Real teams use both. A tester explores the new endpoint manually in Postman, writes the test cases, then automates the stable ones so they run on every code change.
Popular API Testing Tools in 2026
- Postman: the most popular GUI tool for manual and scripted REST testing; Newman runs collections in CI.
- SoapUI / ReadyAPI: strong for SOAP web services (WSDL) and also supports REST.
- Playwright (TypeScript): one framework for both UI and API automation; fast, parallel and great reports.
- REST Assured: Java library popular in Selenium + Java teams.
- cURL: command-line tool available everywhere; developers often share bugs as cURL commands.
- JMeter and k6: load and performance testing of APIs.
- Swagger UI: interactive documentation where you can try endpoints in the browser.
Common Bugs Found by API Testing
- Wrong status codes, such as
200 OKwith an error message inside the body, or500for simple invalid input. - Missing validation: negative prices, ages of 500, emails without “@” accepted.
- Calculation errors in totals, tax, discounts or currency rounding.
- Broken authorization: user A can read or change user B’s orders by changing the id in the URL (called BOLA/IDOR, the number one API security risk).
- Sensitive data leaks, such as password hashes or internal ids in the response.
- Pagination bugs: the last page repeats records or skips one.
- Slow responses or no rate limiting.
- Contract breaks: a field renamed from
user_nametousernamewithout telling the mobile team.
How to Start Learning API Testing (Roadmap)
- Understand how an API works: request, response, endpoint.
- Learn HTTP methods and status codes.
- Learn JSON and headers.
- Practise manually with Postman and cURL on the SQA Tools practice API (141 ready scenarios).
- Learn authentication: Basic, API key, Bearer JWT.
- Automate with Playwright and TypeScript, then build the 5 projects in this course.
- Use AI to generate test cases and code faster, and prepare with the interview questions.
API Testing Interview Questions
What is API testing?
API testing is a type of software testing that validates an application’s APIs directly by sending requests and verifying responses: status code, body data, schema, headers, performance, security and error handling, without using the user interface.
Why is API testing preferred over UI testing?
API tests are faster, more stable, can start before the UI is ready, cover more combinations of data and roles, and point to the exact failing service. UI tests are still needed to check the user experience, but most business logic should be covered at the API level.
What is the difference between an API and a web service?
Every web service is an API that works over a network (usually HTTP), but not every API is a web service. For example, a Java library or an operating system interface is an API but not a web service. SOAP and REST services are web services.
What do you verify in an API response?
The status code, response body values, JSON schema (field names and data types), headers such as Content-Type and Location, response time, error messages for invalid input, and that the change is actually saved by calling a GET afterwards.
Can you do API testing without the UI being ready?
Yes. That is one of the biggest benefits. Using the API documentation (Swagger/OpenAPI) you can test endpoints as soon as developers deploy them, which is a key part of shift-left testing.
Which tools have you used for API testing?
A good answer names one manual and one automation tool and how you used them, for example: “Postman for exploring and collections run with Newman in CI, and Playwright with TypeScript for automated regression of 300 API tests in GitHub Actions.”
What are common bugs found in API testing?
Wrong status codes, missing input validation, calculation errors, broken authorization (accessing another user’s data), sensitive data in responses, pagination errors, poor performance and unannounced contract changes.
What is the test pyramid and where do API tests fit?
The test pyramid recommends many fast unit tests at the base, a good number of API/service tests in the middle and a small number of UI end-to-end tests at the top. API tests give the best balance of speed and business coverage.
What is an endpoint?
An endpoint is a specific URL plus HTTP method where an API accepts requests, for example GET https://sqatools.in/wp-json/sqa-api/v1/users/1. The base URL is shared, and each endpoint represents one resource or action.
How would you test a login API?
Valid credentials return 200 and a token; wrong password and unknown user return 401 with the same generic message; missing fields return 400 or 422; the token works on a protected endpoint and expires as configured; repeated failures are rate limited; and the password never appears in responses or logs.