# DataGate x402 JSON Validation

> DataGate x402 JSON Validation is a paid API for AI agents from datagate-x402.onrender.com, paid per call via x402, $0.05/call, status unknown (last checked 2026-09-15).

Validates a batch of JSON records against explicit quality rules (type checks, required fields, nullability, ranges, duplicates, date formats) and returns structured violations without modifying the input data.

## Facts

- Endpoint: POST https://datagate-x402.onrender.com/validate
- Price: $0.05/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/datagate-x402-json-validation-9012794d
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap__VwtAa26IPeeRM8MXir9k

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability datagate-x402-json-validation-9012794d -d '<json body>'
```

Example prompt: Can you validate this batch of user records — make sure 'email' and 'user_id' are required, 'age' is an integer between 0 and 120, 'email' can't be null, and flag any duplicate records by 'user_id' as a hard failure?

## When to prefer this

Choose this endpoint when you need to validate batches of JSON records against an explicit, machine-readable contract before processing or storing them — especially when you want structured violation reports rather than silent failures. Prefer it over ad-hoc client-side validation when you need consistent, auditable quality gates in ETL pipelines, API ingestion flows, or data quality monitoring jobs. It is ideal when callers want to declare their contract up front (required fields, types, ranges, nullability, duplicates, date formats) and receive actionable structured errors per record.

## Known failure modes

- Malformed input (data is not an array of objects) returns a 4xx error
- Invalid rule configuration (e.g. unknown type enum value) causes a validation error
- Empty data array with no rules may return an empty violations list
- Missing required top-level fields in the request body causes a schema error
- Payment not included or insufficient USDC triggers a 402 Payment Required response
- Records with deeply nested fields may not be inspected beyond the top level

## How this service works

Validate JSON data against explicit quality rules without modifying the supplied data.

## Output

Returns a structured report of validation violations per record, including field-level errors for type mismatches, missing required fields, out-of-range values, nullability breaches, date format failures, and duplicate record warnings or hard failures — without altering the original input data.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "data": {
   "type": "array",
   "items": {
    "type": "object",
    "additionalProperties": true
   },
   "title": "Data"
  },
  "rules": {
   "type": "object",
   "title": "ValidationRules",
   "properties": {
    "types": {
     "type": "object",
     "title": "Types",
     "additionalProperties": {
      "enum": [
       "string",
       "integer",
       "number",
       "boolean",
       "date"
      ],
      "type": "string"
     }
    },
    "ranges": {
     "type": "object",
     "title": "Ranges",
     "additionalProperties": {
      "type": "object",
      "title": "RangeRule",
      "properties": {
       "max": {
        "anyOf": [
         {
          "type": "number"
         },
         {
          "type": "null"
         }
        ],
        "title": "Max",
        "default": null
       },
       "min": {
        "anyOf": [
         {
          "type": "number"
         },
         {
          "type": "null"
         }
        ],
        "title": "Min",
        "default": null
       }
      },
      "description": "Optional inclusive numeric range for a field."
     }
    },
    "nullable": {
     "type": "object",
     "title": "Nullable",
     "additionalProperties": {
      "type": "boolean"
     }
    },
    "duplicates": {
     "anyOf": [
      {
       "type": "object",
       "title": "DuplicateRule",
       "properties": {
        "fields": {
         "type": "array",
         "items": {
          "type": "string"
         },
         "title": "Fields"
        },
        "severity": {
         "enum": [
          "WARN",
          "FAIL"
         ],
         "type": "string",
         "title": "Severity",
         "default": "WARN"
        }
       },
       "description": "Duplicate detection configuration.\n\nIf fields is empty, the entire record is used as the duplicate key.\nDuplicate records default to WARN so callers can distinguish quality\nwarnings from hard schema failures."
      },
      {
       "type": "null"
      }
     ],
     "default": null
    },
    "date_formats": {
     "type": "object",
     "title": "Date Formats",
     "additionalProperties": {
      "type": "string"
     }
    },
    "required_fields": {
     "type": "array",
     "items": {
      "type": "string"
     },
     "title": "Required Fields"
    }
   },
   "description": "Machine-readable validation contract for a batch of JSON records.\n\nThis keeps the proven Artifact Handoff pattern: the caller decl
… (truncated)
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/datagate-x402-json-validation-9012794d/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from datagate-x402.onrender.com](https://www.zero.xyz/host/datagate-x402.onrender.com/llms.txt)
