TestingTestingbeginner

API Testing Interview Questions for Freshers

25 API testing questions for fresher testing roles: REST basics, methods, status codes, request parts, Postman scripts, auth and test case design, with short answers and examples.

Published
TL;DR – Quick Answer

API testing interviews for freshers focus on HTTP methods, status codes, the parts of a request, what to check in a response, and Postman basics such as collections, environments, variables and test scripts. Be ready to list positive and negative tests for one endpoint, such as creating a user.

On This Page

API testing interview questions for freshers check whether you understand HTTP and can test a service without a screen. Expect questions on methods, status codes, headers, JSON and Postman. This page has 25 questions with short answers, Postman scripts and one REST Assured example.

Examples use https://api.example.com, which is a placeholder. Replace it with a practice API you are allowed to test.

How to answer API testing questions

Answer with what, how and what you check. "To test a create-user API, I send a POST with valid JSON, expect 201, check the returned id and fields, and then confirm with a GET that the user exists."

Pro tip: Build one small Postman collection before the interview. Talking about your own requests is more convincing than reciting definitions.

API basics questions

Q1. What is an API?

30-second answer: An API (Application Programming Interface) is a set of rules that lets one program ask another for data or actions. A web API usually works over HTTP: a client sends a request to a URL and gets a response, often in JSON.

When a food app shows restaurant menus, the app calls the company's API to get that data. Read what is a REST API for the basics.

Q2. What is API testing, and why is it important?

30-second answer: API testing checks that an API returns the correct data, status codes and errors for each request, and that it is secure and fast enough. It is important because APIs carry the business logic. API tests run faster than UI tests and can start before the screens are ready.

Q3. What is the difference between REST and SOAP?

Point REST SOAP
Type Architectural style Protocol
Data format Usually JSON, can be XML or others XML only
Transport HTTP Mostly HTTP, can use others
Contract Optional (OpenAPI is common) WSDL file
Weight Lighter Heavier

30-second answer: REST uses HTTP methods on resources and is the common choice for web and mobile apps. SOAP uses a strict XML envelope and is still found in some banking and enterprise systems.

Q4. What are the common HTTP methods?

Method Use Idempotent?
GET Read a resource Yes
POST Create a resource or trigger an action No
PUT Replace a resource Yes
PATCH Change part of a resource Not guaranteed
DELETE Remove a resource Yes

30-second answer: GET reads, POST creates, PUT replaces, PATCH updates part and DELETE removes. See GET vs POST for the most common comparison.

Q5. What does idempotent mean?

30-second answer: A method is idempotent if sending the same request many times leaves the server in the same state as sending it once. Deleting user 5 twice still leaves user 5 deleted. Sending the same POST twice may create two orders, so POST is not idempotent.

Testers check this because mobile apps often retry requests when the network is slow.

Q6. What is the difference between PUT and PATCH?

30-second answer: PUT sends the full resource and replaces what is stored. PATCH sends only the fields to change.

PATCH /users/7
{ "city": "Hyderabad" }

With PUT, leaving out a field may clear it, depending on the API design. Test that behaviour, and check the API documentation for the expected rule.

Status code questions

Q7. Which HTTP status codes should an API tester know?

Code Meaning Typical case
200 OK Success GET returns data
201 Created Resource created POST creates a user
204 No Content Success, no body DELETE succeeds
400 Bad Request Invalid request Missing required field
401 Unauthorized Not authenticated Missing or expired token
403 Forbidden Not allowed User lacks permission
404 Not Found Resource does not exist Wrong id
405 Method Not Allowed Method not supported DELETE on a read-only URL
409 Conflict State conflict Email already registered
415 Unsupported Media Type Wrong body format XML sent where JSON is expected
422 Unprocessable Content Valid format, invalid data Age is negative
429 Too Many Requests Rate limit reached Too many calls in a minute
500 Internal Server Error Server failed Unhandled exception
502 Bad Gateway Bad reply from upstream server Gateway cannot reach the service
503 Service Unavailable Server cannot handle requests now Overload or maintenance

