API Testing Interview Questions with Practical Answers
Experienced-level API testing interview questions with concise answers, practical reasoning, and realistic request and response examples.
In this guide
- 1.What is API testing, and what does it validate?
- 2.What REST concepts should a QA engineer understand?
- 3.How do GET, POST, PUT, PATCH, and DELETE differ?
- 4.Which HTTP status codes matter most in API testing?
- 5.What do you validate in headers, path parameters, and query parameters?
- 6.How do you validate an API response?
- 7.Authentication and authorization: what is the difference?
- 8.What is API chaining?
- 9.What is schema validation, and is it enough?
- 10.How do you design positive, negative, and boundary tests?
- 11.What is idempotency, and how would you test it?
- 12.How do you test pagination, filtering, and sorting?
- 13.How should rate limits, retries, and timeouts be tested?
- 14.How do you test API error handling and dependency failures?
- 15.When should a QA engineer validate the database?
- 16.How do Postman collections and environments support testing?
- 17.What makes an API automation strategy maintainable?
- 18.What security considerations should QA cover?
- 19.How do you approach API performance questions?
- 20.Give a realistic end-to-end API test scenario
Experienced API testing interviews assess how you reason about contracts, state, failure, security, and observability—not whether you can recite every status code.
Use these as answer frameworks. Adapt examples to systems you have genuinely tested, and be ready to explain your oracle, evidence, and trade-offs.
What is API testing, and what does it validate?
API testing verifies service behavior at the interface layer by sending requests and evaluating responses, state changes, integrations, and non-functional behavior against an agreed contract.
A useful answer goes beyond status codes. Validate the body and headers, authorization rules, persisted data, emitted events, dependency behavior, and whether failures are safe and observable.
What REST concepts should a QA engineer understand?
REST-style APIs expose resources through addresses, use HTTP methods to express intent, and commonly exchange representations such as JSON. Statelessness means each request carries the context needed to process it.
Resources are usually nouns such as /users/123 or /orders/42/items. The contract defines operations, formats, authentication, error behavior, and compatibility.
GET /api/users/123 HTTP/1.1
Accept: application/json
Authorization: Bearer <token>How do GET, POST, PUT, PATCH, and DELETE differ?
GET reads, POST commonly creates or starts processing, PUT replaces a resource representation, PATCH applies a partial change, and DELETE removes or deactivates according to the contract.
| Method | Typical intent | Important tests |
|---|---|---|
| GET | Read a resource or collection | Filters, pagination, cache headers, authorization |
| POST | Create or trigger an operation | Validation, duplicates, identifiers, side effects |
| PUT | Replace a known resource | Required fields, repeat requests, omitted fields |
| PATCH | Partially update | Only requested fields change; invalid transitions fail |
| DELETE | Remove or deactivate | Repeat behavior, dependencies, later reads |
Which HTTP status codes matter most in API testing?
Know the families and explain codes in context: 2xx success, 3xx redirection, 4xx request or permission problems, and 5xx server failures.
- 200 successful read or update
- 201 created, often with a Location header
- 204 success with no body
- 400 malformed or invalid request
- 401 missing or invalid authentication
- 403 authenticated but unauthorized
- 404 not found or intentionally concealed
- 409 state or uniqueness conflict
- 422 semantic validation where used
- 429 rate limit exceeded
- 500/502/503/504 server, gateway, or availability failure
Assert the documented code, error schema, absence of unsafe side effects, and a safe diagnostic signal—not a favorite code in isolation.
What do you validate in headers, path parameters, and query parameters?
Validate required and optional headers, media types, tracing or caching behavior, path identity, and supported query parameters—including invalid combinations.
- Missing, duplicate, malformed, and case-sensitive headers
- Encoded path values and unauthorized resource identifiers
- Repeated query keys, blanks, special characters, and defaults
- Filtering, sorting, and pagination combinations
How do you validate an API response?
Validate transport, schema, business meaning, consistency, and side effects. A response can match its schema and still be functionally wrong.
- Status, content type, headers, and response-time signal
- Required, optional, nullable, and additional fields
- Types, formats, ranges, enums, and cross-field rules
- Business values against controlled data
- Database, queue, or downstream side effects when observable
- No secrets or stack traces in errors
{
"id": "usr_123",
"status": "active",
"roles": ["candidate"]
}What is API chaining?
API chaining uses output from one request as input to a later request in the same business flow.
POST /api/orders -> capture orderId
GET /api/orders/{orderId} -> verify persisted order
POST /api/orders/{orderId}/pay -> capture payment statusKeep end-to-end chains focused. Most regression tests should create controlled state so one failure does not obscure every downstream assertion.
What is schema validation, and is it enough?
Schema validation checks structure, types, required fields, formats, enums, and additional-property rules. It is necessary but insufficient for business correctness.
A schema may allow any positive number while the business requires total = subtotal + tax. Combine contract assertions with targeted business rules.
How do you design positive, negative, and boundary tests?
Positive tests prove supported behavior. Negative tests challenge validation, permissions, and state. Boundary tests target values immediately around limits and transitions.
| Rule | Representative values | What to assert |
|---|---|---|
| Name length 1–80 | 0, 1, 80, 81 characters | Acceptance boundary and stable error |
| Quantity 1–100 | 0, 1, 100, 101; decimal; text | Type and range enforcement |
| State transition | draft→submitted; submitted→draft | Allowed succeeds; forbidden has no side effect |
What is idempotency, and how would you test it?
An idempotent operation produces the same intended server state when repeated. Some POST operations use an idempotency key to prevent duplicate processing.
How do you test pagination, filtering, and sorting?
Use controlled datasets that expose missing, duplicated, and misordered records across page boundaries.
- First, middle, last, empty, and beyond-range pages
- Page-size minimum, maximum, default, and invalid values
- Stable sort with a deterministic tie-breaker
- No duplicates or gaps across an unchanged dataset
- Filter combinations and URL encoding
- Cursor expiry or invalid cursor behavior
How should rate limits, retries, and timeouts be tested?
Verify the documented limit response and headers, ensure clients retry only safe operations, and confirm timeouts do not create unknown duplicate side effects.
Use bounded attempts and backoff. Avoid retrying permanent 4xx failures. Pair state-changing retries with idempotency or reconciliation.
How do you test API error handling and dependency failures?
Force known failure modes and validate safe status mapping, stable errors, observability, and absence of partial or corrupt state.
- Database unavailable or slow
- Downstream 4xx, 5xx, timeout, or malformed response
- Queue or event publication failure
- Partial failure after one step committed
- Unsupported media type or malformed JSON
{
"code": "ORDER_DEPENDENCY_UNAVAILABLE",
"message": "Order could not be completed",
"correlationId": "corr_8f31"
}When should a QA engineer validate the database?
Validate persistence when the database is part of the acceptance oracle and the environment allows safe, isolated access. Prefer public behavior when it fully proves the requirement.
Check values, relationships, uniqueness, audit fields, and rollback behavior. Avoid coupling every test to internal tables.
How do Postman collections and environments support testing?
Collections organize requests, examples, scripts, and flows. Environments separate values such as base URLs and non-secret identifiers.
Keep secrets outside exported collections, add clear assertions, and run stable collections through the CLI in CI. Collection order should not be the only state setup.
What makes an API automation strategy maintainable?
Prioritize critical contracts, separate test data from assertions, keep tests independent, and make failures diagnosable.
- Reusable clients without hiding intent
- Controlled data creation and cleanup
- Contract plus targeted business assertions
- Parallel-safe unique identifiers
- Sanitized diagnostics and correlation IDs
- Fast smoke plus broader scheduled regression
What security considerations should QA cover?
At a QA level, verify authentication, object and function authorization, input handling, sensitive-data exposure, transport expectations, and abuse controls.
Test horizontal and vertical authorization, mass assignment, unexpected fields, oversized input, unsafe errors, and secrets in logs. Use approved tools and environments; never perform intrusive testing without authorization.
How do you approach API performance questions?
Start with agreed objectives and representative traffic. Measure latency distributions, throughput, errors, and resource symptoms—not one local response time.
Distinguish a functional response-time assertion from load, stress, soak, and spike testing. Report the environment, data, caching state, and workload.
Give a realistic end-to-end API test scenario
Choose a business flow and show assertions at every boundary, including failure and recovery.
Order creation scenario
- Create an authenticated user and controlled product stock.
- POST a valid order; assert 201, schema, totals, ownership, and one persisted order.
- GET as its owner; deny a second user.
- Repeat with one idempotency key and assert no duplicate.
- Try zero, excessive, unavailable, and malformed quantities.
- Force payment or inventory failure and verify rollback or recoverable state.
- Verify logs or events use a correlation identifier without sensitive data.