Home / Blog / Top 15 API Testing Interview Questions (And How to Answer Them)
Top 15 API Testing Interview Questions (And How to Answer Them)
If you are interviewing for a QA or SDET role in 2026, you will be asked about API testing. Period.
The difference between a junior and senior candidate isn't knowing what an API isβit's how you answer the conceptual test strategy questions. Interviewers are looking for evidence that you understand HTTP, state management, and edge cases.
Here are the top real-world API testing questions, and how to answer them to get the job.
Core HTTP & REST Concepts
1. What is the difference between PUT and PATCH?
The Junior Answer: PUT updates stuff, PATCH updates stuff.
The Senior Answer: PUT is idempotent and replaces the entire resource. If you omit a field in a PUT payload, it should be set to null/default. PATCH applies a partial update to only the specific fields included in the payload, leaving the rest of the resource intact. It is not strictly guaranteed to be idempotent (though it usually is in practice).
2. Can you explain Idempotency and why it matters in testing?
The Perfect Answer: An idempotent operation means that executing it multiple times has the exact same side-effects as executing it once. GET, PUT, and DELETE should be idempotent. POST is generally not.
In testing, I validate this by sending the exact same payload twice quickly. The system should gracefully handle the duplicate request (perhaps returning a 409 Conflict or a cached 200 OK) without processing the business logic twice (e.g., charging a credit card twice).
3. What do 2xx, 3xx, 4xx, and 5xx status codes mean conceptually?
The Perfect Answer:
- 2xx (Success): The server understood and accepted the request.
- 3xx (Redirection): The client must take additional action to complete the request (often URL forwarding).
- 4xx (Client Error): The client messed up. The payload was bad, authentication was missing, or the resource doesn't exist. The client should not retry the exact same request.
- 5xx (Server Error): The client sent a valid request, but the server failed to fulfill it (crashes, timeouts, downstream dependencies down). The client can retry.
Deep-Dive Testing Strategy
4. You are testing an API that creates a user. What positive and negative scenarios do you test?
Don't just list status codes. List business logic. Positive:
- Send valid payload, verify
201 Created. - Verify the user actually exists in the database.
- Verify the response schema matches the API contract.
Negative:
- Missing mandatory fields (
400 Bad Request). - Invalid data types (string instead of integer) (
400 Bad Request). - Violating uniqueness constraints (e.g., email already exists) (
409 Conflict). - Missing or invalid Authentication header (
401 Unauthorized). - Sending a payload that exceeds maximum size limits (
413 Payload Too Large).
5. How do you test an API that returns a large list of items?
The Perfect Answer: I focus on Pagination Boundaries and Performance.
- I verify sorting logic (is the list actually returned descending by date?).
- If the API uses offset pagination (e.g.,
?page=2&limit=50), I test what happens iflimitis set to 1000 (does the server crash?), or ifpageis set to a negative number. - I verify that the sum of items returned across all pages correctly matches the total item count in the database.
Automation & Frameworks
6. How do you pass data between API calls in your automation framework?
The Perfect Answer: In a tool like Postman, I extract the data from the response JSON and save it as an Environment or Collection Variable. In a code-based framework like Pytest + Python requests, I return the relevant IDs from helper functions and use pytest fixtures to inject that state into subsequent test functions. I never hardcode IDs because tests must be deterministic and repeatable across environments.
7. What is Contract Testing, and how does it differ from API functional testing?
The Perfect Answer: API functional testing validates the behavior of the API (does the database update? is the calculation correct?). Contract Testing validates the schema and interface agree between a Consumer (frontend) and Provider (backend API). Tools like Pact ensure that if the backend renames a field from userId to customer_id, the build fails before deployment, preventing integration breakages without needing a slow, shared E2E testing environment.
Security & Edge Cases
8. What is BOLA (Broken Object Level Authorization) and how do you test for it?
The Perfect Answer: BOLA (formerly IDOR) is when an API checks if a user is authenticated, but fails to check if they are authorized to access the specific object requested.
To test this, I log in as User A to get a JWT token. I then attempt to call GET /api/users/{User_B_ID} or DELETE /api/posts/{User_B_Post_ID} using User A's token. The API must return a 403 Forbidden or 404 Not Found.
Want more? Accelerate your preparation with our Premium SDET Interview Kits, featuring full coding solutions, mock API challenges, and complete framework repositories to share on your GitHub.
Want structured interview prep?
Download a free QA kit and move faster through your prep.
Get Free QA Interview Kit βRelated Posts
Contract Testing with Pact: Stop Integration Tests from Lying to You
Learn how consumer-driven contract testing with Pact eliminates the 'it works on staging but breaks in prod' problem for microservices teams.
Read article βAPI Testing Real Scenarios
Real-world API validation scenarios that go beyond HTTP 200 OK. Master what interviewers actually ask.
Read article βMicroservices Testing Strategy: Beyond the Pyramid
How to adapt the Testing Pyramid for distributed architectures, covering service tests, contracts, and chaos engineering.
Read article β