Skip to content
SDETRole
SDETRole

Interview questions / API

API Testing Interview Questions

HTTP semantics, status codes, idempotency, auth and contract thinking: the API questions that separate testers who call endpoints from testers who design API test strategy.

7 questions · 3 beginner· 2 intermediate· 2 advanced

beginner questions

intermediate questions

How do you test pagination?

intermediate 2–5 yrs

advanced questions

What API testing interviews look for

Calling an endpoint and checking for 200 is the starting point, not the answer. Interviewers want to hear that you understand HTTP semantics well enough to design tests from them. At junior level that means methods, status codes and what to check in a response. At mid level it means authentication versus authorisation, pagination, error formats and test data. Senior candidates are expected to discuss concurrency, rate limiting, idempotency under retries and how contract testing fits alongside end-to-end tests.

Concepts to study first

  • Status codes that matter: 401 means "who are you?" and 403 means "I know who you are, and no"; 400 is a malformed request while 422 is a well-formed request that fails validation; 201 should come with the created resource or a Location header.
  • PUT vs PATCH and idempotency: PUT replaces and is idempotent; PATCH applies a partial change and may or may not be; POST is neither safe nor idempotent, which is why payment APIs use idempotency keys.
  • What to validate beyond the status code: headers, schema, business rules, side effects in other systems and response time.
  • Auth testing with OAuth 2.0 and JWT: expired, tampered and wrong-audience tokens, and object-level authorisation (can user A read user B's order?).

A worked answer: testing pagination

For "how do you test pagination?", structure the answer by risk. Check the boundaries: first page, last page, an empty result, a page beyond the end and invalid page sizes (0, negative, above the maximum). Check consistency: walking every page returns each record exactly once, and the total in X-Total-Count or the response body matches. Then check stability: what happens if a record is inserted while a client is paging? Offset pagination can skip or repeat items, which is a common real defect and a reason APIs move to cursor-based pagination. The model answer for testing pagination includes example assertions.

Contracts, concurrency and rate limits

Senior API testing interview questions often go beyond a single endpoint. Consumer-driven contract testing, usually with Pact, lets a consumer publish the requests it makes and the response fields it relies on, and the provider verifies against those contracts in its own pipeline. It catches breaking changes earlier than end-to-end tests and is narrower than schema validation, which checks the whole document shape but not what any consumer actually uses.

For rate limiting and concurrency, describe firing parallel requests to check that limits return 429 with a Retry-After header, and that two simultaneous updates to the same resource cannot both succeed when they should conflict.

Practise with real requests

The API testing playground sends real requests to a practice API with validation errors, bearer-token auth, pagination headers and RFC 9457 problem responses, and its exercises check the responses you actually get. To practise automation, the Playwright lab has graded API contract challenges for the cart API and login and profile. Related topics: Postman and REST Assured interview questions.

Type to search across SDETRole.

Full-text search by Pagefind · runs in your browser Open search page →