API Reference

JSON Validator

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.

JSON Schema Draft-07detailed error pathscustom rulesbusiness rule validation

Endpoint

POST /v1/json/validate
Authentication: Include your API key in the X-API-Key header with every request. All requests go through the API gateway which handles authentication, rate limiting, and usage tracking.
Open Swagger UI (interactive docs)

Request

{
  "document": {
    "name": "John",
    "age": "not-a-number"
  },
  "schema": {
    "type": "object",
    "properties": {
      "name": {
        "type": "string"
      },
      "age": {
        "type": "integer"
      }
    }
  }
}

Request Fields

FieldTypeDescription
document object Nested object with properties
schema object Nested object with properties

Response

{
  "valid": false,
  "errors": [
    {
      "path": "$.age",
      "message": "expected integer, got string",
      "rule": "TYPE_MISMATCH"
    }
  ],
  "errorCount": 1
}

Response Fields

FieldTypeDescription
valid boolean Whether the input is valid
errors array Array of items
errorCount integer Field value

Error Codes

StatusMeaning
200Request completed successfully
400Bad request — invalid or missing parameters
401Missing or invalid X-API-Key header
429Rate limit exceeded — check Retry-After header
500Internal server error

Common Error Scenarios

400 Invalid JSON

Request 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 failed

Request 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.

Code Examples

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"
  }
}

API Reference