Validate JSON documents against JSON Schema with detailed error reporting
Validate JSON documents against JSON Schema definitions with detailed, path-specific error reporting. JSON validation catches malformed payloads, missing required fields, and type mismatches before they cause downstream failures — essential for API gateways, data ingestion pipelines, and configuration management systems.
X-API-Key header with every request.
All requests go through the API gateway which handles authentication, rate limiting, and usage tracking.
{
"document": {
"name": "John",
"age": "not-a-number"
},
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"age": {
"type": "integer"
}
}
}
}
| Field | Type | Description |
|---|---|---|
document |
object |
Nested object with properties |
schema |
object |
Nested object with properties |
{
"valid": false,
"errors": [
{
"path": "$.age",
"message": "expected integer, got string",
"rule": "TYPE_MISMATCH"
}
],
"errorCount": 1
}
| Field | Type | Description |
|---|---|---|
valid |
boolean |
Whether the input is valid |
errors |
array |
Array of items |
errorCount |
integer |
Field value |
| Status | Meaning |
|---|---|
200 | Request completed successfully |
400 | Bad request — invalid or missing parameters |
401 | Missing or invalid X-API-Key header |
429 | Rate limit exceeded — check Retry-After header |
500 | Internal server error |
400 Invalid JSONRequest that triggers this:
{"json": "{invalid json}"}
Error response:
{"type": "/problems/validation-error", "title": "Invalid JSON", "status": 400, "detail": "JSON syntax error at position 1"}
How to fix: Ensure the JSON is valid. Check for missing quotes, commas, or brackets. Use a JSON linter.
400 Schema validation failedRequest that triggers this:
{"json": "{\"age\": \"not a number\"}", "schema": "{\"type\": \"object\", \"properties\": {\"age\": {\"type\": \"number\"}}}"}
Error response:
{"type": "/problems/validation-error", "title": "Schema Validation Failed", "status": 400, "detail": "Data does not match schema: age must be a number"}
How to fix: Ensure the JSON data matches the provided schema. Check field types and required properties.
curl -X POST /v1/json/validate \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{
"document": {
"name": "John",
"age": "not-a-number"
},
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"age": {
"type": "integer"
}
}
}
}'
// Node.js (18+) or modern browser
const response = await fetch("/v1/json/validate", {
method: "POST",
headers: {
"X-API-Key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
"document": {
"name": "John",
"age": "not-a-number"
},
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"age": {
"type": "integer"
}
}
}
}),
});
const data = await response.json();
console.log(response.status, data);
import requests
response = requests.post(
"/v1/json/validate",
headers={
"X-API-Key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
json={
"document": {
"name": "John",
"age": "not-a-number"
},
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"age": {
"type": "integer"
}
}
}
},
)
print(response.status_code)
print(response.json())
package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
body := strings.NewReader(`{
"document": {
"name": "John",
"age": "not-a-number"
},
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"age": {
"type": "integer"
}
}
}
}`)
req, _ := http.NewRequest("POST", "/v1/json/validate", body)
req.Header.Set("X-API-Key", "YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
data, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode)
fmt.Println(string(data))
}
{
"name": "json_validator",
"description": "Validate JSON documents against JSON Schema with detailed error reporting",
"inputSchema": {
"type": "object",
"properties": {
"api_key": {"type": "string", "description": "Your Orovai API key"},
"request": {"type": "object", "description": "Request body"}
},
"required": ["api_key", "request"]
},
"endpoint": "/v1/json/validate",
"method": "POST",
"headers": {
"X-API-Key": "{{api_key}}",
"Content-Type": "application/json"
}
}