JSON Schema Mock Data API
Generate realistic sample JSON from a JSON Schema (types, formats, enums, patterns, ranges, $ref, oneOf / allOf), validated against the schema.
The schema mock API turns a JSON Schema into sample data: objects with their required and optional properties, arrays within minItems / maxItems, numbers within minimum / maximum and multipleOf, strings within their length limits, enum, const and examples, and the usual format values (email, date, date-time, uuid, uri, hostname, ipv4, ipv6).
Simple pattern values (digits, character classes, repetitions such as ^0[35789]\d{8}$) produce matching strings, local $ref (#/$defs/..., #/definitions/...) are resolved, allOf is merged and oneOf / anyOf pick a branch. Up to 100 items per call; the same seed gives the same data, so fixtures stay stable.
Every generated item is validated with the same validator as the JSON validator API (draft 2020-12): valid says whether all items pass. Keywords the generator does not handle (not, if / then, complex patterns) may produce invalid items, which are counted in invalid_items.
Parameters
| Name | In | Type | Required | Default | |
|---|---|---|---|---|---|
schema | body | object | yes | The JSON Schema. | |
count | body | number | no | 1 | Number of items (1–100). |
seed | body | string | no | Seed for reproducible data. |
Example
curl -X POST "https://apibox.io.vn/v1/schema-mock" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"schema":{"type":"object","required":["id","email"],"properties":{"id":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"},"age":{"type":"integer","minimum":18,"maximum":99},"phone":{"type":"string","pattern":"^0[35789]\\d{8}$"}}},"count":1,"seed":"s"}'const res = await fetch('https://apibox.io.vn/v1/schema-mock', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"schema": {
"type": "object",
"required": [
"id",
"email"
],
"properties": {
"id": {
"type": "string",
"format": "uuid"
},
"email": {
"type": "string",
"format": "email"
},
"age": {
"type": "integer",
"minimum": 18,
"maximum": 99
},
"phone": {
"type": "string",
"pattern": "^0[35789]\\d{8}$"
}
}
},
"count": 1,
"seed": "s"
}),
});
const data = await res.json();
console.log(data);import requests
res = requests.post(
"https://apibox.io.vn/v1/schema-mock",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"schema": {"type": "object", "required": ["id", "email"], "properties": {"id": {"type": "string", "format": "uuid"}, "email": {"type": "string", "format": "email"}, "age": {"type": "integer", "minimum": 18, "maximum": 99}, "phone": {"type": "string", "pattern": "^0[35789]\\d{8}$"}}}, "count": 1, "seed": "s"},
timeout=30,
)
print(res.json())<?php
$ch = curl_init('https://apibox.io.vn/v1/schema-mock');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_KEY', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => '{"schema":{"type":"object","required":["id","email"],"properties":{"id":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"},"age":{"type":"integer","minimum":18,"maximum":99},"phone":{"type":"string","pattern":"^0[35789]\\\\d{8}$"}}},"count":1,"seed":"s"}',
]);
$response = curl_exec($ch);
print_r(json_decode($response, true));Response
{
"seed": "s",
"count": 1,
"valid": true,
"data": [
{
"id": "dacf6276-1f2c-4cc4-830a-b315d3dc1f17",
"email": "lorem.river4@example.com",
"age": 89,
"phone": "0913924197"
}
]
}
Use cases
- Mock API responses for front-end work before the back end exists
- Fixtures and seeds for automated tests
- Check that a schema accepts what you think it accepts
- Example payloads for API documentation
FAQ
Which drafts are supported?
Common keywords of drafts 7, 2019-09 and 2020-12. Validation of the output uses draft 2020-12.
Are remote $ref supported?
No, only references inside the same schema (#/...). Bundle your schema first.
Can I get the same data again?
Yes, pass the same seed and count; the seed used is always returned.
Related APIs
Webhook Tester
Create a unique URL that captures every HTTP request sent to it – method, headers, query and body – then inspect them in the browser or via API.
👤Vietnamese Fake Data
Realistic Vietnamese test data: names, addresses on the 2025 map, mobile numbers by network, CCCD and tax codes with a valid structure, companies, bank accounts.
◧Image Diff
Compare two images pixel by pixel (perceptual colour distance, anti-aliasing aware) and get the share of changed pixels, the changed area and a highlighted diff image.