API Payload Generator

Runs in browser API Testing

Produce valid example payloads (and optional invalid variants for negative tests) from a schema — respecting types, formats, enums, ranges and required fields. All data is clearly test data.

Privacy: This tool runs entirely in your browser. Your input never leaves your device.
Loading tool…

How to use API Payload Generator

  1. Paste a JSON Schema, an OpenAPI/Swagger document (JSON or YAML) or a sample body.
  2. For OpenAPI input, type the component schema name or "POST /path" to select the body schema.
  3. Choose how many valid payloads you need and whether to include optional fields and invalid variants.
  4. Generate, then copy the payload into your test or download the variants as JSON/CSV.

API Payload Generator features

  • Generates valid example payloads from a JSON Schema, an OpenAPI request body/component or a sample object
  • Respects types, formats, enums, ranges, lengths, patterns, required fields, $ref, allOf/oneOf and example values
  • Realistic synthetic values chosen from field names (email, phone, city, price, createdAt…)
  • Invalid variants for negative tests, each breaking exactly one rule with the expected API behaviour
  • Seeded output for reproducible test data; multiple payloads at once

API Payload Generator example

From a signup schema

Input:

{ "type": "object", "required": ["email", "plan"], "properties": { "email": { "type": "string", "format": "email" }, "age": { "type": "integer", "minimum": 18 }, "plan": { "enum": ["free", "pro"] } } }

Output:

{ "email": "test.user157@example.com", "age": 42, "plan": "pro" }
Invalid variants: Missing required "email" · Wrong type at age (string) · Below minimum at age (17) · Invalid enum at plan · Empty body …

Frequently asked questions about API Payload Generator

What inputs are accepted?

A JSON Schema, an OpenAPI/Swagger document (JSON or YAML — choose a component schema or a request body such as "POST /users") or a plain sample object, from which a schema is inferred.

Which schema keywords are respected?

type, enum, const, format, pattern (simple patterns), minimum/maximum, multipleOf, minLength/maxLength, minItems/maxItems, uniqueItems, required, properties, additionalProperties, allOf/oneOf/anyOf, $ref, nullable and example/default values.

What are the invalid variants for?

Negative tests: each variant breaks exactly one rule (missing required field, wrong type, out of range, too long, empty, invalid format/enum, null, extra field) and states the response a correct API should return.

Is the output reproducible?

Enter a seed to get the same payloads every time; leave it empty for fresh random values. All values are synthetic test data.

Technical notes

Pattern-constrained strings are sampled by a small regex generator (character classes, quantifiers, simple alternation). Unsupported patterns fall back to name-based values. Generation is deterministic when a seed is given, using the shared seeded PRNG.