What Is API Testing? A Practical Guide with Examples and a Checklist (2026)

Test results dashboard showing response time, error rate and concurrent users, with a testing checklist

Quick answer

API testing checks that an application's APIs (the connections that let apps, services and databases talk to each other) return the right data, handle errors properly, stay fast and keep data secure. Instead of clicking through screens, you send requests directly to the API and check the responses. Because it skips the UI, API testing is faster and more stable than UI testing, and easy to automate in a CI/CD pipeline.

Key takeaways

  • Most business logic lives in APIs, so API tests catch bugs earlier and more cheaply than UI tests.
  • Check more than the status code: data, schema, business rules, errors, speed and permissions.
  • Always test the unhappy paths: missing fields, wrong data, expired tokens and other users' data.
  • Start with your most important endpoints, then automate them in your pipeline.
  • Use mocks for third-party services, so tests stay fast and don't depend on someone else's system.

What is API testing?

An API (application programming interface) is how one piece of software asks another for data or to do something. When a mobile app shows your order history, it calls an API. When a website takes a payment, it calls the payment gateway's API.

API testing sends requests directly to these APIs and checks the responses: is the data correct, is the error clear, is it fast enough, and can only the right people see it?

A worked example of an API test

Here is a simple example: a customer places an order with a coupon on an online store. The app sends this request:

POST /api/v1/orders
Authorization: Bearer <customer token>
Content-Type: application/json

{ "productId": "SKU-1042", "quantity": 2, "couponCode": "DIWALI10" }

The API should reply with something like this:

201 Created

{ "orderId": "ORD-58213", "status": "PENDING_PAYMENT",
  "subtotal": 1998, "discount": 199.8, "total": 1798.2, "currency": "INR" }

A good API test doesn't stop at "it returned 201". It checks all of these:

  1. The status code is 201 Created.
  2. The response arrives within the agreed time, for example under 500 ms.
  3. The response matches the agreed structure: every required field is there, with the right type.
  4. The maths is right: subtotal is price × quantity, the 10% coupon gives 199.8 off, and total = subtotal − discount.
  5. The currency is INR.
  6. The order really exists: a follow-up GET /orders/ORD-58213 returns the same data.
  7. Sending the same request twice with the same idempotency key does not create two orders.
  8. Without a token, the API returns 401 Unauthorized.
  9. Another customer's token cannot read this order (403 or 404).
  10. A quantity of 0 returns 400 or 422 with a clear error message.

In Postman, a few of these checks look like this:

pm.test("Status is 201", () => pm.response.to.have.status(201));
pm.test("Fast enough", () => pm.expect(pm.response.responseTime).to.be.below(500));
const order = pm.response.json();
pm.test("Total is correct", () => pm.expect(order.total).to.eql(order.subtotal - order.discount));

Why is API testing important?

  • Finds bugs earlier: APIs can be tested before the screens are built.
  • Faster and more stable than UI tests: no browser, no waiting for pages, fewer flaky tests.
  • Tests the real business logic: prices, discounts, stock, permissions and payments all live in APIs.
  • Covers every client at once: one API test protects the website, Android app and iOS app.
  • Catches security gaps: many serious flaws, such as seeing another user's data, are API problems.

What should you check in an API test?

What to checkWhat it meansExample
Status codeThe right code for the situation201 for a new order, 404 for a missing one
Response dataField values are correctOrder total matches price, quantity and discount
SchemaStructure and data types match the agreed contract"total" is a number, "orderId" is always present
Business rulesThe API follows the rules of your businessAn expired coupon is rejected
Error handlingBad requests get clear, safe error messagesNo stack traces or database errors in responses
AuthenticationOnly logged-in users or valid keys get inExpired token returns 401
AuthorisationUsers see only what they're allowed toCustomer A can't read Customer B's orders
PerformanceResponses are fast enough under normal load95% of calls under the agreed time
Side effectsThe right things happen in other systemsStock reduces; confirmation email is queued

What are the types of API testing?

TypeWhat it checksWhen to run it
FunctionalEach endpoint does what it should, with valid and invalid inputEvery build
ContractResponses match the agreed API specification, such as an OpenAPI fileEvery build, especially when teams work separately
IntegrationAPIs work together across services, databases and third partiesDaily or before release
RegressionOld endpoints still work after changesEvery build and before release
SecurityAuthentication, permissions, injection and data exposureBefore release and on a schedule
Performance and loadSpeed and stability under many requestsBefore launches and traffic peaks
End-to-endA full business flow across several APIsBefore release

For the security side, see our web app security testing checklist. For regression, read what regression testing is.

Which HTTP status codes should you test?

CodeMeaningTest that it appears when…
200OKA valid request reads or updates data
201CreatedA new record, such as an order, is created
204No contentA delete or update succeeds with no body
400Bad requestRequired fields are missing or the format is wrong
401UnauthorizedThere is no token, or it has expired
403ForbiddenThe user is logged in but not allowed to do this
404Not foundThe record doesn't exist (or is hidden from this user)
409ConflictThe request clashes with existing data, such as a duplicate
422UnprocessableThe data is well-formed but breaks a business rule
429Too many requestsRate limits are exceeded
500 / 503Server error / unavailableShould not appear in normal tests; if it does, it's a bug

How to test authentication and permissions

Many of the most serious API bugs are permission bugs. Test these on every important endpoint:

  • No token, an invalid token and an expired token are all rejected with 401.
  • Refresh tokens work, and logging out really ends the session.
  • A normal user can't call admin endpoints (403).
  • Changing an ID in the URL never returns another user's data.
  • API keys are not accepted in URLs, where they end up in logs.
  • Responses return only the fields the screen needs, not extra personal data.

