QA Interview Hub · Knowledge base · Quizzes · Українська
All topics
API interview questions
161 questions on API, from the basics to the hard ones. Answers and explanations are in the quiz and the knowledge base.
By level: Junior QA interview questions · Middle QA interview questions · Senior QA interview questions
Client-server and REST
- In the request GET /users/42, what is the resource and what is its representation? Junior
- Why do REST addresses use nouns (/orders) rather than verbs (/getOrders)? Junior
- What makes testing at the HTTP API level more convenient than a UI test of the same business logic? Middle
- What exactly does this request ask for? Junior
GET /users/42/orders?status=paid HTTP/1.1
Host: shop.test
Accept: application/json
- In a test the client does not keep cookies: the login succeeds, but the next request goes without a Cookie header and gets 401. How do you explain it? Middle
POST /login HTTP/1.1
Host: shop.test
Content-Type: application/json
{"email":"ira@shop.test","password":"correct-password"}
HTTP/1.1 200 OK
Set-Cookie: sid=abc123; HttpOnly; Secure
###
GET /profile HTTP/1.1
Host: shop.test
Accept: application/json
HTTP/1.1 401 Unauthorized
- The UI form does not let you enter a negative amount, but this request sent directly created a transfer. What is the conclusion? Middle
POST /api/transfers HTTP/1.1
Host: bank.test
Authorization: Bearer <token>
Content-Type: application/json
{"toAccount":"UA2100000000000000000000001","amount":-500}
HTTP/1.1 201 Created
Content-Type: application/json
{"id":"tr_88","amount":-500}
Take the quiz for this chapter · Read the explanation in the knowledge base
Anatomy of a request and response
- An API client fails to parse JSON: the response has Content-Type: text/html and the body starts with <html>…502 Bad Gateway. What happened? Middle
- The request body is valid JSON, but the server answered 415. What is the most likely cause? Middle
POST /v1/orders HTTP/1.1
Host: api.shop.test
Authorization: Bearer <token>
Content-Type: text/plain
{"item":"book","qty":2}
HTTP/1.1 415 Unsupported Media Type
- A user reported this error. Which response header helps most to find the matching entry in the server logs? Middle
HTTP/1.1 500 Internal Server Error
Content-Type: application/json
Content-Length: 59
Cache-Control: no-store
Date: Wed, 11 Nov 2026 09:14:07 GMT
Server: nginx/1.27.0
X-Request-Id: 9b2f4c1e-7a3d-4e55-8c10-2f6a1d9e0b44
{"error":"internal_error","message":"Something went wrong"}
- Why should an authorization token not be passed in a query parameter such as ?access_token=…? Middle
Take the quiz for this chapter · Read the explanation in the knowledge base
HTTP methods and idempotency
- What does it mean that an HTTP method is "safe" according to the specification? Junior
- DELETE /orders/5 returned 204 the first time and 404 the second. Does this violate the idempotency of DELETE? Middle
- What is the HEAD method used for? Junior
- The first request timed out on the client, which repeated it with the same Idempotency-Key. The documentation says a repeat with the same key returns the original result. How do you assess this pair of responses? Middle
POST /v1/payments HTTP/1.1
Host: api.bank.test
Idempotency-Key: 7f3c-0001
Content-Type: application/json
{"amount":100,"currency":"UAH"}
HTTP/1.1 201 Created
{"id":"pay_1","amount":100}
###
POST /v1/payments HTTP/1.1
Host: api.bank.test
Idempotency-Key: 7f3c-0001
Content-Type: application/json
{"amount":100,"currency":"UAH"}
HTTP/1.1 201 Created
{"id":"pay_1","amount":100}
- The API contract says PUT fully replaces the resource, and phone and city are optional. After a PUT with only name both fields became null. How do you assess it? Middle
GET /users/9 HTTP/1.1
Host: api.shop.test
HTTP/1.1 200 OK
{"id":9,"name":"Ira","phone":"+380501112233","city":"Lviv"}
###
PUT /users/9 HTTP/1.1
Host: api.shop.test
Content-Type: application/json
{"name":"Iryna"}
HTTP/1.1 200 OK
{"id":9,"name":"Iryna","phone":null,"city":null}
- A GET request cancelled an order. What is the main problem with this design? Junior
GET /orders/17/cancel HTTP/1.1
Host: shop.test
HTTP/1.1 200 OK
Content-Type: application/json
{"id":17,"status":"cancelled"}
Take the quiz for this chapter · Read the explanation in the knowledge base
Status codes
- Which HTTP methods are idempotent according to the specification? Junior
- Which status is expected after a successful POST that created a resource? Junior
- How is PUT different from PATCH? Junior
- The API returns 500 for an invalid request body. Is that a bug? Middle
- A 200 OK response with the body {"error": "Insufficient funds"}. How do you assess it? Junior
- Registration with an email that already exists, and the API contract tells the client directly that the email is taken. Which status is the most logical? Middle
- What does status 429 mean? Middle
- What does 204 No Content mean? Junior
- When is 202 Accepted appropriate? Middle
- How is 400 different from 422? Middle
- How do 502, 503 and 504 differ? Middle
- The API answered like this to a report creation request. Which next test step most precisely checks the contract of an asynchronous operation? Middle
POST /v1/reports HTTP/1.1
Host: api.shop.test
Content-Type: application/json
{"type":"monthly","month":"2026-10"}
HTTP/1.1 202 Accepted
Location: /v1/reports/jobs/88
- Invoice 501 exists but belongs to user B, and the request comes from user A. The contract says that resources of other users behave as non-existent. How do you assess the response? Middle
GET /v1/invoices/501 HTTP/1.1
Host: api.shop.test
Authorization: Bearer <token of user A>
HTTP/1.1 404 Not Found
Content-Type: application/json
{"error":"not_found"}
- What does this response mean and what does the client do next? Middle
PUT /v1/orders/17 HTTP/1.1
Host: api.shop.test
If-Match: "v3"
Content-Type: application/json
{"status":"shipped"}
HTTP/1.1 412 Precondition Failed
ETag: "v5"
Take the quiz for this chapter · Read the explanation in the knowledge base
Postman: structure and variables
- What is an Environment for in Postman? Junior
- How does the Shared value of a Postman variable differ from the Local value? Middle
- How do you pass the id of a newly created resource from a POST response to the next request of the collection? Middle
- The collection has Bearer {{token}} authorization. The GET /health request must go without a token. What to do? Middle
- The token exists only in the Local value of an environment variable (the Shared value is empty). The request passes locally, but the Postman monitor in the cloud gets 401. Why? Middle
- What do the responses of a Postman mock server created from a collection rely on? Middle
- How does a Postman monitor differ from a Newman run in CI? Junior
Take the quiz for this chapter · Read the explanation in the knowledge base
Authentication and authorization
- How is 401 different from 403? Junior
- Is the content of a JWT of the form xxxxx.yyyyy.zzzzz (three parts separated by dots) encrypted? Junior
- How do you test that the backend really verifies the JWT signature? Middle
- Why a refresh token if there is an access token? Middle
- Which OAuth 2.0 flow suits service-to-service integration without a user? Middle
- What does the HttpOnly flag give a session cookie? Middle
- What does
SameSite=Lax or Strict protect against? Middle - A user updates their profile and adds
"role": "admin" to the body. The server saves the role. What is this vulnerability called? Middle - What do you check after logout from the API's point of view? Middle
- Below is the decoded payload of a JWT from the Authorization: Bearer header, the signature is valid. The server handles the request at the moment 1700001800 (Unix time, seconds). Which response is expected? Junior
{
"sub": "42",
"role": "user",
"iat": 1700000000,
"exp": 1700000900
}
- The token is valid and not expired, but has only the scope orders:read. What is wrong with the response? Middle
POST /v1/orders HTTP/1.1
Host: api.shop.test
Authorization: Bearer <valid token with scope orders:read>
Content-Type: application/json
{"item":"book","qty":1}
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer error="insufficient_scope", scope="orders:write"
Take the quiz for this chapter · Read the explanation in the knowledge base
Scripts and checks in Postman
- Where in Postman does code run before the request is sent and where after the response arrives? Junior
- What happens to this test if the server returned HTML instead of JSON? Middle
pm.test('has numeric id', () => {
const body = pm.response.json();
pm.expect(body.id).to.be.a('number');
});
- Why does this check fail although the array in the response equals ['a', 'b']? Middle
pm.expect(pm.response.json().tags).to.equal(['a', 'b']);
- What will the orderId variable get if this script runs in post-response? Middle
let id;
pm.sendRequest(pm.environment.get('baseUrl') + '/orders/latest', (err, res) => {
id = res.json().id;
});
pm.environment.set('orderId', id);
- This script is in the pre-request of a collection of 30 requests. How can the load on the auth service be reduced? Middle
pm.sendRequest({
url: pm.environment.get('baseUrl') + '/auth/token',
method: 'POST',
header: { 'Content-Type': 'application/json' },
body: { mode: 'raw', raw: JSON.stringify({ clientId: 'qa' }) }
}, (err, res) => {
pm.environment.set('token', res.json().access_token);
});
- The script is in the post-response of GET /operations/{{opId}} and runs in Runner. What is wrong with it? Senior
const body = pm.response.json();
if (body.status !== 'done') {
pm.execution.setNextRequest(pm.info.requestName);
}
- What is dangerous about console.log(pm.environment.get("token")) in a collection run through Newman in CI? Middle
Take the quiz for this chapter · Read the explanation in the knowledge base
Runner, data-driven tests and Newman
- What does the Collection Runner do in Postman? Junior
- The Runner is started with a CSV file that has an email column. How do you use the value in a request? Middle
- A collection is run in CI with newman run. Will the pipeline step fail if at least one test in the collection fails? Middle
- Why does this test fail when the data comes from the JSON file shown? Middle
// data.json: [{ "email": "a@test.dev", "ok": true }]
pm.test('ok flag', () => {
pm.expect(pm.iterationData.get('ok')).to.eql('true');
});
- newman run is started with --bail and a data file of 10 rows. A test in iteration 3 fails. What happens? Middle
newman run api.postman_collection.json -d users.csv --bail
- A Newman run has 5 requests, and a pm.test (assertion) failed in the 2nd; --bail is not set. What happens to requests 3–5? Middle
- CI must show the tests in the pipeline interface, and a person must be able to analyse a failure from raw requests and responses. Which Newman reporters to choose? Senior
- A data-driven run creates users from a CSV, but the email is the same in every row, and from the second row 409 comes back. What to do? Middle
Take the quiz for this chapter · Read the explanation in the knowledge base
Checklist: what to test in an endpoint
- The POST /orders endpoint returned 201. What else must be checked besides the status? Middle
- The API answers 400 to an invalid request. What is checked in such a response besides the status? Middle
- Which three authentication and authorization scenarios are checked for a protected endpoint? Junior
- The API is documented as supporting Idempotency-Key. The same request with the same key and body was sent twice in a row. What do these responses show? Middle
POST /orders HTTP/1.1
Idempotency-Key: 7f3a-91
Content-Type: application/json
{"sku": "A1", "qty": 1}
HTTP/1.1 201 Created
{"id": 501, "sku": "A1", "qty": 1}
POST /orders HTTP/1.1
Idempotency-Key: 7f3a-91
Content-Type: application/json
{"sku": "A1", "qty": 1}
HTTP/1.1 201 Created
{"id": 502, "sku": "A1", "qty": 1}
- The documentation says DELETE removes the order permanently. After the DELETE response the test does a GET. What is the conclusion? Junior
DELETE /orders/17 HTTP/1.1
HTTP/1.1 204 No Content
GET /orders/17 HTTP/1.1
HTTP/1.1 200 OK
{"id": 17, "status": "active"}
- What in this response is a sign of a problem that a checklist for money fields must catch? Middle
GET /invoices/9 HTTP/1.1
HTTP/1.1 200 OK
Content-Type: application/json
{"id": 9, "items": 3, "total": 0.30000000000000004, "currency": "USD"}
Take the quiz for this chapter · Read the explanation in the knowledge base
API design: resources, pagination, versioning, GraphQL
- The request GET /users/42?active=true. Which is the path parameter and which is the query? Junior
- Why do payment APIs have the Idempotency-Key header? Middle
- What does it mean that HTTP is stateless? Junior
- Why is cursor pagination better than offset/limit? Middle
- What negative cases are there for the
limit parameter? Middle - Why version an API, for example
/v1/? Junior - Which API change is a breaking change? Middle
- What does the OpenAPI (Swagger) specification describe? Middle
- How is GraphQL different from REST from the testing point of view? Middle
- How do you test a webhook from a payment provider? Middle
- A test sends POST /orders with qty = 0 and gets the response below. Which body check is the most stable against wording changes and message localisation? Middle
HTTP/1.1 422 Unprocessable Content
Content-Type: application/problem+json
{
"type": "https://api.shop.test/errors/out-of-range",
"title": "Validation failed",
"status": 422,
"detail": "Field qty must be between 1 and 100, got 0"
}
- Cursor c28 points to the last item received, and the next page must start right after it. No new records were added between the requests. What is wrong in these two responses? Middle
GET /transactions?limit=3 HTTP/1.1
HTTP/1.1 200 OK
{"items": [{"id": 30}, {"id": 29}, {"id": 28}], "next_cursor": "c28"}
GET /transactions?limit=3&cursor=c28 HTTP/1.1
HTTP/1.1 200 OK
{"items": [{"id": 28}, {"id": 27}, {"id": 26}], "next_cursor": "c26"}
- The API declares support for JSON Merge Patch (RFC 7396). What is expected from the server for this request? Middle
PATCH /users/7 HTTP/1.1
Content-Type: application/merge-patch+json
{"nickname": null, "city": "Lviv"}
Take the quiz for this chapter · Read the explanation in the knowledge base
Headers, caching and CORS
- How is Content-Type different from Accept? Middle
- Why does a request from the front end fail because of CORS, but work from Postman? Middle
- When does the browser send a preflight OPTIONS? Middle
- A shared cache (CDN) sits between the clients and the server, and the response depends on Accept-Language. Users with Accept-Language: en started receiving Ukrainian. What is missing in the response? Middle
GET /v1/catalog HTTP/1.1
Host: api.shop.test
Accept-Language: uk
HTTP/1.1 200 OK
Content-Type: application/json
Content-Language: uk
Cache-Control: public, max-age=600
{"title":"Catalog"}
- The browser blocked the POST after this preflight response. Why? Middle
OPTIONS /v1/orders HTTP/1.1
Host: api.shop.test
Origin: https://app.shop.test
Access-Control-Request-Method: POST
Access-Control-Request-Headers: content-type, authorization
HTTP/1.1 204 No Content
Access-Control-Allow-Origin: https://app.shop.test
Access-Control-Allow-Methods: GET, POST
Access-Control-Allow-Headers: content-type
- The browser received this response to GET /accounts/42 and stored it in its own cache. 30 seconds later the page code calls the same GET again. What happens? Junior
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: max-age=60
ETag: "v7"
{"balance":1520.50}
Take the quiz for this chapter · Read the explanation in the knowledge base
API security
- User A, with their own valid token, requests GET /orders/123, which belongs to user B, and the API server returns that order to them. What is this? Middle
- Which of these is a data leak in an API? Middle
- Why is a stack trace in the body of a 500 response considered a defect? Middle
- How do you test rate limiting on login? Middle
- Why is the message "A user with this email does not exist" on login considered a problem? Middle
- Invoice 1002 exists and belongs to user B, invoice 999999 does not exist. Product policy: do not reveal the existence of other people's resources. What is dangerous in these two responses for user A? Middle
GET /invoices/1002 HTTP/1.1
Authorization: Bearer <token of user A>
HTTP/1.1 403 Forbidden
GET /invoices/999999 HTTP/1.1
Authorization: Bearer <token of user A>
HTTP/1.1 404 Not Found
- A test forges a token: the header has alg none, there is no signature, and the payload has role admin. The service is protected. Which response is correct? Senior
{"alg": "none", "typ": "JWT"}
{"sub": "42", "role": "admin", "exp": 1893456000}
- The API uses HTTPS. What is wrong with how this request authenticates? Junior
GET /v1/reports/export?api_key=sk_live_51Hx9 HTTP/1.1
Host: api.shop.test
Take the quiz for this chapter · Read the explanation in the knowledge base
Documentation and contracts: OpenAPI, JSON Schema, contract testing
- The variable baseUrl is set in the Environment and in the Collection with different values. Which will Postman take? Middle
- What does JSON Schema validation of a response check? Middle
- What is consumer-driven contract testing (Pact)? Middle
- Why use a mock server when testing an API client? Middle
- What does Newman do? Junior
- Where is it best to keep a token obtained at login in a Postman collection? Middle
- How do you run one Postman request with different data 20 times? Middle
- What does this Postman test check? Middle
pm.test('fast enough', () => {
pm.expect(pm.response.responseTime).to.be.below(500);
});
- The response schema of GET /users/{id} is below. The server returned {"id": 5, "email": "a@b.co", "passwordHash": "x9"}. What will validation against the schema show? Junior
{
"type": "object",
"required": ["id", "email"],
"properties": {
"id": { "type": "integer" },
"email": { "type": "string" }
},
"additionalProperties": false
}
- The schema (JSON Schema, as in OpenAPI 3.1) describes a response. Which response content passes validation? Middle
{
"type": "object",
"required": ["id", "middleName"],
"properties": {
"id": { "type": "integer" },
"middleName": { "type": ["string", "null"] }
}
}
- The first object is the body schema of POST /payments before a release, the second one after it. Existing clients are valid against the old schema and do not send currency. How should this change be classified? Middle
{"required": ["amount"], "properties": {"amount": {"type": "integer"}, "currency": {"type": "string"}}}
{"required": ["amount", "currency"], "properties": {"amount": {"type": "integer"}, "currency": {"type": "string"}}}
Take the quiz for this chapter · Read the explanation in the knowledge base
Performance and reliability
- What does p95 latency = 400 ms mean? Middle
- How is load testing different from stress testing? Middle
- Which tools are used for load testing an API? Junior
- How do you test the idempotency of a transfer at the API level? Senior
- The result of a five-minute test under constant load is below. The SLO target: p99 at most 500 ms. What is the conclusion and the next step? Middle
{
"requests": 120000,
"errors": 0,
"rps": 400,
"latency_ms": { "p50": 85, "p95": 140, "p99": 3900, "max": 9800 }
}
- The client received this response and repeated the request after 1 second. How must a correct client behave and what does the test check? Middle
HTTP/1.1 429 Too Many Requests
Retry-After: 30
Content-Type: application/json
{"error": "rate_limited"}
- The first request actually ran on the server, only the response was lost. After the retry the database has two payments. What is the cause? Senior
POST /payments HTTP/1.1
Idempotency-Key: 11aa
Content-Type: application/json
{"amount": 5000}
(client: timeout after 5 s, no response)
POST /payments HTTP/1.1
Idempotency-Key: 22bb
Content-Type: application/json
{"amount": 5000}
HTTP/1.1 201 Created
Take the quiz for this chapter · Read the explanation in the knowledge base
gRPC
- Which transport and message format does gRPC use by default? Junior
- When is gRPC usually a better choice than REST? Junior
- A gRPC client calls a method directly over HTTP/2, with no gateway or transcoder, and the method returns NOT_FOUND. What HTTP status does the client see? Middle
- The user sent a token but is not allowed to perform the operation. Which gRPC status fits? Middle
- Which gRPC status means the service is temporarily unavailable and the call is safe to retry? Middle
- Why is reusing the number of a removed field in .proto dangerous? Middle
message User {
string id = 1;
string email = 2;
// was: string phone = 3; (removed)
int32 age = 3;
}
- Which CI check most reliably shows that a .proto change breaks backward compatibility? Middle
- An int32 discount field in proto3 arrives as 0. How do you tell "discount 0" from "discount not set"? Middle
- The gRPC call below has no deadline. What can go wrong in production? Middle
client.getOrder({ id: '42' }, (err, order) => {
// ...
});
- Which RPC type suits uploading a large file in chunks with a single final result? Middle
- Why can a browser not call a gRPC service directly? Middle
- What does server reflection give you when testing gRPC? Middle
- You configure automatic retries for a gRPC client. What should you take into account? Senior
- Which test best checks server behaviour when the client cancels a server-streaming call? Senior
- A method receives a 6 MB message and the server uses default receive settings. What will the client most likely see? Senior
Take the quiz for this chapter · Read the explanation in the knowledge base
Contract testing in practice
- What exactly is the "contract" in the consumer-driven approach? Middle
- The frontend and orders-api release separately and e2e has become the bottleneck. What does contract testing give? Middle
- In which order does the Pact cycle go? Middle
- What does
pact-broker can-i-deploy --pacticipant web-app --version $SHA --to-environment production answer? Senior - Why call
pact-broker record-deployment --pacticipant web-app --version $SHA --environment production after a deploy? Senior - What are
stateHandlers for in provider verification? Middle - What does this matcher check in a consumer test? Middle
body: {
id: like(42),
items: eachLike({ sku: like('A-1') }),
}
- A contract has
total: 150 with no matcher, and provider verification fails on any cart change. What is the problem? Senior - A new consumer branch publishes a pact with a field the provider does not yet return. How do you avoid breaking the provider build? Senior
- Which versioning approach in the Pact Broker is considered modern? Senior
- How does bi-directional contract testing differ from classic Pact? Senior
- A public API has hundreds of unknown third-party clients. What fits better than CDC? Senior
- What does Schemathesis do? Middle
- A service publishes events to Kafka. What does a message pact check? Senior
- Provider verification is green, yet the consumer breaks in production. What is the most likely cause in the Pact setup? Senior
Take the quiz for this chapter · Read the explanation in the knowledge base
Test design for APIs
- The quantity field in POST /orders is described as below. Which values cover boundary analysis: each boundary and the nearest invalid value beyond it? Junior
{
"quantity": { "type": "integer", "minimum": 1, "maximum": 100 }
}
- The specification says age has the type integer. A test sends the request below. What does this response show? Junior
POST /users HTTP/1.1
Content-Type: application/json
{"email": "a@b.co", "age": "30"}
HTTP/1.1 201 Created
{"id": 12, "email": "a@b.co", "age": 30}
- The GET /products endpoint accepts sort (price, name, rating), order (asc, desc) and inStock (true, false). What is the minimum number of tests that covers every pair of values of two parameters (pairwise)? Middle
GET /products?sort=price|name|rating&order=asc|desc&inStock=true|false HTTP/1.1
- The allowed order status transitions are below. Which test is a negative one (a forbidden transition), expecting 409 and an unchanged state? Middle
{
"created": ["paid", "cancelled"],
"paid": ["shipped", "refunded"],
"shipped": ["delivered"],
"delivered": [],
"cancelled": [],
"refunded": []
}
- Why is a field's value space split into equivalence classes in API test design? Junior
- How do an absent field, a field with null and an empty string differ in test design? Junior
- A test set creates an order in the first test and uses its id from a constant in the following ones. How to make it independent of run order? Middle
- Time for testing is short. Endpoints: PATCH /profile/avatar, POST /transfers, GET /banners, DELETE /sessions. Where to start by risk? Middle
Take the quiz for this chapter · Read the explanation in the knowledge base
The most critical API bugs
- What defect does total show and how is it fixed? Middle
POST /api/v1/orders HTTP/1.1
Content-Type: application/json
{"items": [{"sku": "A1", "price": 0.1, "qty": 3}]}
HTTP/1.1 201 Created
{"id": 900, "currency": "UAH", "total": 0.30000000000000004}
- A record was added between two list requests. The list is sorted by created_at descending, newer records have larger ids. What causes the duplicate and what is the fix? Senior
GET /api/v1/items?page=1&limit=2 HTTP/1.1
-> 200 [{"id": 5}, {"id": 4}]
(a new item with id 6 is created here)
GET /api/v1/items?page=2&limit=2 HTTP/1.1
-> 200 [{"id": 4}, {"id": 3}]
- You proved BOLA on staging with two of your own accounts. What do you do next? Middle
- A double click on "Pay" creates two charges. What class of defect is this and what should be checked? Senior
- After a password change, a refresh token issued before it still exchanges for new access tokens. How should this be classified? Senior
- The report "for yesterday" misses orders at 00:30 Kyiv time (UTC+2). The server stores time in UTC and computes day boundaries in UTC too. Which test data reproduces the bug most precisely? Senior
- The backend renamed the field phone to phoneNumber in v1 without notice, and the old mobile app shows an empty number. What is this? Middle
- POST /orders created the order, but the call to the notification service failed and the API answered 500. The client repeated the request. What should be checked first? Senior
- An endpoint responds in 80 ms on 10 records and times out on 100,000. What best shows it is N+1? Middle
Take the quiz for this chapter · Read the explanation in the knowledge base