API testing interview questions focus on how you check that an API returns the right data, status codes, errors and performance without using a user interface. This guide covers 30 API testing interview questions and answers for freshers and testers moving from manual to automation, from HTTP basics and REST concepts to Postman, authentication, automation with code and real scenarios, so you can revise everything in one place.
Key takeaways
- Know the main HTTP methods and status codes by heart, because almost every API testing interview starts there.
- A good API test checks the status code, response body, headers, schema and response time, not just whether the call succeeded.
- Negative testing, such as missing fields, wrong data types and invalid tokens, is where most real API bugs are found.
- Be ready to show Postman skills and at least one code-based tool such as REST Assured or Python requests with pytest.
- Explain idempotency clearly: GET, PUT and DELETE should give the same result when repeated, while POST usually should not.
Basic API testing interview questions
1. What is an API?
An API (Application Programming Interface) is a set of rules that lets one software system talk to another. For example, a food delivery app calls a payment API to process a payment and a maps API to show the delivery route.
2. What is API testing?
API testing checks the business logic, data, security and performance of an API directly, by sending requests and validating responses, without going through the user interface. It sits in the middle layer of the testing pyramid, between unit tests and UI tests.
3. Why is API testing important?
API tests run faster and are more stable than UI tests, can start before the UI is ready, and catch logic and data errors close to their source. Since many apps share the same backend APIs across web and mobile, one API bug can affect every client.
4. What is the difference between API testing and UI testing?
UI testing checks what the user sees and clicks, such as buttons and screens. API testing checks the request and response layer underneath. API tests are quicker to write and run and break less often when the design changes, while UI tests confirm the full user journey works end to end.
5. What is the difference between REST and SOAP?
REST is an architectural style that uses standard HTTP methods and usually JSON, and it is lightweight and flexible. SOAP is a protocol that uses XML messages with a strict structure defined in a WSDL file and has built-in standards for security and transactions. Most modern web and mobile APIs are REST, while some banking and enterprise systems still use SOAP.
6. What are the common HTTP methods?
| Method | Purpose | Idempotent |
|---|---|---|
| GET | Read a resource | Yes |
| POST | Create a resource or trigger an action | No |
| PUT | Replace a resource | Yes |
| PATCH | Partially update a resource | Not guaranteed |
| DELETE | Remove a resource | Yes |
7. What does idempotent mean?
An idempotent request gives the same server state no matter how many times you send it. Deleting order 101 once or five times leaves it deleted. Sending the same POST five times could create five orders, which is why POST is not idempotent.
8. What is the difference between PUT and PATCH?
PUT replaces the whole resource with the data you send, so missing fields may be cleared. PATCH updates only the fields you send. Testers should check that PUT and PATCH behave as the API documentation says, because teams sometimes implement them inconsistently.
9. Which HTTP status codes should a tester know?
- 200 OK: request succeeded.
- 201 Created: a new resource was created, usually after POST.
- 204 No Content: success with no body, common after DELETE.
- 400 Bad Request: invalid input from the client.
- 401 Unauthorized: missing or invalid authentication.
- 403 Forbidden: authenticated but not allowed.
- 404 Not Found: the resource does not exist.
- 409 Conflict: request conflicts with current state, such as a duplicate.
- 429 Too Many Requests: rate limit exceeded.
- 500 Internal Server Error and 503 Service Unavailable: server-side problems.
10. What is the difference between 401 and 403?
401 means the server does not know who you are, because the token is missing, expired or wrong. 403 means the server knows who you are but you do not have permission, for example a normal user calling an admin-only endpoint.
11. What are path parameters and query parameters?
A path parameter identifies a specific resource and is part of the URL path, as in /users/42. A query parameter filters or modifies the request and comes after a question mark, as in /users?city=pune&page=2.
12. What are request headers?
Headers carry metadata about the request or response. Common ones are Content-Type (format of the body, such as application/json), Accept (format the client wants back), Authorization (credentials or token) and Cache-Control.
Intermediate API testing interview questions
13. What do you validate in an API response?
Check the status code, the response body values, the data types and structure (schema), mandatory fields, headers such as Content-Type, response time, and side effects such as whether the record was really saved in the database.
14. What is JSON schema validation?
Schema validation checks that a response has the expected structure: required fields, data types, allowed values and formats. It catches breaking changes, such as a field changing from a number to a string, even when individual value checks pass.
15. What types of API testing are there?
Functional testing, validation testing, negative testing, security testing, performance and load testing, contract testing, integration testing and regression testing. In interviews, mention the ones you have actually done and give an example of each.
16. What is negative testing for APIs? Give examples.
Negative testing checks that the API handles bad input safely and returns clear errors. Examples: missing mandatory fields, wrong data types, values beyond allowed limits, invalid or expired tokens, unsupported HTTP methods, very large payloads and special characters. The API should return a suitable 4xx code with a helpful message, never a 500 or a stack trace.
17. What authentication methods have you tested?
Common ones are API keys, Basic authentication, Bearer tokens, OAuth 2.0 and JWT. For each, test valid credentials, missing credentials, wrong credentials, expired tokens and access to resources belonging to another user.
18. What is a JWT?
A JSON Web Token is a compact token made of a header, a payload and a signature, separated by dots. The server signs it so it can verify the token has not been changed. Testers should check expiry, tampered tokens and that sensitive data is not stored in the payload, since the payload is only encoded, not encrypted.
19. How do you test pagination?
Check the first, middle and last pages, page sizes at and beyond the limit, an empty page beyond the end, negative or zero values, and that items do not repeat or go missing between pages. Also check the total count and next or previous links if the API returns them.
20. What is API chaining?
Chaining means using data from one response in the next request. For example, create a user with POST, read the new ID from the response, then use that ID to GET, update and delete the same user. In Postman you do this by saving values to variables in a post-response script.
21. How do you use Postman for API testing?
Create requests inside collections, use environments for base URLs and tokens, write tests in the Scripts tab using pm.test, chain requests with variables, and run whole collections with the Collection Runner or from the command line with Newman for CI pipelines.
pm.test('Status is 200', function () {
pm.response.to.have.status(200);
});
pm.test('User has an id', function () {
const body = pm.response.json();
pm.expect(body.id).to.be.a('number');
pm.environment.set('userId', body.id);
});22. Which tools are used for API testing?
Postman, REST Assured (Java), Python requests with pytest, Karate, SoapUI, JMeter and k6 for load testing, and Swagger or OpenAPI tools for documentation. Our article on API testing tools compares the popular options.
23. How would you automate API tests with code?
Pick a language your team uses and a test framework. In Python, a simple test with requests and pytest looks like this:
import requests
BASE = 'https://api.example.com'
def test_get_user_returns_200():
r = requests.get(f'{BASE}/users/1', timeout=10)
assert r.status_code == 200
body = r.json()
assert body['id'] == 1
assert 'email' in bodyIn Java, REST Assured offers a similar given, when, then style. Keep base URLs and tokens in configuration, not hard-coded in tests.
24. What is mocking in API testing?
Mocking replaces a real API with a fake one that returns fixed responses. It lets you test when a dependency is not ready, is expensive, or is hard to put into a specific state, such as a payment gateway timing out. Postman mock servers and WireMock are common tools.
25. What is contract testing?
Contract testing checks that the provider of an API and its consumers agree on the request and response format. If the provider changes a field name, the contract test fails before the change breaks a mobile app in production. Pact is a well-known tool for this.
Scenario-based API testing interview questions
26. How would you test a login API?
Test valid credentials (200 with a token), wrong password and unknown user (401 with a generic message that does not reveal which one was wrong), missing fields (400), SQL injection strings, very long inputs, rate limiting after repeated failures, token expiry, and that the password never appears in the response or logs.
27. An API returns 200 but the data is wrong. What do you do?
Reproduce it with fixed test data, compare the response against the database and the requirement, check whether caching or an old environment is involved, and raise a defect with the request, response, expected result and environment details. A 200 status code alone never proves the API works.
28. How do you test API performance?
Measure response time for single calls first, then use a tool such as JMeter or k6 to simulate many users. Track average and percentile response times, error rates and throughput, and find the point where the API slows down or starts failing. Agree targets with the team beforehand.
29. What security checks do you do on APIs?
Check authentication and authorisation on every endpoint, try accessing another user’s data by changing IDs, test input validation for injection, confirm HTTPS is enforced, check that error messages do not leak internal details, and verify rate limiting. The OWASP API Security Top 10 is a good checklist to mention.
30. How do you test an API with no documentation?
Talk to developers, look for an OpenAPI or Swagger file, inspect network calls from the web or mobile app in browser developer tools, read existing tests, and write down what you learn as you go. Then confirm expected behaviour with the team before raising defects.
How to prepare for an API testing interview
- Practise on free public practice APIs and build a Postman collection with tests, variables and chaining.
- Write a few automated tests in Python or Java and run them from the command line.
- Prepare one real example of a bug you found through API testing and how you reported it.
- Revise manual testing fundamentals too, since many interviews mix both. See our manual testing interview questions.
- If the role includes UI automation, review our Playwright interview questions as well.
Frequently asked questions
Is API testing manual or automation?
It can be both. Testers often start by exploring an API manually in Postman, then automate repeated checks with Postman scripts, Newman, REST Assured or Python so they run in the CI pipeline on every build.
Is coding required for API testing?
Basic API testing in Postman needs little coding, but most automation roles expect you to write scripts in JavaScript, Java or Python. Learning one language well will make you much more employable.
What is the most asked API testing interview question?
The most common questions are about HTTP methods, status codes such as 200, 201, 400, 401, 403 and 404, the difference between PUT and PATCH, and what you validate in a response. Expect at least one scenario question, such as how you would test a login API.
Is Postman enough for API testing jobs?
Postman is enough to start and is used widely, but many companies also expect a code-based framework such as REST Assured or pytest with requests. Showing both on your resume gives you an advantage.
Explore more guides in our software testing articles.
