A successful HTTP response tells me something useful about the request. It does not, by itself, tell me whether the business operation was correct, whether the data shape matched the contract, or whether the effect reached the systems people actually use. That difference is the centre of my API testing practice. HTTP success is not end-to-end correctness.

Throughout this article, I use a fictional wallet transfer API to demonstrate practical testing techniques. The examples are simplified for learning and do not represent any live financial system.

The status code is one signal

I read an API response at three levels.

HTTP semantics asks whether the exchange completed as the status class says. RFC 9110 groups status codes into classes. A 401 response indicates missing or invalid authentication credentials and must carry a WWW-Authenticate challenge. A 403 means the server understood the request but refuses to fulfil it. A 403 may reflect insufficient credentials, but it may be unrelated to them. The status line is useful, but it answers a narrow question.

Business outcome asks whether the domain operation happened according to the agreed rules. In a wallet transfer, that means the right wallets changed by the right amount, the fee rule held, the transfer state reached the expected step, and the caller was allowed to act on that resource.

End-to-end validation asks whether the observable effect reached the application interface, stored state and downstream work. A callback receipt is not a ledger posting. A displayed balance is not a reconciliation. A quiet downstream queue is not a completed operation.

I have encountered 2xx responses with unexpected data structures, and I have investigated accepted requests where expected callbacks were not received while downstream work remained incomplete. I do not attach a cause, endpoint or artifact here. Those observations shaped how I separate the three levels.

A working model for API testing

In my QA work I use Postman, Swagger and browser DevTools, with occasional authorized database checks when a case genuinely needs stored state. I validate status codes, response bodies and returned data against API contracts. I also check transaction statuses, application interfaces and before and after balances. Those are general practices, not claims about a particular employer or system.

I use six dimensions to organise these checks. They are a framework for this article, not an industry standard, and they are complementary rather than ordered steps.

  1. HTTP semantics: status and headers in context.
  2. Response contract: shape, fields and constraints.
  3. Business integrity: amounts, fees and domain rules.
  4. Security and access: identity, permissions and object boundaries.
  5. State and side effects: transitions, storage and downstream effects.
  6. Reproducible evidence: version, fixture, expected result and observed result.

Six complementary dimensions of API validation: HTTP semantics, response contract, business integrity, security and access, state and side effects, and reproducible evidence.

An editorial framework for this article, not an industry standard. The dimensions are complementary, not sequential.

A wallet API contract

The wallet API has the following assumptions:

  • Amounts are expressed in SLE major units as integers. A value of 500 means SLE 500.00. Real APIs may use integer minor units or decimal strings instead, and this example states no universal representation. These values are contract notation, not an invitation to use unrestricted floating-point arithmetic.
  • The minimum permitted transfer amount is amount.value: 1, meaning SLE 1.00.
  • The source wallet is wallet_001. The destination wallet is wallet_002.
  • POST /v1/wallet/transfers creates a transfer resource and returns 201 Created.
  • GET /v1/wallet/transfers/{transaction_id} returns the current transfer state with 200 OK.
  • POST /v1/wallet/callbacks/transfer-events returns 202 Accepted when it accepts a callback request for processing. Three endpoints exist in total, including this callback endpoint.
  • A completed transfer is fee free under this contract. The source wallet decreases by exactly amount.value, and the destination wallet increases by exactly amount.value.
  • The retry design uses an explicit Idempotency-Key. The same key and the same request fingerprint, meaning amount, currency_code and both wallet IDs, identify one transfer. Reusing that key with a changed request is a conflict under this contract. POST is not inherently idempotent.

The 201 response below establishes resource creation. It does not establish a completed transaction, a ledger effect or a durable business outcome.

Creating a transfer

Response header: Location: /v1/wallet/transfers/txn_001

