LearnFree QA courses with practical knowledge checks
PilotForge by SoftwareTestPilot

API response validator

Turn a JSON response into assertions, see exactly what fails, and export Playwright or Postman tests.

Runs in your browserFree · no account requiredMock responses only — no real payments

Response

Assertions — 7 passed, 0 failed

ResultTargetCheckExpectedActual / failureRemove
Pass200
Pass"application/json"
Pass"INR"
Pass—99900
Pass
99900
Pass"captured"
Pass"pay_mock_001"

JSON Schema

Remote $ref schemas are not fetched.

Expected vs actual

Suites and export

Synced suites and team libraries are planned Pro features — not available yet.

import { test, expect } from "@playwright/test";

test("API response", async ({ request }) => {
  const response = await request.get("https://api.example.com/endpoint");
  const body = await response.json();
  // status equals 200
  expect(response.status()).toEqual(200);
  // header content-type regex application/json
  expect(response.headers()["content-type"]).toMatch(new RegExp("application/json"));
  // $.currency oneOf INR,USD
  expect(["INR", "USD"]).toContain(body.currency);
  // $.amount integer
  expect(Number.isInteger(body.amount)).toBe(true);
  // $.amount range 1..∞
  expect(body.amount).toBeGreaterThanOrEqual(1);
  // $.status oneOf created,authorized,captured,failed,refunded
  expect(["created", "authorized", "captured", "failed", "refunded"]).toContain(body.status);
  // $.id regex ^pay_
  expect(body.id).toMatch(new RegExp("^pay_"));
});

API response validator questions

1.Does this call a real API or payment gateway?
No. You paste a response (or load a mock example) and every assertion runs in your browser against that text. The INR and USD payment, subscription and invoice samples are labelled mock data and are never sent to or received from a payment provider.
2.Which JSONPath syntax is supported?
$, .key, ['key with spaces'], [0], negative indexes like [-1], and the wildcard [*] or .*. Filter and script expressions such as [?(@.x>1)] are rejected rather than evaluated, so pasted paths can never run code.
3.How should money amounts be checked?
Store and assert amounts as integers in the smallest currency unit — paise for INR, cents for USD. The examples use the integer assertion plus a minimum of 1, and restrict currency to INR or USD with a one-of assertion.
4.What does the Playwright export contain?
A @playwright/test spec using the request fixture. Each assertion becomes an expect() line against response.status(), response.headers() or the parsed JSON body. Replace the example URL with your endpoint.
5.Where are suites saved?
Up to 30 assertion suites are kept in this browser's local storage — only the assertions, never the response you pasted. Synced suites and team libraries are planned Pro features and not available yet.