HomeGuides › API testing

API testing: the complete guide

By the Flasqo team · Updated 24 August 2026

In short

API testing verifies that an interface returns the right data, status codes and errors under both expected and unexpected conditions. This guide covers the ten types that matter, how to test an endpoint properly, what to assert on, and the tooling landscape.

  • API testing verifies an API returns the correct data, status codes and errors under normal and abnormal conditions — by calling the endpoint directly over HTTP rather than driving a user interface.
  • There are ten types that matter: functional, smoke, integration, regression, load, stress, security, fuzz, contract and chaos testing.
  • API tests run in milliseconds rather than seconds, don't break when the UI changes, and are the easiest layer of the test pyramid to automate.
  • The historical bottleneck was writing the cases by hand. Generating them from the endpoint shape removes most of that cost.

What is API testing?

API testing is the practice of sending requests directly to an application's endpoints and asserting on what comes back — the status code, the response body, the headers and the time it took. Because it bypasses the user interface entirely, an API test talks to the same surface your mobile app, your web front end and your partners' integrations talk to.

That distinction is what makes it valuable. A UI test that clicks through a checkout flow might take 30 seconds and break because a button moved four pixels. The API test behind the same flow takes 40 milliseconds and only fails when the behaviour genuinely changed.

The one-sentence definition: API testing verifies that an interface returns the right data, the right status code and the right errors — under both the conditions you expect and the conditions you don't.

Why API testing matters more than it used to

Modern applications are assemblies of services rather than single programs. A single page view can fan out into a dozen internal API calls, and each one is a place where a contract can quietly break. Postman's State of the API research has reported that the large majority of surveyed teams now describe themselves as working API-first — the interface is designed before the implementation, which makes the interface the thing most worth testing.

The economics also favour it. API tests sit in the sweet spot of the test pyramid: broader in scope than unit tests, so they catch integration defects, but far faster and more stable than end-to-end UI tests. A suite of several hundred API tests can run in the time a handful of browser tests take to start up.

The ten types of API testing

"API testing" is an umbrella. These are the disciplines underneath it, roughly in the order most teams adopt them.

TypeQuestion it answersWhen to run it
FunctionalDoes this endpoint return the right thing?Every commit
SmokeIs the deployment alive at all?After every deploy
IntegrationDo these endpoints work together as a workflow?On merge
RegressionDid this change break something that used to work?On merge
Load & performanceDoes it stay fast under expected traffic?Nightly / pre-release
Stress & spikeWhere does it break, and how?Pre-release
SecurityCan someone access what they shouldn't?Continuously
FuzzWhat happens with malformed input?Nightly
ContractWill this change break a consumer?Every commit
ChaosDoes it degrade gracefully when dependencies fail?Scheduled experiments

Functional testing

The foundation. For each endpoint, confirm the happy path returns the expected status and body, then confirm the failure paths return sensible errors. A well-covered endpoint typically needs one happy path, two to four edge cases, two to three negative cases and one or two security probes — roughly 6 to 10 assertions.

Smoke testing

A shallow, fast pass over the endpoints that would halt the business if broken: authentication, the primary read path, checkout or payment. If a smoke suite takes longer than about five minutes, it has stopped being a smoke test.

Integration and regression testing

Integration tests chain endpoints into a real workflow — register, log in, create, pay, fetch receipt — carrying state between steps. Regression tests re-run a saved baseline and diff the responses, which is how you catch the field that silently changed type three releases ago.

Performance testing

Four distinct shapes, often conflated: load holds expected traffic steady, stress pushes past it to find the breaking point, spike jumps instantly from low to very high, and endurance holds moderate traffic for hours to surface memory leaks. Report p95 and p99 latency rather than averages — see the load testing guide for why averages hide exactly the failures users notice.

Security and fuzz testing

Security testing asserts on what the API must refuse to do. The OWASP API Security Top 10 is the standard reference, and Broken Object Level Authorization — changing an ID in a URL and receiving another user's data — has headed every edition of that list. Fuzz testing attacks the same surface from a different angle, sending malformed and unexpected input to find the validation gaps that produce 500s instead of 400s.

Contract and chaos testing

Contract tests assert on the whole response schema rather than the two fields a given test happens to read, which is why they catch drift that integration tests sail past. Chaos tests inject latency and failure to prove your timeouts, retries and circuit breakers actually work.

How to test an API, step by step

  1. Map the surface. Start from an OpenAPI or Swagger document if one exists — it declares every path, method, parameter and response code, which is most of what a test case needs. If there is no spec, discovery can probe conventional paths and infer schemas from live responses.
  2. Handle authentication. Most meaningful endpoints sit behind a Bearer token, API key or Basic auth. Use a dedicated least-privilege test account and inject its credentials as a secret rather than committing them.
  3. Write the happy path. One valid request per endpoint, asserting status code, response schema and latency.
  4. Add the unhappy paths. Missing required fields, wrong types, out-of-range values, absent credentials, valid credentials without permission. This is where most real defects live, and where most hand-written suites are thinnest.
  5. Chain the workflows. Extract the token from login, the ID from create, and feed them forward. Hard-coded IDs are the most common source of flaky API tests.
  6. Wire it into CI. Functional and contract tests on every pull request, regression on merge, smoke after deploy, and performance on a schedule. See the CI/CD guide for the full staging.

What to assert on

A test that only checks status === 200 will pass while the API returns an empty body, the wrong shape, or someone else's data. Assert on four layers:

The tooling landscape

Tools cluster into four groups, and most teams end up using one from each:

The trade-off is consistent: the more control a tool gives you, the more of the test-writing labour it leaves with you. That labour, not licensing, is the dominant cost of API testing for most teams.

Common mistakes

Generate a full API test suite in minutes

Paste a URL. Flasqo discovers your endpoints, generates the suite and runs it — free, no credit card.

Start testing free

Frequently asked questions

What is API testing?

API testing verifies that an application programming interface returns the right data, status codes and errors under both normal and abnormal conditions. Unlike UI testing it talks straight to the endpoint over HTTP, so it runs in milliseconds rather than seconds and does not break when a button moves.

What are the main types of API testing?

Ten types cover almost every real requirement: functional, smoke, integration, regression, load and performance, stress, security, fuzz, contract and chaos testing. Most teams start with functional and smoke, then add regression and load once the API is in production.

What is the difference between API testing and unit testing?

Unit tests exercise a single function in isolation with everything else mocked. API tests call the deployed endpoint over the network and exercise routing, serialisation, authentication, middleware and the database together. A service can have 100% unit coverage and still return 500s on every request.

How many test cases does an API endpoint need?

A useful baseline is one happy path, two to four edge cases, two to three negative cases and one or two security probes per endpoint — roughly 6 to 10 cases. Flasqo generates 10 to 100 per endpoint depending on how many parameters and response branches it detects.

Can API testing be fully automated?

Yes. API tests are deterministic, headless and fast, which makes them the easiest layer of the test pyramid to automate. The historical bottleneck was writing the cases by hand; AI generation removes most of that work by deriving cases from the endpoint shape and schema.

Related reading

API Test Automation: A Suite That Runs Itself API Security Testing: The OWASP Top 10 Guide API Testing in CI/CD: Gate Every Deploy OpenAPI & Swagger Testing: Generate Tests From Your Spec API Load Testing: Load, Stress, Spike & Endurance API Chaos Testing: Resilience Testing With Fault Injection 9 Best Postman Alternatives in 2026 Flasqo vs Postman Flasqo vs Insomnia Flasqo vs Bruno