JSON Schema Validator
schema.validate_json
Overview
You send a JSON Schema and a document, and we tell you whether the document satisfies it. Every problem comes back with the exact place in your document it happened, the schema rule that rejected it, and a readable message, so you can fix the data or the schema without guessing. We speak Draft 2020-12, which is the default, plus Draft 2019-09 and Draft 7. Send both sides as strings, or as file references when they are large enough that escaping them into JSON would be painful. Accepts file input via file_ref — no need to extract file content first.
Deciding whether a document matches a contract is the check everything else rests on, and hand-rolling it means reimplementing a specification. You get a specification-compliant answer with the failing location named, every time.
Reliability
Deterministic: the same schema, document, and options always produce the same verdict and the same errors. The dialect comes from the draft option rather than from your schema's own $schema keyword, so set it deliberately when you are not on 2020-12. References within the document resolve normally; keep the schema self-contained, because nothing outside it is fetched for you. Format keywords are annotations until you turn formatValidation on. When something stops us before validation can run we return the recoverable failure JSON_MALFORMED with a message explaining which side was at fault: either side not being valid JSON, a schema the validator cannot compile, an unsupported draft, a schema over 524288 bytes, or a document over 2097152 bytes. Repairing the text with schema.repair_json clears the first case; the others need the input or the option changed rather than a retry. A missing schema or document, or a field of the wrong type, is rejected outright.
Context footprint
The schema is capped at 524288 bytes and the document at 2097152 bytes, with either side readable from a file up to 5000000 bytes; the response holds at most maxErrors short rows. A successful call costs 1 execution credit.
When to use it
Before you act on any JSON that is supposed to follow a schema you already have, and in tests where a contract must not drift.
When you do not have a schema yet, when you want two schema versions compared, or when the schema only makes sense with another document pulled in.
Powered by the networknt JSON Schema validator, a fast, spec-compliant validation engine for Draft 4 through 2020-12.
Scope
Non-goals
- We never work out a schema from your data — that is schema.infer_json_schema
- We never pull in another document, so send a self-contained schema
- We never merge, rewrite, or repair the schema or the document
Properties
Capabilities
Cost & billing
Flat rate per invocation
File handling
File limits
Constraints this skill applies to your input and generated files. The “Limited by” column shows the static source of each cap; none of these can be raised by upgrading your plan.
| Limit | Value | Limited by |
|---|---|---|
| Maximum size per input file | 4.8 MiB | Skill maximum |
How we handle your data
What this means
This skill may receive sensitive content, but it does not target sensitive data and returns only a structured non-sensitive result.
Squillify guarantees
- Runs inside Squillify
- This skill runs inside Squillify.
- Payloads are not sent to an external service by this skill.
- Squillify does not permanently store submitted payloads.
- Telemetry records metadata only, not submitted content.
- Submitted payloads are not used for training.
- Submitted payloads are not reviewed by humans.
- This skill does not target sensitive data.
- The response does not contain submitted content.
Your responsibility
Squillify does not determine whether submitted content is sensitive. Your application is responsible for deciding what data it is allowed to submit. Your application is responsible for securing the response.
Input schema
| Field | Type | Required | Description |
|---|---|---|---|
| schema | string | No | JSON Schema as a string, 1 to 524288 characters. Required unless schema_file_ref is provided. |
| schema_file_ref | string | No | Tenant-owned schema file reference; omit it to read schema. When both are sent this one wins. |
| instance | string | No | JSON document to check, 1 to 2097152 characters. Required unless instance_file_ref is provided. |
| instance_file_ref | string | No | Tenant-owned instance file reference; omit it to read instance. When both are sent this one wins. |
| draft | string | No | Dialect to validate under such as 2020-12, 2019-09 or draft7; omit it for 2020-12. The schema $schema keyword does not change this. |
| formatValidation | boolean | No | Whether format keywords are enforced; omit it for false. |
| maxErrors | integer | No | How many problems to list, 1 through 10000; omit it for 100. |
| failFast | boolean | No | Accepted and currently ignored; omit it. Set maxErrors to 1 for a single problem. |
Output schema
| Field | Type | Required | Description |
|---|---|---|---|
| valid | boolean | Yes | True when the document satisfies the schema completely. |
| errorCount | integer | Yes | How many problems were found before the list was trimmed. |
| errors | array | Yes | Problems in validator order, 0 through 10000 closed {path, schemaPath, keyword, message} objects; empty when valid. |
| draft | string | Yes | Meta-schema URL of the dialect actually used, so you can confirm the requested draft resolved correctly. |
| truncated | boolean | No | Present and true only when more problems existed than maxErrors listed; omit it when the list is complete. |
API contract
POST /v1/executecurl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"schema.validate_json","input":{"schema":"{\"type\":\"object\"}","instance":"{\"name\":\"Alice\"}"}}'import { Squillify } from "@squillify/sdk";
const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });
const { output } = await sq.execute("schema.validate_json", {"instance":"{\"name\":\"Alice\",\"age\":30}","schema":"{\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\"},\"age\":{\"type\":\"integer\"}},\"required\":[\"name\",\"age\"]}"});Errors
| Code | HTTP | Retryable | Description |
|---|---|---|---|
| VALIDATION_ERROR | 400 | No | The request payload failed schema validation. |
| UNAUTHORIZED | 401 | No | Missing or invalid API key. |
| SKILL_NOT_ACCESSIBLE | 403 | No | The API key is not granted access to this skill. |
| SKILL_NOT_AVAILABLE_FOR_PLAN | 403 | No | This skill is not included in your current plan. |
| PLAN_ELIGIBILITY_UNAVAILABLE | 503 | Yes | Plan eligibility could not be decided. Retry after backoff. |
| SKILL_NOT_FOUND | 404 | No | The requested skill or version does not exist. |
| TENANT_RATE_LIMITED | 429 | Yes | Request rate limit exceeded. Retry after backoff. |
| QUOTA_EXCEEDED | 429 | Yes | Plan quota exhausted. Retryable once the quota period resets. |
| EXECUTION_TIMEOUT | 504 | Yes | Execution exceeded the allowed time budget. |
| JSON_MALFORMED | 400 | No | The request payload failed this skill's input validation. |
Other limits
| Limit | Value |
|---|---|
| Recommended inline bytes | 32 KiB |
Limitations
- We never work out a schema from your data — that is schema.infer_json_schema
- We never pull in another document, so send a self-contained schema
- We never merge, rewrite, or repair the schema or the document
- Working out a schema from sample data (schema.infer_json_schema)
- Comparing two versions of a schema (schema.diff_json_schema)
- Schemas that depend on fetching another document
How to call
POST /v1/execute (requires authentication)
{
"skillKey": "schema.validate_json",
"input": {
"instance": "{\"name\":\"Alice\",\"age\":30}",
"schema": "{\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\"},\"age\":{\"type\":\"integer\"}},\"required\":[\"name\",\"age\"]}"
}
}Examples
Valid instance
{
"instance": "{\"name\":\"Alice\",\"age\":30}",
"schema": "{\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\"},\"age\":{\"type\":\"integer\"}},\"required\":[\"name\",\"age\"]}"
}{
"valid": true,
"errorCount": 0,
"draft": "https://json-schema.org/draft/2020-12/schema",
"errors": []
}Invalid instance with errors
{
"instance": "{\"name\":\"Bob\"}",
"schema": "{\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\"},\"age\":{\"type\":\"integer\"}},\"required\":[\"name\",\"age\"]}"
}{
"valid": false,
"errorCount": 1,
"draft": "https://json-schema.org/draft/2020-12/schema",
"errors": [
{
"path": "",
"schemaPath": "/required",
"message": "required property 'age' not found",
"keyword": "required"
}
]
}Recommended use cases
- Check a request or response against the contract before you act on it
- Stop a bad document at the edge of an ingestion pipeline
- Assert in a test that two services still agree on a payload shape
Avoid for
- Working out a schema from sample data (schema.infer_json_schema)
- Comparing two versions of a schema (schema.diff_json_schema)
- Schemas that depend on fetching another document
Related skills
Composable with
Safety & privacy
- Runs without calling any external service.
- Your payloads are never stored permanently.
- Telemetry captures metadata only — never your payload contents.
- We never train models on your payloads.
- No human reviews your payloads.