W

Workers · Json Validate

by Workers

POSTBase

$0.002

per call · USD Coin on Base

Validate JSON data against a JSON Schema (draft-07, 2019-09, 2020-12) — returns exact error locations, keywords, and messages for programmatic handling. Deterministic schema validation.

Endpoint

POST https://toolbelt402.tpoborne.workers.dev/json/validate

1

Calls / 30d

1

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://toolbelt402.tpoborne.workers.dev/json/validate", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "data": {
      "age": 3
    },
    "schema": {
      "properties": {
        "name": {
          "type": "string"
        }
      },
      "required": [
        "name"
      ],
      "type": "object"
    }
  }),
});
const data = await res.json();
cURL
curl -X POST \
  "https://toolbelt402.tpoborne.workers.dev/json/validate" \
  -H "Content-Type: application/json" \
  -d '{"data":{"age":3},"schema":{"properties":{"name":{"type":"string"}},"required":["name"],"type":"object"}}' \
  -H "X-PAYMENT: <signed x402 payment>"

Example response

{
  "errors": [
    {
      "error": "Instance does not have required property \"name\".",
      "keyword": "required",
      "location": "#"
    }
  ],
  "valid": false
}

Payment details

Pay to0x06b40bf8dfdc45049ea7f600c84301e227a2ca15
AssetUSD Coin · 0x833589fcd6edb6e08f4c7c32d4f71b54bda02913
NetworksBase
Schemesexact

Is this your API?

Pin it to the top of Other and the homepage with a featured placement.

Get featured →

More from Workers & similar services