30-second answer: 2xx means success, 4xx means the client sent something wrong, and 5xx means the server failed. A 500 for bad input is a bug, because bad input should get a 4xx with a clear message.

Q8. What is the difference between 401 and 403?

30-second answer: 401 means the server does not know who you are, such as a missing or expired token. 403 means the server knows who you are, but you do not have permission. Logging in again can fix a 401, but not a 403.

This maps to authentication vs authorization.

Q9. What would you check if an API returns 200 but the data is wrong?

30-second answer: A 200 only means the request did not fail. I would compare the body with the expected data, check the request parameters, check the database record, and look at whether the data is stale from a cache. Then I would log a bug with the request, response and expected values.

Request and response questions

Q10. What are the parts of an HTTP request?

30-second answer: Method, URL, headers and, for some methods, a body. The URL can contain path parameters and query parameters.

POST https://api.example.com/users?notify=true
Content-Type: application/json
Authorization: Bearer <token>

{ "name": "Asha", "email": "asha@example.com" }

Q11. What is the difference between path and query parameters?

30-second answer: A path parameter identifies a resource and is part of the path, as in /users/7. A query parameter filters, sorts or pages results and comes after ?, as in /users?city=Hyderabad&page=2.

Q12. Which headers do testers check most?

Header Purpose
Content-Type Format of the body sent, such as application/json
Accept Format the client wants back
Authorization Credentials, such as a bearer token
Cache-Control Caching rules
Location URL of a newly created resource (often sent with 201)

30-second answer: Content-Type, Accept and Authorization appear in almost every test. Missing or wrong values should give clear 4xx errors.

Q13. What do you validate in an API response?

30-second answer: Status code, response body values, the JSON structure (schema), important headers, response time and error messages. For create, update and delete calls, I also confirm the change with a follow-up GET or a database query.

Q14. What is schema validation?

30-second answer: Schema validation checks that a response has the expected structure: required fields, data types and allowed values. A JSON Schema can say that id is an integer and email is a required string. It catches problems such as a number suddenly arriving as a string.

Postman questions

Q15. What is Postman, and what are collections and environments?

30-second answer: Postman is a tool for sending API requests, writing tests and sharing them. A collection is a group of saved requests. An environment is a set of variables, such as baseUrl and token, so the same collection can run against test and staging servers.

A request URL then looks like {{baseUrl}}/users/1.

Q16. How do you write a test in Postman?

30-second answer: In the request's tests script (called Post-response in newer Postman versions), I write JavaScript using the pm object.

pm.test("Status is 200", function () {
    pm.response.to.have.status(200);
});

pm.test("User id is 1", function () {
    const body = pm.response.json();
    pm.expect(body.id).to.eql(1);
});

pm.test("Response time is below 500 ms", function () {
    pm.expect(pm.response.responseTime).to.be.below(500);
});

Each pm.test shows as a pass or fail in the test results.

Q17. How do you pass a value from one request to another in Postman?

30-second answer: Save it in a variable in the first request's script, then use it with {{ }} in the next request.

// In the login request script
const body = pm.response.json();
pm.environment.set("token", body.token);

The next request uses the header Authorization: Bearer {{token}}. This is called request chaining.

Q18. What are the Collection Runner and Newman?

30-second answer: The Collection Runner runs all requests in a collection in order, optionally with data from a CSV or JSON file. Newman is Postman's command-line runner, used to run collections in CI pipelines.

newman run users.postman_collection.json -e test.postman_environment.json

Test design questions

Q19. Which test cases would you write for a create-user API?

Type Test Expected
Positive Valid name and email 201 and user returned with an id
Negative Missing email 400 or 422 with a clear message
Negative Invalid email format 400 or 422
Negative Duplicate email 409
Negative No token 401
Boundary Name at maximum allowed length 201
Boundary Name one character over the limit 400 or 422
Security Script tag in name Stored safely, not executed
Data GET the new id Same values as sent

30-second answer: I cover the happy path, missing and invalid fields, duplicates, auth, limits and a data check. The exact error code should match the API documentation.

