# JSON Schema API
> Validate JSON against JSON Schema, server-side. Check any data against a schema (Draft-07 or 2020-12) and get a clear pass/fail plus a detailed list of every error with its instance path, failing keyword and message; verify that a schema itself is well-formed; or infer a starter JSON Schema automatically from a sample document, complete with detected formats like email, URI and date. Built on the battle-tested Ajv engine with full format validation. Every endpoint accepts GET (JSON-encoded parameters) or a JSON POST body and runs entirely locally with no third-party upstream, so responses are instant and the service is always available. Ideal for API request/response validation, form and data-entry checks, ETL and data-quality pipelines, no-code platforms and contract testing.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/jsonschema-api/..."
```

## Pricing
- **Free** (Free) — 1,500 calls/Mo, 2 req/s
- **Basic** ($3/Mo) — 40,000 calls/Mo, 8 req/s
- **Pro** ($11/Mo) — 250,000 calls/Mo, 25 req/s
- **Mega** ($28/Mo) — 1,500,000 calls/Mo, 75 req/s

## Endpoints

### JSON Schema

#### `GET /v1/check` — Check a schema is valid

**Parameters:**
- `schema` (query, required, string) — JSON Schema to check Example: `{"type":"string","format":"email"}`
- `draft` (query, optional, string) — draft-07 | 2020-12 Example: `draft-07`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/jsonschema-api/v1/check?schema=%7B%22type%22%3A%22string%22%2C%22format%22%3A%22email%22%7D&draft=draft-07"
```

**Response:**
```json
{
    "data": {
        "valid": true,
        "message": "schema compiles"
    },
    "meta": {
        "timestamp": "2026-05-30T18:16:58.714Z",
        "request_id": "3180947e-fc50-4805-91ea-772d4c1b3d08"
    },
    "status": "ok",
    "message": "OK",
    "success": true
}
```

#### `GET /v1/infer` — Infer a schema from data

**Parameters:**
- `data` (query, required, string) — Sample data (JSON) Example: `{"id":5,"email":"a@b.com","tags":["x"]}`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/jsonschema-api/v1/infer?data=%7B%22id%22%3A5%2C%22email%22%3A%22a%40b.com%22%2C%22tags%22%3A%5B%22x%22%5D%7D"
```

**Response:**
```json
{
    "data": {
        "schema": {
            "type": "object",
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "required": [
                "id",
                "email",
                "tags"
            ],
            "properties": {
                "id": {
                    "type": "integer"
                },
                "tags": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "email": {
                    "type": "string",
                    "format": "email"
                }
            }
        }
    },
    "meta": {
        "timestamp": "2026-05-30T18:16:58.786Z",
        "request_id": "5ddfda66-7f7c-4674-a330-0f8e0ba1b343"
    },
    "status": "ok",
    "message": "OK",
    "success": true
}
```

#### `GET /v1/validate` — Validate data against a schema

**Parameters:**
- `schema` (query, required, string) — JSON Schema (object or JSON string) Example: `{"type":"object","properties":{"age":{"type":"integer","minimum":0}},"required":["age"]}`
- `data` (query, required, string) — Data to validate (JSON) Example: `{"age":5}`
- `draft` (query, optional, string) — draft-07 | 2020-12 (default draft-07) Example: `draft-07`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/jsonschema-api/v1/validate?schema=%7B%22type%22%3A%22object%22%2C%22properties%22%3A%7B%22age%22%3A%7B%22type%22%3A%22integer%22%2C%22minimum%22%3A0%7D%7D%2C%22required%22%3A%5B%22age%22%5D%7D&data=%7B%22age%22%3A5%7D&draft=draft-07"
```

**Response:**
```json
{
    "data": {
        "valid": true,
        "errors": [],
        "error_count": 0
    },
    "meta": {
        "timestamp": "2026-05-30T18:16:58.865Z",
        "request_id": "3210aabb-4446-4b98-a55e-fba832a470e3"
    },
    "status": "ok",
    "message": "OK",
    "success": true
}
```


---
Marketplace page: https://www.oanor.com/api/jsonschema-api
OpenAPI spec: https://www.oanor.com/api/jsonschema-api/openapi.json