{ "transaction_id": "txn_001", "status": "pending", "amount": { "value": 500, "currency_code": "SLE" }, "fee": { "value": 0, "currency_code": "SLE" }, "source_wallet_id": "wallet_001", "destination_wallet_id": "wallet_002" } 

The Location value above is a response header, not a JSON field.

The 200 response below is a state read. It is still a state claim until I check its effects.

Retrieving transaction status

{ "transaction_id": "txn_001", "status": "completed", "amount": { "value": 500, "currency_code": "SLE" }, "fee": { "value": 0, "currency_code": "SLE" }, "source_wallet_id": "wallet_001", "destination_wallet_id": "wallet_002", "completed_at": "2026-11-28T10:05:00Z" } 

The 202 response below establishes acceptance for processing at the responding endpoint. It does not establish durable recording, processing, ledger updates or a completed business outcome.

Callback acceptance

{ "event_id": "evt_013", "transaction_id": "txn_001", "accepted_for_processing": true, "status": "accepted" } 

For this transfer flow I keep five evidence checkpoints separate: acceptance, durable recording, processing, ledger update and business completion. The HTTP 202 response supports only the first checkpoint. A callback that was not observed is a different observation from a callback that was accepted but whose later processing remains unverified. When an expected callback is not observed, I record that absence without inferring whether it was sent or why.

Contract and schema checks

A contract tells me what I am allowed to assert. OpenAPI describes the response the API is intended to return. A runtime check compares an actual response with that declaration. JSON Schema provides a way to express structure and constraints, but a declared schema is still an intention. Runtime data can disagree with it.

I also check what the schema does not say. It can require a positive integer amount.value, but it cannot prove that the amount represents an available balance. It can constrain status to a known set of states, but it cannot prove that the transition into that state was legal for this actor at that time. Structural validity and business-rule validity are different questions.

For the create response above, I would use this structural schema.

Validating the response structure

