📐 Template (JSON)
Up to 20 endpoints, 1,000 records each, 5,000 records total. Each field supports
{ "name": "...", "type": "...", "options": { ... } }.
🔁 Seed (optional)
⚠️ When a seed is set, record bodies are deterministic via xoshiro128**.
info.generatedAt still uses the current time and varies per run.
Seeded mode is NOT cryptographically secure — never use it for tokens, salts, keys, IVs, or nonces.
📊 Document summary
📤 Mock API JSON
ℹ️ About Mock API Generator
What is a mock API generator?
A mock API generator turns a small JSON schema template into a ready-to-paste JSON document that mimics the shape of a real REST API: a list of endpoint paths, each with an HTTP method and an array of synthetic records whose field types you control. Use it to scaffold front-end prototypes, seed Postman collections, populate test fixtures, mock OpenAPI/Swagger responses, or generate quick demo data when the real backend isn't ready yet.
Provide a template with up to 20 endpoints, each producing 1 to 1,000 records. The combined record budget across the whole document is 5,000. The output is a single JSON document — easy to commit to a fixtures folder, paste into a json-server file, or serve through any static mock framework.
Template schema
The template is a JSON object with a single endpoints array. Each entry has:
path— endpoint URL preserved verbatim, including:id-style placeholders (e.g./users,/users/:id/posts).method— optional, defaults toGET. One ofGET,POST,PUT,PATCH,DELETE,HEAD,OPTIONS.count— number of records to generate for this endpoint (1 to 1,000).fields— array of{ name, type, options? }entries describing each record's shape.
Supported field types
- Identifiers:
uuid(RFC 9562 v4 with correct version/variant nibbles). - Numbers:
integer(min/max),float(min/max/decimals),boolean. - Identity:
full_name,first_name,last_name,email,phone(NANP-format). - Time:
iso_date(yyyy-mm-dd,from/to),iso_datetime(full UTC ISO 8601,from/to). - Text:
sentence,paragraph(lorem ipsum). - Categorical:
enumwithvaluesarray.
Output shape
The generator returns a single JSON document:
{
"info": {
"generatedAt": "2026-05-27T12:34:56Z",
"endpointCount": 2,
"totalRecords": 13
},
"endpoints": [
{ "path": "/users", "method": "GET", "records": [ { "id": "...", "name": "..." }, ... ] },
{ "path": "/users/:id", "method": "GET", "records": [ { "id": "...", "name": "..." } ] }
]
}
info.generatedAt uses the current UTC time at request time —
it varies even when a seed is set. The record bodies are still
byte-deterministic for the same template + seed.
Randomness source
- Default (no seed):
crypto.getRandomValues— the platform CSPRNG exposed through Web Crypto (browser) and Node'swebcrypto(server). Output cannot be reproduced. - Seeded mode: the seed string is mixed into a 128-bit state with a four-lane MurmurHash3 finaliser, then expanded through xoshiro128** (Blackman & Vigna). Same seed + same template = byte-identical records (timestamp aside).
- Security note: seeded mode is NOT cryptographically secure. Use it for fixtures and reproducibility only — never for tokens, passwords, salts, IVs, or anything an attacker should not be able to predict.
Use cases
- Front-end prototyping: generate sample
/users+/posts+/commentsdata before the backend exists. - Fixture seeding: commit a JSON fixture to your repo and load it from your test setup.
- OpenAPI/Swagger mocks: paste the generated endpoints into a mock server like Prism or json-server.
- QA scenarios: seeded mode lets you reproduce the same dataset across runs and CI jobs.
- Demo & sales decks: show a believable dataset without exposing real customer data.
Bounds
- Up to 20 endpoints per template.
- 1 to 1,000 records per endpoint.
- Up to 5,000 records total across the whole document.
- Up to 50 fields per endpoint record.
integer.min/maxmust fit in 32 bits.float.decimals: 0 to 15.
References
- RFC 9562 — Universally Unique IDentifiers (UUIDs).
- ISO 8601 — Date and time format.
- North American Numbering Plan (NANP) — phone field format.
- prng.di.unimi.it — xoshiro / xoroshiro generators (seeded mode PRNG).
- json-server — drop-in REST API from a JSON file.
API Usage Example:
POST /api/tools/data/mock-api-generator
Content-Type: application/json
{
"template": {
"endpoints": [
{
"path": "/users",
"method": "GET",
"count": 3,
"fields": [
{
"name": "id",
"type": "uuid"
},
{
"name": "name",
"type": "full_name"
},
{
"name": "email",
"type": "email"
}
]
},
{
"path": "/users/:id/posts",
"method": "GET",
"count": 2,
"fields": [
{
"name": "id",
"type": "uuid"
},
{
"name": "title",
"type": "sentence"
}
]
}
]
},
"seed": "fixture-1"
}