How to handle test data and third-party services

  • Create your own test data at the start of each test run and clean it up afterwards, so tests don't depend on each other.
  • Never use real customer data in test environments; use realistic, made-up data.
  • Mock third-party services such as payment gateways, SMS and shipping, using tools like WireMock or Prism, so tests are fast and repeatable.
  • Use sandboxes for a smaller set of integration tests against the real provider.

How to run API tests in a CI/CD pipeline

API tests are fast, so they suit every stage of a pipeline:

Pipeline stageWhat to run
Every pull requestFunctional and contract tests for the changed services, with mocked third parties
After deploy to stagingFull API regression suite and key end-to-end flows
NightlyIntegration tests against sandboxes, security scans and a short performance test
Before releaseEverything above, plus a check that error and alert monitoring is in place

Postman collections can run in any pipeline with Newman, for example: newman run orders.postman_collection.json -e staging.postman_environment.json. See our guide to setting up a CI/CD pipeline.

Which tools are used for API testing?

ToolTypeGood for
Postman + NewmanGUI and CLIExploring APIs, building collections and running them in CI
REST AssuredJava libraryJava teams writing API tests in code
Playwright (API testing)JavaScript / TypeScriptTeams that already use Playwright for UI tests
KarateOpen source frameworkReadable API tests with little code
PactContract testingChecking that services and apps agree on the API contract
WireMock, PrismMockingSimulating third-party and unfinished APIs
k6, Apache JMeterPerformanceLoad and stress testing APIs
OWASP ZAP, Burp SuiteSecurityFinding security flaws in APIs

What metrics should you track?

  • API test coverage = endpoints with automated tests ÷ total endpoints × 100.
  • Pass rate per build: a sudden drop usually means a real regression.
  • p95 response time: the time within which 95% of requests complete.
  • Error rate = failed requests ÷ total requests × 100.
  • Defects found in production that an API test could have caught.

How to start API testing in one week

  1. Day 1: list your APIs and pick the 5–10 most important endpoints (login, orders, payments, core data).
  2. Day 2: get or write the API specification (for example an OpenAPI file) so everyone agrees on the contract.
  3. Day 3: build happy-path tests for each chosen endpoint.
  4. Day 4: add unhappy paths: missing fields, wrong data, no token, another user's data.
  5. Day 5: run the tests in your CI/CD pipeline on every pull request, and share the results with the team.

Then add more endpoints each sprint. If you're deciding what to automate first, see manual vs automated testing.

API testing in India: two things to check

  • Personal data: if your API handles personal data of people in India, the Digital Personal Data Protection (DPDP) Act applies. Test that APIs return only the personal data they need, and that consent and data deletion flows work. Check the details with your legal team.
  • Payment webhooks: UPI and card payments usually confirm through webhooks from the payment gateway. Test that webhook signatures are verified, duplicates are ignored and late webhooks don't change a completed order.

API testing checklist

#Check
1Every important endpoint has at least one happy-path test
2Required fields, data types and the response schema are checked
3Business rules are checked, such as totals, discounts and stock
4Missing, empty and wrong-format input returns 400 or 422 with clear errors
5Boundary values are tested, such as 0, the maximum and very long text
6No token, invalid token and expired token return 401
7Users can't access other users' data or admin endpoints
8Error responses don't reveal stack traces or database details
9Rate limits work and return 429
10Duplicate requests (idempotency) don't create duplicate records
11Pagination, sorting and filters return the right results
12Side effects happen: database updates, emails, stock changes
13Response times meet the agreed target
14Third-party services are mocked in fast tests
15Test data is created and cleaned up by the tests
16Contract tests run against the API specification
17Tests run automatically on every pull request
18Webhooks are verified, and duplicates are handled
19Only the personal data needed is returned
20Results and failures are reported to the team the same day

How INNOVISCENT can help

Our QA automation team in Mumbai and Ahmedabad builds API test suites with Postman, REST Assured and Playwright, adds contract and mock testing, and runs everything in your CI/CD pipeline. Our security testing team checks your APIs for authentication, permission and data exposure flaws.

For typical costs, see our software testing cost guide, or book a free 30-minute call.

Frequently Asked Questions

What is API testing in simple words?

API testing means sending requests directly to an application's APIs and checking that the responses are correct, fast, secure and handle errors properly, without using the app's screens.

What is an example of API testing?

Sending a request to create an order with a coupon, then checking that the API returns 201 Created, the right total after discount, the correct currency, and an error when no login token is sent.

What is the difference between API testing and UI testing?

UI testing checks the app through its screens, like a user would. API testing checks the layer underneath directly. API tests are faster and more stable, while UI tests confirm the user experience; most teams need both.

Which tools are used for API testing?

Common tools include Postman with Newman, REST Assured, Playwright's API testing, Karate, Pact for contract testing, WireMock or Prism for mocking, k6 or JMeter for performance, and OWASP ZAP or Burp Suite for security.

Can API testing be automated?

Yes. API tests are among the easiest to automate, and they can run in a CI/CD pipeline on every pull request and after every deployment.

What should be checked in an API test?

Check the status code, response data, schema, business rules, error handling, authentication, permissions, response time and any side effects in other systems.

Do I need to know coding for API testing?

Not to start. Tools like Postman let you send requests and write simple checks with very little code. For large, maintainable test suites, basic coding skills help.

Talk to an Automation Engineer, Not a Sales Script

We Build
Test Automation 

Tell us about your release process, back-office workload or device idea. In a free call we will point out what is worth automating first and how long it would take.

Get Free Consultation
Whatsapp Now