Agent Tools 1 credit COMPUTE

JSON Schema Validate API

Validate JSON data against a JSON Schema (draft-07) via REST API. Returns all validation errors with JSON Pointer paths, making it easy to identify exactly which field failed and why — essential for validating LLM outputs, API responses, and user-submitted data.

Try it live →

How it works

POST a JSON data object and a JSON Schema object. The API runs full draft-07 validation including type checking, required fields, enum constraints, min/max, pattern matching, and array item validation. Returns valid: true or an array of error objects with paths and messages.

Use cases

API Reference

POST https://slopshop.gg/v1/json-schema-validate
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

Input parameters

ParameterTypeRequiredDescription
input string | object required The input data to process

Example response

{
  "data": {
    "result": "success",
    "processed": true
  },
  "meta": {
    "credits_used": 1,
    "engine": "real",
    "ms": 4
  }
}

Examples

Three real-world scenarios showing how developers use JSON Schema Validate in production.

Example 1
Validate LLM structured output
Verify that a JSON object extracted from an LLM response has the expected shape.
curl -X POST https://slopshop.gg/v1/json-schema-validate \
  -H "Authorization: Bearer $SLOPSHOP_KEY" \
  -H "Content-Type: application/json" \
  -d '{"data": {"name": "Alice", "email": "alice@example.com", "role": "admin"}, "schema": {"type": "object", "required": ["name", "email", "role"], "properties": {"name": {"type": "string"}, "email": {"type": "string", "format": "email"}, "role": {"type": "string", "enum": ["admin", "user"]}}}}'
Example 2
Validate incoming webhook payload
Check that a webhook payload has all required fields before processing.
curl -X POST https://slopshop.gg/v1/json-schema-validate \
  -H "Authorization: Bearer $SLOPSHOP_KEY" \
  -H "Content-Type: application/json" \
  -d '{"data": {"event": "order.created", "order_id": 1234}, "schema": {"type": "object", "required": ["event", "order_id"], "properties": {"event": {"type": "string"}, "order_id": {"type": "number"}}}}'
Example 3
Validate user-submitted config
Reject invalid configuration JSON from a user before saving it.
curl -X POST https://slopshop.gg/v1/json-schema-validate \
  -H "Authorization: Bearer $SLOPSHOP_KEY" \
  -H "Content-Type: application/json" \
  -d '{"data": {"timeout": "30s", "retries": 5}, "schema": {"type": "object", "properties": {"timeout": {"type": "number"}, "retries": {"type": "number", "maximum": 10}}}}'

Code examples

curl

curl -X POST https://slopshop.gg/v1/json-schema-validate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input": "your data here"}'

Python

import requests

response = requests.post(
    "https://slopshop.gg/v1/json-schema-validate",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={"input": "your data here"}
)
result = response.json()
print(result["data"])

Node.js

const response = await fetch("https://slopshop.gg/v1/json-schema-validate", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({ input: "your data here" })
});
const { data } = await response.json();
console.log(data);

CLI

# Install the Slopshop CLI
npm install -g slopshop

# Set your API key
export SLOPSHOP_KEY=your_api_key

# Call json-schema-validate
slop json-schema-validate '{"input": "your data here"}'

Pricing

Credits per call
1
credits
Cost per call
$0.001
at Starter tier
Tier
COMPUTE
Pure compute

Credits are purchased in bundles starting at $1 for 1,000 credits. All compute APIs like this one use 1 credit per call — that's $0.001. See all pricing tiers.

Related APIs in Agent Tools

View the full API catalog · Try in playground · Documentation