Q20. What authentication types are used in APIs?

30-second answer: Common types are API keys, Basic authentication (username and password in a header, only safe over HTTPS), bearer tokens such as JWTs, and OAuth 2.0, where an authorisation server issues access tokens. Postman supports all of these in the Authorization tab.

Test expired tokens, wrong tokens, missing tokens and a valid token with the wrong role.

Q21. What is the difference between JSON and XML?

30-second answer: Both carry structured data. JSON uses key-value pairs and arrays and is shorter and easier to read. XML uses opening and closing tags and supports attributes and namespaces. Most REST APIs use JSON, and SOAP uses XML.

Q22. Why test at the API level instead of only the UI?

30-second answer: API tests are faster, less flaky and easier to keep up to date than UI tests. They can test rules and error cases the screen never shows. A common plan is many unit tests, a good number of API tests and fewer UI tests. This is the test pyramid.

UI tests are still needed for real user flows. The automation testing interview questions page explains how the levels fit together.

Tools and automation questions

Q23. Which tools are used for API testing?

Tool Use
Postman Manual and scripted API tests
curl Quick requests from the command line
REST Assured Java library for API automation
requests with pytest Python API automation
SoapUI SOAP and REST testing
JMeter Load and performance testing

30-second answer: Postman for exploring and quick checks, a code library for automation in CI, and JMeter for load.

Q24. What does a simple REST Assured test look like?

30-second answer: REST Assured uses a given, when, then style in Java.

import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.equalTo;

given()
    .baseUri("https://api.example.com")
    .header("Accept", "application/json")
.when()
    .get("/users/1")
.then()
    .statusCode(200)
    .body("id", equalTo(1));

The test sends a GET, checks the status and checks one field in the JSON body. It runs inside a JUnit or TestNG test method.

Q25. What is a mock server, and when do you use it?

30-second answer: A mock server returns fixed responses for chosen requests, standing in for a real API. Testers and front-end developers use it when the real API is not ready, is unstable or costs money per call, such as a payment provider. Postman can create mock servers from saved examples.

How to prepare in one week

Day Task
1 HTTP methods, status codes, request parts
2 Send 10 requests in Postman to a practice API
3 Add tests and environment variables
4 Chain a login token into other requests
5 Write test cases for one create API
6 Run the collection with Newman
7 Revise and do a mock interview

Keep your Postman collection ready to share on screen. Many interviewers ask you to show how you would test one endpoint.

Revise test design basics in manual testing interview questions. For the HTTP layer underneath, read computer networks interview questions, which covers DNS, TCP and HTTPS.

Frequently Asked Questions

Is Postman enough to get an API testing job as a fresher?
Postman is a good start, but interviewers also expect HTTP basics, status codes, JSON, test case design and some SQL to check data. Learning one code-based tool, such as REST Assured for Java or requests with pytest for Python, makes your profile stronger.
Which status codes should I memorise?
Know 200, 201, 204, 301, 400, 401, 403, 404, 405, 409, 415, 422, 429, 500, 502 and 503. Be able to say when each one is the correct response, not only its name.
Do I need coding for API testing?
Basic coding helps a lot. Postman test scripts are written in JavaScript, and automation frameworks use Java, Python or JavaScript. You do not need advanced coding for a fresher role, but you should read and write simple scripts.
Where can I practise API testing for free?
Use public practice APIs that allow testing, or run a small local API from a tutorial. Build a Postman collection with five requests, add tests and variables, and run it with Newman from the command line.
How is API testing different from unit testing?
Unit tests check one function or class inside the code and are usually written by developers. API tests send real HTTP requests to a running service and check the response, so they test many parts working together.
Siva Prasad Galaba
Founder, CodeBegun · Staff Engineer

Founder of CodeBegun. 15+ years building Java systems at companies like Crunchyroll. Teaches Java, Spring Boot and system design the way the industry actually works, and mentors students through projects, mock interviews and placement preparation.

Technically reviewed by CodeBegun Technical TeamLast reviewed 4 December 2026 LinkedIn
Chat with us