OpenAPI Mock Response Generator
Turn the schemas in your OpenAPI spec into realistic example payloads — seeded, deterministic and format-aware — without hosting anything.
This tool generates example responses on this device — it does not host a mock endpoint. Nothing you paste leaves the tab, and remote $refs are never fetched.
Swagger 2.0 and OpenAPI 3.0/3.1/3.2 specs, JSON or YAML, up to 5 MB. JSON payloads only: XML and multipart examples are refused by name, and a regex `pattern` is reported rather than reverse-engineered.
Paste a spec to list its operations and component schemas, then generate a seeded example payload for any response.
The payload appears here — pick a target and press Generate.
The share link carries the seed and options only — the spec itself never travels in a URL.
Options are stored on this device between visits; the spec is not.
Press ? for shortcuts
Do it offline:$ npx @stoplight/prism-cli mock openapi.yaml
How to use it
- Paste the spec (JSON or YAML, up to 5 MB) into the left pane — it is parsed in a background thread on this device, and remote $refs are never fetched.
- Pick a target: an operation, then one of its status codes and media types — or switch the picker to a component schema.
- Press Generate, then read the source badge: it names whether the payload came from a declared example, the examples map, or schema derivation with the seed that ran. Reroll draws a fresh seed.
- Copy or download the payload. The share link carries the seed and options only — the spec itself never travels in a URL.
Paste an OpenAPI or Swagger spec and get an example JSON payload for any operation response or component schema. Declared examples are honored first — the precedence the spec itself defines — and everything else is derived from the schema by a seeded generator, so one integer replays the exact bytes. This page generates example responses on this device — it does not host a mock endpoint, and the spec never uploads.
Examples
{
"info": { "title": "Support Tickets", "version": "1.0.0" },
"openapi": "3.1.0",
"paths": {},
"components": {
"schemas": {
"Ticket": {
"type": "object",
"required": ["id", "ref", "openedAt", "contact", "priority"],
"properties": {
"id": { "type": "integer", "format": "int64", "minimum": 1 },
"ref": { "type": "string", "format": "uuid" },
"openedAt": { "type": "string", "format": "date-time" },
"contact": { "type": "string", "format": "email" },
"priority": { "enum": ["low", "normal", "high"] },
"tags": { "type": "array", "items": { "type": "string" }, "maxItems": 2 }
}
}
}
}
}{
"id": 1,
"ref": "9b2f5c1e-7a3d-4e60-8c4b-2d1a0f6e5b39",
"openedAt": "2026-08-18T10:15:00Z",
"contact": "mock@example.com",
"priority": "low",
"tags": [
"krill",
"hazel"
]
}Schema-derived at seed 7: the format table answers uuid, date-time and email from reserved documentation values, minimum bounds the integer, the enum takes its first entry, and the array honors maxItems. Change the seed and only the seeded values move.
{
"info": { "title": "Loan Decisions", "version": "1.0.0" },
"openapi": "3.1.0",
"paths": {
"/decisions": {
"get": {
"operationId": "getDecision",
"responses": {
"200": {
"description": "The decision",
"content": {
"application/json": {
"examples": {
"approved": { "value": { "decision": "approved", "limit": 2500 } },
"declined": { "value": { "decision": "declined", "limit": 0 } }
},
"schema": {
"type": "object",
"required": ["decision"],
"properties": {
"decision": { "type": "string" },
"limit": { "type": "integer", "minimum": 0 }
}
}
}
}
}
}
}
}
}
}{
"decision": "approved",
"limit": 2500
}The precedence proof: this response declares both an examples map and a schema, so the FIRST map entry ("approved") is served verbatim and the schema is never consulted. Flip Prefer declared examples off and the same target yields a seeded, schema-derived payload instead.
{
"info": { "title": "Payment Methods", "version": "1.0.0" },
"openapi": "3.1.0",
"paths": {},
"components": {
"schemas": {
"PaymentMethod": {
"oneOf": [
{ "$ref": "#/components/schemas/Card" },
{ "$ref": "#/components/schemas/Iban" }
]
},
"Card": {
"type": "object",
"required": ["scheme", "last4"],
"properties": {
"scheme": { "enum": ["visa", "mastercard"] },
"last4": { "type": "string", "minLength": 4, "maxLength": 4 }
}
},
"Iban": {
"type": "object",
"required": ["country", "iban"],
"properties": {
"country": { "type": "string", "minLength": 2, "maxLength": 2 },
"iban": { "type": "string", "minLength": 15, "maxLength": 34 }
}
}
}
}
}{
"scheme": "visa",
"last4": "ambe"
}oneOf at seed 3: the generator picks one branch from the seeded stream and says so in a note naming the index — alternatives are declared, not ranked, so inventing a merge would be a lie. Reroll to see the other branch.
Every example on this page is executed against the same engine that powers the tool, on every build.
Gotchas worth knowing
The precedence law is the spec's, not ours
OpenAPI defines the order: an explicit example wins, then the first entry of the examples map, then the schema. A declared example is served verbatim even when it disagrees with its own schema, because documenting what the author wrote beats quietly correcting it. The Prefer declared examples toggle exists for the opposite need: force schema derivation to stress-test a consumer.
One seed, the same bytes, tomorrow too
Schema-derived values come from a seeded xorshift stream, and the format table is pinned to fixed instants and reserved ranges — no clock is consulted anywhere. Same spec, target, seed and options means byte-equal output, which is what makes these payloads safe to commit as fixtures. The seed rides in the share link; the spec does not.
pattern is reported, never reverse-engineered
Turning a regular expression backwards into a matching string is a search problem this tool refuses on purpose: a patterned property earns a per-property note and a plain seeded value. multipleOf, not, if/then/else and vendor generator extensions like x-faker are likewise ignored rather than half-honored.
This page hosts nothing
Competitors run your mock behind a URL — that is a server, and this page deliberately is not one. Payloads are generated in your tab, remote $refs stay typed-unresolved, and when you need an endpoint a client can actually call, the command below hands the same spec to Prism on your own machine.
Budgets refuse whole, cycles are cut visibly
Payloads stop at 1 MB, nesting at 12 levels, arrays at 10 items (a larger minItems is capped, with a note). A schema that refers back to itself is cut with a literal "{…recursion}" placeholder plus a note, so a fixture never silently pretends to be complete.
Common errors
The operation declares no "500" response — it declares "200".- The status picker only offers codes the spec declares, but an edited spec can pull a code out from under a shared link. Re-pick from the list; nothing is guessed.
"application/xml" is not a JSON media type. This tool generates JSON example payloads only — XML and multipart examples are out of scope.- A typed scope refusal, not a failure. Pick the application/json content of the same response, or any +json structured-syntax type — application/problem+json generates fine.
The "204" response declares no body content — there is no schema and no example to generate from.- A 204 usually has no body on purpose. There is nothing dishonest to invent here: pick a response that declares content, or a component schema directly.
The payload would be larger than the 1 MB output limit for this tool, so none was written — nested `minItems` bounds multiply. Lower the array items option, or generate from a smaller part of the spec.- Four nested levels of minItems: 10 already describe ten thousand leaves. The run is refused whole while it is being built — never truncated into a payload that quietly disagrees with its schema.
FAQ
Does this host a mock server my client can call?
No. A hosted mock is a backend, and this page deliberately runs everything on your device — that is the whole privacy story. It covers the common intent, which is seeing and committing concrete response payloads. When you need a live URL, run the Prism command printed below against the same spec on your own machine.
Will the same seed give me the same payload tomorrow?
Yes. Every derived value is drawn from one xorshift stream seeded by that integer, and nothing in this engine asks what time it is — the date-time row of the format table is a fixed instant, not today's date. The seed shown beside the payload is the one that actually ran, echoed by the engine after sanitation, so copying it (or the share link) replays the run exactly.
Why does a value ignore its pattern or multipleOf?
Because half-honoring a constraint is worse than naming it. Regex reverse-generation and multiple-of arithmetic are outside what this generator claims: each patterned property gets its own note in the run's notes rail. Validators, not fixtures, are the place to enforce those rules.