Перейти к содержимому
POST AI agent ready /v1/schema/validate

JSON Schema Validate API - Check Data Against draft-07

Supports a practical JSON Schema draft-07 subset: type, enum, minLength, maxLength, pattern, minimum, maximum, required, properties, and items. Returns a valid boolean plus an errors array where each entry has a JSONPath-style path and a human-readable message.

Parameters

objectrequired

The value to validate. Any JSON type is accepted.

objectrequired

The JSON Schema object to validate against.

Code examples

curl -X POST https://api.botoi.com/v1/schema/validate \
  -H "Content-Type: application/json" \
  -d '{"data":{"name":"","age":-1},"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","minLength":1},"age":{"type":"number","minimum":0}}}}'

When to use this API

Validate webhook payloads at ingest

Store the JSON Schema for each webhook source. When a payload arrives, validate before processing. Invalid payloads return a 400 with the specific path errors, saving your team from debugging downstream failures.

Config-file validation in CI

Ship a schema for your project's YAML/JSON config. In CI, load the file, convert to JSON (yaml-to-json), and validate. Catches config typos before deploy.

Form validation mirroring server rules

Define validation rules as JSON Schema once. Client-side, use the same schema via this endpoint to keep validation in sync between browser and server without duplicating rules.

Frequently asked questions

Which draft-07 features are supported?
type (string, number, integer, boolean, null, object, array), enum, minLength, maxLength, pattern, minimum, maximum, required, properties, items. Missing: $ref, allOf, anyOf, oneOf, not, additionalProperties. For those, use Ajv locally.
How are nested errors reported?
Each error has a JSONPath-style path: $.user.address.city for nested objects, $.items[0].name for arrays. Multiple errors are returned in a single response.
Does it short-circuit on the first error?
No. All errors are collected and returned. Exception: when a type check fails, the sub-schema is skipped (avoids follow-on errors that are just noise).
Can I validate against a URL-referenced schema?
Not directly. $ref is not resolved. Inline the referenced definitions into your schema before calling, or dereference client-side first.
What about strict vs. non-strict validation?
Non-strict. Properties not declared in the schema are allowed (additionalProperties is ignored). For strict mode, use /v1/schema/openapi-validate on the spec level instead.

Get your API key

Free tier includes 5 requests per minute with no credit card required. Upgrade for higher limits.