{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://example.invalid/schemas/transfer-create-response.json", "title": "Transfer create response", "type": "object", "required": [ "transaction_id", "status", "amount", "fee", "source_wallet_id", "destination_wallet_id" ], "properties": { "transaction_id": { "type": "string", "minLength": 1 }, "status": { "enum": ["pending", "completed", "failed"] }, "amount": { "type": "object", "required": ["value", "currency_code"], "properties": { "value": { "type": "integer", "minimum": 1 }, "currency_code": { "const": "SLE" } }, "additionalProperties": false }, "fee": { "type": "object", "required": ["value", "currency_code"], "properties": { "value": { "type": "integer", "minimum": 0 }, "currency_code": { "const": "SLE" } }, "additionalProperties": false }, "source_wallet_id": { "type": "string", "minLength": 1 }, "destination_wallet_id": { "type": "string", "minLength": 1 } }, "additionalProperties": false } 

This schema requires six top-level fields, a non-empty transaction_id, one of three supported states, nested monetary objects with required values and SLE currency codes, a positive amount, a non-negative fee and non-empty wallet identifiers. It closes extra properties at the top level and inside both monetary objects. These are structural constraints. The zero fee in the example comes from the agreed business rule, not from the schema; the schema deliberately permits any non-negative fee. Structure also cannot prove available balance, a legal state transition or a ledger effect.

A short Postman script can check observable fields without pretending that the reply proves the whole flow.

Writing Postman tests

pm.test("Status code is 201 Created", function () { pm.response.to.have.status(201); }); pm.test("Transaction ID is valid", function () { const body = pm.response.json(); pm.expect(body.transaction_id).to.be.a("string"); pm.expect(body.transaction_id.length).to.be.above(0); pm.expect(body.transaction_id).to.match(/^txn_[A-Za-z0-9_]+$/); }); pm.test("Transaction status is pending", function () { const body = pm.response.json(); pm.expect(body.status).to.equal("pending"); }); pm.test("Transfer amount and currency are correct", function () { const body = pm.response.json(); pm.expect(body.amount.value).to.equal(500); pm.expect(body.amount.currency_code).to.equal("SLE"); }); pm.test("Transaction fee is correct", function () { const body = pm.response.json(); pm.expect(body.fee.value).to.equal(0); pm.expect(body.fee.currency_code).to.equal("SLE"); }); 

These five tests check the response line and specific fields, including a non-empty transaction ID. They do not execute the schema, assert every contract rule or prove a business effect. I have not verified a dialect-compatible native Postman schema assertion here, so I do not present these checks as native schema validation.

Identity, authorization and ownership

Authentication answers who is calling. Authorization answers what that caller may do. Object ownership helps scope which wallet or transfer a caller is trying to touch, but the permission boundary still comes from the authorization rules. Those are separate checks.

RFC 9110 gives 401 and 403 different meanings. OWASP API Security guidance also treats broken authentication, object-level authorization, object-property authorization and function-level authorization as different risks. I use that guidance as a testing lens, not as a protocol standard.

Authentication and authorization tests

Case Synthetic actor Expected protocol signal What I still need to observe
No credentials no token 401 with a WWW-Authenticate challenge No transfer object is created.
Valid caller, foreign wallet synthetic_token_beta 403 or contract-defined denial, refusing to fulfil without proving identity No state change on wallet_001.
Valid owner synthetic_token_alpha 201 for a new resource Ownership and permission are enforced on later reads and retries too.
Property tampering synthetic_token_alpha Contract-defined rejection or override Fee and currency_code follow server rules, not caller preference.

All identities in the table are invented.

Positive, negative, boundary and state checks

A status code cannot carry the whole oracle. I treat amount, state and effect as separate dimensions. An oracle here is the expected result agreed for the contract, not an execution result.

API test scenarios

Type Input or condition Expected under this contract
Positive amount.value: 500, sufficient balance One pending transfer, fee SLE 0.00, one intended debit and credit when completed.
Negative amount.value: -1 Contract-defined validation error with a safe problem response.
Boundary amount.value: 1 Accepted at the minimum permitted amount of SLE 1.00.
Rejected before execution amount.value above available balance Declined with a stable reason; no debit, no credit and no authorised financial effect from this request.
First request Same key and fingerprint One pending transfer is created. Completion needs separate evidence.
Identical retry Same key, amount, currency_code and wallet IDs Same transaction, no additional intended financial effect. The response body may differ.
Changed-payload reuse Same key with amount.value: 501 Conflict under this contract, no additional intended financial effect.
Pending state Retry while status is pending The retry does not complete the transfer automatically. The response may differ.
State Retry after completion No second financial effect. The response may differ.
State Cancel after completion Rejected by the state machine, not inferred from an external 404.

Transactions, balances and downstream work

For money movement, I need more than a body that looks right. The invariant is simple: fee is SLE 0.00, the source decreases by SLE 500.00 from SLE 12,500.00 to SLE 12,000.00, the destination increases by SLE 500.00 from SLE 5,000.00 to SLE 5,500.00, the combined balance remains SLE 17,500.00, and the transfer state matches the ledger. I compare before and after balances with the transfer state and the application interface.

Validating financial integrity

Observation Source wallet Destination wallet Combined balance Transfer state
Before SLE 12,500.00 SLE 5,000.00 SLE 17,500.00 none
After intended transfer SLE 12,000.00, change -SLE 500.00 SLE 5,500.00, change +SLE 500.00 SLE 17,500.00, change 0 completed

I have also investigated discrepancies between failed transaction states and financial effects. I do not attach a cause to that observation here. I record the state, the visible interface, the balance evidence and the original reason separately, then let the contract decide which layer is authoritative.

Asynchronous work adds another boundary. A 202 at the callback endpoint supports only acceptance of that request for processing at that endpoint. It does not establish durable recording, subsequent processing, a ledger update or business completion. If an expected callback is not observed, I record that absence without inferring whether it was sent or why. A correlated HTTP 202 response at the responding endpoint and an unobserved callback are separate observations; I check each later checkpoint with its own evidence.

Callback lifecycle showing five evidence checkpoints: acceptance, durable recording, processing, ledger update and business completion. HTTP 202 confirms acceptance only.
Acceptance at the callback endpoint is one observation. Each later milestone needs its own evidence.

Retries and idempotency

RFC 9110 discusses idempotency in terms of the intended effect of repeated identical requests. POST is not inherently idempotent, and idempotency does not promise identical response bodies. Those two mistakes can make a retry test misleading.

In this contract, a client supplies one Idempotency-Key for a transfer attempt. An identical retry with the same key and request fingerprint refers to the same transaction and produces no additional intended financial effect. Reusing the key with a changed amount is a conflict under this contract, not a second transfer. One reply may describe creation while a later reply describes the existing transaction. I care about the effect and the evidence, not byte equality.

An in-memory model does not validate real concurrency, atomicity, persistence, distributed transaction behaviour or production retry guarantees.

Fee-free SLE 500 wallet transfer showing source balance decreasing from SLE 12,500 to SLE 12,000, destination increasing from SLE 5,000 to SLE 5,500, and combined balance remaining SLE 17,500. Identical retries must not create another financial effect.

Zero-fee transfer. Compare the amount, fee, wallet deltas and combined total with transfer state and effects.

A duplicate-processing check records the key, transfer state, ledger entries and before and after balances. If two intended movements appeared under this contract, that would be a defect candidate. It is not a proven defect until the fixture, environment and observed data are recorded.

Errors that preserve context

Safe errors need useful structure without internal detail. RFC 9457 provides a problem-details model, and OWASP error-handling guidance favours helpful client errors without unsafe disclosure. OWASP guidance is not a mandatory protocol standard, so I cite it as guidance.

Structured API error response

Response context: 422 Unprocessable Content; Content-Type: application/problem+json

{ "type": "https://example.invalid/problems/transfer-declined", "title": "Transfer declined", "status": 422, "detail": "The destination wallet is not active.", "instance": "txn_002", "code": "destination_inactive" } 

The status member inside the body describes the problem representation. It does not replace the actual HTTP status or header evidence.

I also preserve the original failure context. I have seen original rejection reasons overwritten by later inquiry results. A later status can explain current state, but it should not erase the first reason code, message, time and correlation identifier. I keep the original reason and the later result as separate fields.

The same discipline applies to cancellation. An external 404 is one protocol observation. It does not automatically permit cancellation. The contract and state machine must define that transition.

Reproducible evidence and defect reports

Good API evidence lets someone else understand what I saw without guessing. For each case I record:

  • API version, contract version and environment label;
  • synthetic fixture identities and major-unit SLE values;
  • request method, path, headers and redacted body;
  • status, headers and complete response body;
  • expected result, observed result and the layer each belongs to;
  • before and after balances, transfer state and downstream observations;
  • timestamps, correlation identifiers and the original failure reason;
  • the exact limitation when a path was not executed or not observed.

That record becomes a defect report only when it states a reproducible difference between expectation and observation. I do not add counts, metrics or real-system PASS labels to make a report look stronger. I say what ran, what did not run and what remains unknown.

What the status code cannot carry

The status code belongs to the protocol layer. The body belongs to the contract layer. The business outcome belongs to the domain layer. Persistence and callbacks belong to the downstream layer. A careful tester keeps those layers separate, then connects them with evidence.

That is the habit I want to carry forward: do not stop at the response line, and do not turn a synthetic example into a claim about a real system. Protocol success is useful. Business correctness needs an oracle. End-to-end confidence needs observed effects. BUILD • VALIDATE • SHIP only makes sense when each word has its own evidence.

Disclosure

This article was developed with AI assistance for drafting and review support. I reviewed the claims, examples and wording, and I remain responsible for the final content.

References

Primary standards and official documentation cited above: