# JSON Schema Inference API

> JSON Schema Inference API is a paid API for AI agents from jsonschema.openverbs.com, paid per call via x402, $0.004/call, status unknown (last checked 2026-09-14).

Infers a JSON Schema from a provided sample JSON value, with options to control required fields, format detection, and additional properties

## Facts

- Endpoint: POST https://jsonschema.openverbs.com/v1/infer
- Price: $0.004/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/json-schema-inference-api-f806afcf
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_rRJ9Um3eIWL3DF35vaZ5_

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability json-schema-inference-api-f806afcf -d '<json body>'
```

Example prompt: Take this sample JSON object — {"userId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "email": "user@example.com", "createdAt": "2024-01-15T10:30:00Z", "score": 42} — and infer a JSON Schema from it, marking all fields as required and detecting string formats like date-time, email, and UUID.

## When to prefer this

Choose this endpoint when you need to automatically generate a JSON Schema from an existing JSON sample — particularly useful for API documentation, data contract creation, or input validation setup. Prefer it over hand-writing schemas when you have a representative sample and want to avoid manual type annotation. It is especially useful when detectFormat is needed to auto-tag semantic string types like UUID, email, or ISO date. It is not suitable for validating existing data against an already-known schema, nor for transforming or processing JSON data.

## Known failure modes

- Missing 'sample' field in body causes a validation error
- Invalid or non-JSON body type causes parsing failure
- Very deeply nested or extremely large JSON samples may hit processing limits
- Ambiguous types (e.g. null values) may produce loose schemas with 'nullable' or missing type constraints
- Non-JSON body type (form-data, text) submitted with a JSON sample may cause unexpected behavior

## How this service works

Infer a JSON Schema (draft-07) from an example value, walking objects and arrays recursively. Set detectFormat=true to tag strings that look like date-time/date/email/uri/uuid, requireAll=false to leave object properties optional, and additionalProperties=true to allow extra keys.

## Output

The endpoint returns an inferred JSON Schema (draft 2020-12) corresponding to the structure and types found in the provided sample. The schema includes type annotations for all detected fields, a required array if requireAll is true, string format tags (e.g. date-time, email, uri, uuid) if detectFormat is true, and an additionalProperties constraint if that option is set. The output is a machine-readable JSON Schema document ready for use in validation, documentation, or code generation.

## Request schema (JSON Schema)

```json
{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "type": "object",
 "properties": {
  "input": {
   "type": "object",
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "type": "string",
     "enum": [
      "POST"
     ]
    },
    "bodyType": {
     "type": "string",
     "enum": [
      "json",
      "form-data",
      "text"
     ]
    },
    "body": {
     "type": "object",
     "properties": {
      "sample": {
       "description": "An example value to infer a schema from (any JSON type)."
      },
      "detectFormat": {
       "type": "boolean",
       "description": "Tag recognizable string formats (date-time/date/email/uri/uuid). Default false."
      },
      "requireAll": {
       "type": "boolean",
       "description": "Mark all object properties as required. Default true."
      },
      "additionalProperties": {
       "type": "boolean",
       "description": "Allow properties beyond those seen. Default false."
      }
     },
     "required": [
      "sample"
     ],
     "additionalProperties": false
    }
   },
   "required": [
    "type",
    "method",
    "bodyType",
    "body"
   ],
   "additionalProperties": false
  }
 },
 "required": [
  "input"
 ]
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/json-schema-inference-api-f806afcf/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from jsonschema.openverbs.com](https://www.zero.xyz/host/jsonschema.openverbs.com/llms.txt)
