Preparing for a Quality Assurance (QA) or Software Development Engineer in Test (SDET) role requires more than memorizing textbook definitions. Interviewers want to see that you understand how systems communicate under the hood, how to catch edge cases before they reach production, and how to validate backend logic reliably.
Below is a comprehensive, interview-ready guide covering the top 30 API testing questions, structured from core fundamentals to practical automation scenarios. Work through these API testing interview questions in order, then use the preparation tips, key takeaways, and FAQs at the end to sharpen your answers.
Core Concepts & Fundamentals
1. What is an API?
An Application Programming Interface (API) is a set of rules and protocols that allows two separate software applications to communicate and exchange data. Think of it as a contract between a client (such as a mobile app or web browser) and a server: The client sends a structured request, and the server returns a structured response without exposing its internal code or database architecture.
2. What is API Testing, and why is it important?
API Testing directly validates the business logic, data responses, security, and performance of an API at the message layer, completely bypassing the User Interface (UI).
Why it matters in interviews:
- Early Bug Detection (Shift-Left): You can test backend logic before the frontend UI is even built.
- Speed & Stability: API tests typically run in milliseconds to seconds and do not suffer from UI flakiness like changing CSS selectors or slow page rendering.
- Root-Cause Isolation: When an API test fails, you can narrow the defect to the backend layer quickly, though gateway, auth, environment, and test data issues can also be the cause.
3. What is the difference between an API and a Web Service?
A great rule of thumb to share in interviews is: All web services are APIs, but not all APIs are web services.
- Web Services strictly require a network (HTTP/HTTPS) to operate and facilitate machine-to-machine interaction using web standards such as REST (an architectural style) or SOAP (a protocol).
- APIs are broader. While they include web APIs, they also encompass offline interfaces, such as operating system libraries, database drivers, or local SDKs that communicate within the same machine without a network.
4. What are the main differences between REST and SOAP?
Interviewers often ask, what is a REST API? It is an API that follows REST architecture, exposing resources over HTTP. REST (Representational State Transfer) is a lightweight architectural style, whereas SOAP (Simple Object Access Protocol) is a strict, standardized protocol.
5. What is the difference between URI and URL?
- URI (Uniform Resource Identifier): A string of characters that uniquely identifies a resource either by name, location, or both.
- URL (Uniform Resource Locator): A specific subset of a URI that not only identifies a resource but also provides the exact network address and mechanism (protocol) to retrieve it.
- Example: urn:isbn:0451450523 is a URI (identifies a book by ISBN), whereas https://example.com is both a URI and a URL because it specifies https:// to locate it.
6. What is GraphQL, and how does testing it differ from REST?
GraphQL is a query language for APIs that lets clients request the exact fields they need from a single endpoint, preventing over-fetching or under-fetching of data.
Key differences when testing GraphQL:
- Single Endpoint: Unlike REST (which uses multiple URLs like /users and /orders), GraphQL typically uses one endpoint (e.g., /graphql) and sends queries via POST requests.
- Error Handling: REST relies on HTTP status codes (400, 404). GraphQL execution errors usually come back as a 200 OK HTTP status code with details inside an errors array in the JSON body, although servers may return a 4xx code for syntax or validation failures. Testers must explicitly assert that errors is absent or empty.
7. What are the key components of an HTTP Request and Response?
HTTP Request Components:
- HTTP Method: Defines the action (GET, POST, etc.).
- Endpoint URL: The address of the target API endpoint.
- Headers: Metadata such as Authorization, Content-Type, and Accept.
- Parameters: Path or query variables modifying the request.
- Request Body (Payload): Data sent to the server (used in POST, PUT, PATCH).
HTTP Response Components:
- Status Line / Code: Indicates the outcome (e.g., 200 OK, 404 Not Found).
- Response Headers: Server metadata (Content-Type, Set-Cookie, Cache-Control).
- Response Body: The returned data payload or error message.
8. What are the most common HTTP methods used in REST APIs?
- GET: Retrieves data from a server without modifying anything.
- POST: Submits data to create a new resource.
- PUT: Replaces an entire existing resource with a new payload.
- PATCH: Applies partial updates to an existing resource.
- DELETE: Removes a specific resource from the server.
- OPTIONS / HEAD: OPTIONS checks supported communication methods (used in CORS preflight); HEAD fetches response headers without a body.
9. What is idempotency in HTTP methods?
An HTTP method is idempotent if making multiple identical requests produces the exact same server state as making a single request.
- Idempotent Methods: GET, PUT, DELETE, HEAD, OPTIONS. (Deleting user 101 twice leaves user 101 deleted: The server state does not change after the first call).
- Non-Idempotent Methods: POST, and potentially PATCH, which is not guaranteed to be idempotent. Calling POST /orders five times creates five separate orders.
10. What are the main categories of HTTP Status Codes?
- 1xx (Informational): Request received, continuing process (100 Continue).
- 2xx (Success): Request was successfully received and accepted (200 OK, 201 Created, 204 No Content).
- 3xx (Redirection): Further action is required to complete the request (301 Moved Permanently, 304 Not Modified).
- 4xx (Client Error): Request contains invalid syntax or unauthorized access (400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found, 429 Too Many Requests).
- 5xx (Server Error): Server failed to fulfill a valid request (500 Internal Server Error, 502 Bad Gateway, 503 Service Unavailable).
Validation, Security & Tools
11. What key elements do you verify in an API response?
Avoid saying "I only check the status code." Mention these five validation layers:
- HTTP Status Code: Confirm it matches the expected outcome (200, 201, 400, etc.).
- Response Headers: Check Content-Type (e.g., application/json), caching rules, and security headers.
- JSON/XML Schema & Data Types: Ensure field names, structure, and data types (string, integer, boolean) match the contract.
- Business Logic & Data Accuracy: Verify that returned values match input calculations or database records.
- Response Latency: Ensure response time stays within acceptable performance thresholds (e.g., < 500ms).
Keep an API Testing Checklist handy so you cover every layer on each endpoint.
12. What is the difference between PUT and PATCH?
- PUT (Full Replacement): Requires sending the complete resource object. If a user record has name, email, and phone, and you send a PUT with only name and email, the phone field may be reset to null.
- PATCH (Partial Update): Requires sending only the specific fields you want to modify (e.g., { "phone": "555-0199" }), leaving all other fields intact.
13. What is the difference between 401 Unauthorised and 403 Forbidden?
- 401 Unauthorized (Authentication issue): The server does not know who you are because credentials or tokens are missing, expired, or invalid.
- 403 Forbidden (Authorization issue): The server knows who you are (your token is valid), but your account lacks permission to access the requested resource (e.g., a standard user calling an /admin endpoint).
14. How do you handle Authentication and Authorization in API testing?
API security testing starts with credentials. You inspect the API security documentation and pass them using the required mechanism:
- Basic Auth: Encoding username:password in Base64 inside the Authorization header.
- API Keys: Passing a static key via a custom header (e.g., x-api-key) or query parameter.
- Bearer Token / JWT: Calling a /login endpoint first, extracting the returned JSON Web Token (JWT), and attaching Authorization: Bearer <token> to subsequent requests.
- OAuth 2.0: Automating token generation via client_id and client_secret inside pre-request scripts before executing tests.
15. What is JSON Schema Validation, and why is it useful?
A JSON Schema is a contract defining the expected structure, required fields, value constraints, and data types of a JSON payload. Instead of writing dozens of individual assertions for every field, a single schema validation check verifies the entire payload structure at once and catches accidental breaking changes immediately. Check out our JSON Schema Validator to try it before attending your interview.
16. What is the difference between Path Parameters and Query Parameters?
- Path Parameters are part of the URL path and identify a specific resource. They are typically mandatory (GET /api/users/42).
- Query Parameters appear after a ? as key-value pairs separated by &. They filter, sort, or paginate results and are usually optional (GET /api/users?role=tester&page=2).
17. What are some popular tools and libraries used for API testing?
Choose API testing tools based on what you need to do:
- Manual & Exploratory: Postman, Insomnia, Swagger UI / OpenAPI, cURL.
- Java Automation: RestAssured, Karate DSL.
- Python Automation: Pytest with the requests library.
- JavaScript/TypeScript Automation: Playwright (APIRequestContext), SuperTest.
- Performance & Mocking: Apache JMeter, k6, WireMock.
- Contract Testing: Pact.
- API Security Tools: OWASP ZAP, Burp Suite.
Practical Scenarios & Automation
18. How do you handle dynamic values (like tokens or IDs) across chained API requests?
API chaining occurs when the output of one request feeds into the next (e.g., Login -> Create Order -> Get Order).
- Send the first request (POST /orders).
- Parse the JSON response using JSONPath or deserialization to extract the orderId.
- Save that value into an environment variable (Postman) or test context variable (RestAssured/Pytest).
- Reference that variable dynamically in the URL or payload of subsequent requests.
19. How do you test an API when documentation is missing or incomplete?
- Inspect Browser Traffic: Open Chrome DevTools (Network tab) while interacting with the UI to capture endpoints, headers, and payloads.
- Check Source Code: Read backend controller or routing files directly in the repository.
- Collaborate with Developers: Ask backend engineers for expected status codes and required fields.
- Exploratory Testing: Send OPTIONS requests or deliberately invalid inputs to observe validation error messages.
20. What is API Mocking (or Virtualisation), and when do you use it?
API Mocking simulates a real API using tools like WireMock or Postman Mock Servers to return predefined responses. It is useful when:
- Dependent backend services are still under development.
- Third-party APIs (like payment gateways) charge per call or have strict sandbox limits.
- You need to simulate rare failures like 503 Service Unavailable or network timeouts.
21. What is API Contract Testing?
Contract Testing ensures that a Consumer (frontend or calling service) and a Provider (backend API) adhere to an agreed-upon message format. Tools like Pact verify contracts inside CI/CD pipelines so providers cannot deploy breaking changes that crash downstream consumers.
22. How do you handle Rate Limiting (429 Too Many Requests) during testing?
- Read Retry-After and X-RateLimit-* response headers.
- Add exponential backoff or controlled delays in automated suites when a 429 status is returned.
- Ask DevOps to whitelist QA test runner IPs or test keys in staging environments.
- Write dedicated tests to confirm rate limits trigger properly at expected thresholds.
23. What are common negative test cases you write for an API?
Treat these negative cases as a starter API security checklist and a quick way to widen test coverage:
- Invalid Payloads: Missing mandatory fields, wrong data types (sending a string for an integer), or null values.
- Boundary Values: Passing 0, negative numbers (-1), or strings exceeding max character limits.
- Security & Auth: Expired tokens, missing headers, SQL injection/XSS strings, and IDOR checks (User A attempting to read User B's private data).
- Wrong HTTP Methods: Sending DELETE to a read-only GET endpoint (expecting 405 Method Not Allowed).
24. What is Serialisation and Deserialization in API automation?
- Serialization: Converting a programming object (like a Java POJO or Python dict) into a JSON/XML string to send in an HTTP request body.
- Deserialization: Converting an incoming JSON/XML response string back into a structured object so you can write clean, type-safe assertions.
25. How do you test APIs that handle file uploads and downloads?
- File Uploads: Send a POST request with Content-Type: multipart/form-data, attach the binary file, and test valid files alongside negative cases (oversized files expecting 413 Payload Too Large, unsupported formats, or empty 0 KB files).
- File Downloads: Send a GET request, verify 200 OK, check Content-Type and Content-Disposition headers, and validate the downloaded byte stream length or MD5/SHA-256 checksum.
Architecture, Performance & Best Practices
26. What is API Versioning, and how do you test it?
API Versioning manages breaking changes safely using URI paths (/api/v1/users), query parameters (?version=1), or headers (Accept-Version: v1). Testing involves running regression suites on v1 to confirm backward compatibility while testing new features on v2 and checking deprecation headers on retiring endpoints.
27. How do you verify database integrity after an API operation?
After executing a POST, PUT, or DELETE call, extract the record ID from the response, connect directly to the backend database inside your test script (via JDBC or Python DB drivers), and run a SELECT query to verify that rows, columns, and timestamps updated accurately.
28. What is CORS (Cross-Origin Resource Sharing), and how does it affect APIs?
CORS is a browser security feature that blocks web apps from calling APIs on a different domain unless the server explicitly allows it via response headers. Because tools like Postman bypass browser CORS rules, an API can pass in Postman yet fail in a web browser. Testers verify preflight OPTIONS responses for Access-Control-Allow-Origin and Access-Control-Allow-Methods headers.
29. What performance metrics do you monitor during API load testing?
- Latency Percentiles: Track p95 and p99 response times rather than simple averages to catch slow tail-end requests.
- Throughput: Requests Per Second (RPS) handled under concurrent traffic.
- Error Rate: Percentage of failed requests (4xx/5xx) as user load scales.
- Resource Utilization: Server CPU, memory usage, and database connection pool health.
30. What are the biggest challenges in API testing?
- Test Data Dependencies: Keeping stateful data clean and isolated when tests run in parallel.
- Frequent Schema Changes: Updating test assertions rapidly as microservices evolve.
- Asynchronous Workflows: Validating APIs that return 202 Accepted and process jobs in the background via queues or webhooks.
- Third-Party Bottlenecks: Handling unstable or rate-limited external sandbox APIs in CI/CD pipelines.
How to Prepare for an API Testing Interview
- Master HTTP Basics: Know your HTTP methods, status codes, headers, and authentication flows inside and out.
- Practice in Postman: Pick any free public API (like GitHub or JSONPlaceholder) and practice chaining requests, saving variables, and writing basic assertions.
- Brush Up on Coding: If applying for an automation testing or SDET role, practice writing clean GET and POST tests from scratch in Java (RestAssured), Python (requests), or JavaScript (Playwright).
- Prepare a Real Bug Example: Have a short story ready about a backend bug you caught via API testing, such as an authorization flaw or database mismatch, that UI testing would have missed.
Key Takeaways
- API testing is fast and reliable: It validates core business logic early without waiting for the UI.
- Check more than status codes: Always validate response headers, JSON schemas, data accuracy, and response times.
- Think like an attacker: Test negative scenarios, boundary values, rate limits (429), and authentication vs. authorization (401 vs. 403).
- Build maintainable automation: Use variable chaining, serialization/deserialization, and mocking to keep test suites stable.
Conclusion
API testing is a core skill for modern QA engineers and SDETs. By mastering HTTP fundamentals, thinking critically about edge cases and security, and understanding how to automate chained workflows, you can approach both conceptual and practical interview questions with confidence. Focus on explaining why each validation matters, and you will stand out in any technical interview. If your team lacks the bandwidth to build this coverage, QA outsourcing services can run your API suites while you hire.
People Also Ask (FAQs)
Q1. Do I need coding skills for an API testing interview?
Ans: For manual QA roles, strong hands-on knowledge of Postman, Swagger, and basic JavaScript assertions is usually enough. For SDET or Automation Engineer roles, coding is required: You will need to build automated API frameworks using tools like RestAssured (Java), Pytest (Python), or Playwright (JavaScript/TypeScript).
Q2. What is the biggest mistake candidates make in API testing interviews?
Ans: The most common mistake is focusing only on positive "happy path" tests (200 OK with valid data) while ignoring negative test cases, security checks (401 vs. 403), JSON schema validation, and database verification.
Q3. How does API testing fit into a CI/CD pipeline?
Ans: Automated API suites run automatically in CI/CD pipelines (like GitHub Actions or Jenkins) whenever new code is deployed to a staging environment. Because they typically run in seconds, they act as a fast quality gate that blocks broken builds before UI tests even start.
Q4. Should I test APIs manually before automating them?
Ans: Yes. Testing an endpoint manually in Postman first helps you verify required headers, inspect response payloads, and discover edge cases. Once the behavior is clear, you can convert those scenarios into automated regression scripts.
Q5. Which API testing tool is best to learn first for beginners?
Ans: Postman is the best starting point for beginners because its visual interface makes it easy to send requests, inspect headers, manage environment variables, and learn JavaScript test assertions before moving on to code-based frameworks.





