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.

POSThttps://apibox.io.vn/v1/schema-mock

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

NameInTypeRequiredDefault
schemabodyobjectyesThe JSON Schema.
countbodynumberno1Number of items (1–100).
seedbodystringnoSeed 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"}'

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

Start with 1,000 free requests every month. Get free API key →