API Acre · Data Schema Validate

by API Acre

POSTBaseSolana

$0.01

per call · USD Coin on Base

Validate JSON data against a bounded JSON Schema Draft 2020-12 contract for nested objects, arrays, required properties, types, enums, formats, lengths, patterns, and numeric bounds; return deterministic instance and schema JSON Pointers, explicit error truncation, input hashes, and no remote reference resolution.

Endpoint

POST https://apiacre.com/v1/data/schema-validate

3

Calls / 30d

2

Unique payers / 30d

Aug 31

Last called

exact

Payment scheme

Call this service

TypeScript · @x402/fetch
import { wrapFetchWithPayment } from "@x402/fetch";
import { privateKeyToAccount } from "viem/accounts";

const account = privateKeyToAccount(process.env.PRIVATE_KEY);
const fetchWithPay = wrapFetchWithPayment(fetch, account);

const res = await fetchWithPay("https://apiacre.com/v1/data/schema-validate", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "check_formats": true,
    "instance": {
      "name": "Ada",
      "score": "98"
    },
    "max_errors": 25,
    "schema": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "additionalProperties": false,
      "properties": {
        "name": {
          "minLength": 1,
          "type": "string"
        },
        "score": {
          "minimum": 0,
          "type": "integer"
        }
      },
      "required": [
        "name",
        "score"
      ],
      "type": "object"
    }
  }),
});
const data = await res.json();
cURL
curl -X POST \
  "https://apiacre.com/v1/data/schema-validate" \
  -H "Content-Type: application/json" \
  -d '{"check_formats":true,"instance":{"name":"Ada","score":"98"},"max_errors":25,"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":false,"properties":{"name":{"minLength":1,"type":"string"},"score":{"minimum":0,"type":"integer"}},"required":["name","score"],"type":"object"}}' \
  -H "X-PAYMENT: <signed x402 payment>"

Example response

{
  "data": {
    "errorCount": 1,
    "errorCountExact": true,
    "errors": [
      {
        "instancePath": "/score",
        "keyword": "type",
        "kind": "instance",
        "message": "'98' is not of type 'integer'",
        "schemaPath": "/properties/score/type"
      }
    ],
    "errorsReturned": 1,
    "errorsTruncated": false,
    "instance": {
      "sha256": "43d117eb76b608a0d05820c70320889a6577ff85446e00412b6e6487c1559149",
      "utf8Bytes": 27
    },
    "instanceValid": false,
    "schema": {
      "declaredDialect": "https://json-schema.org/draft/2020-12/schema",
      "dialect": "https://json-schema.org/draft/2020-12/schema",
      "remoteReferencesAllowed": false,
      "sha256": "9565a3dfc9aaadfaf2b3163f433b954d7d91246b6c225c11a8c16fe42ae841e4",
      "utf8Bytes": 224
    },
    "schemaValid": true,
    "valid": false,
    "validation": {
      "draft": "2020-12",
      "engine": "python-jsonschema",
      "engineVersion": "4.26.0",
      "formatChecking": true,
      "maxErrors": 25
    }
  },
  "meta": {
    "cached": false,
    "duration_ms": 42,
    "next_actions": [
      {
        "method": "POST",
        "path": "/v1/data/schema",
        "reason": "Infer the rejected instance's observed Draft 2020-12 shape for comparison wit...",
        "service": "data.schema",
        "title": "JSON Schema generator"
      }
    ],
    "sources": [],
    "warnings": []
  },
  "request_id": "018f1f54-7f38-7ba2-8dc3-5f90272d9f1a",
  "service": "data.schema-validate",
  "version": "1"
}

Payment details

Pay to0xa0bfa4f07281c9b248dc3aed2217836bca24869b
AssetUSD Coin · 0x833589fcd6edb6e08f4c7c32d4f71b54bda02913
NetworksBase, Solana
Schemesexact

Is this your API?

Pin it to the top of Data & Enrichment and the homepage with a featured placement.

Get featured →

More from API Acre & similar services