# Agent402 Schema Guard

> Agent402 Schema Guard is a paid API for AI agents from agent402.tools, paid per call via x402, $0.004/call, status unknown (last checked 2026-09-15).

Validates a JSON payload against a schema, infers the payload's implied schema, diffs the two to expose drift, and returns a normalized pretty-print — all in one call.

## Facts

- Endpoint: POST https://agent402.tools/api/skill/schema-guard
- Price: $0.004/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/agent402-schema-guard-965b853f
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_Zf7OYmIf6x5F5Gaajdmb4

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 agent402-schema-guard-965b853f -d '<json body>'
```

Example prompt: Can you contract-test this JSON payload against my schema — validate it, infer what schema the payload actually implies, show me the drift between the two, and return a normalized pretty-print? Here's the expected schema: {"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"}}} and the payload: {"id":"abc","name":"Alice","extra":true}.

## When to prefer this

Choose this endpoint when you need a single-call solution for JSON contract testing that combines validation, schema inference, drift detection, and normalization. Ideal for API development workflows, CI pipelines checking response conformance, or agents that need to verify a JSON payload against a spec without chaining multiple tools.

## Known failure modes

- Malformed JSON string for payload — returns parse error
- Malformed JSON Schema string — returns schema parse error
- Missing payload field — returns 400 bad request
- Schema and payload both missing — no meaningful diff possible
- Payment failure — x402 payment not accepted, returns 402

## How this service works

Bundled execution of the Schema guard workflow - Contract-test a JSON payload in one call: validate it against your schema, infer the schema the payload actually implies, diff the two to expose drift, and return a normalized pretty-print. One x402 payment runs 4 underlying tools (json-validate, json-schema-infer, json-diff, json-format); partial-success per step.

## Output

Returns a bundled result containing: (1) validation outcome of the payload against the provided schema, (2) the inferred schema the payload actually implies, (3) a diff between the expected and inferred schemas highlighting drift, and (4) a normalized, pretty-printed version of the payload.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "schema": {
   "type": "string",
   "description": "The expected JSON Schema (as a JSON string; defaults to none)"
  },
  "payload": {
   "type": "string",
   "description": "The JSON payload to check (as a JSON string)"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "args": {
   "schema": "{\"type\":\"object\",\"required\":[\"id\"]}",
   "payload": "{\"id\":1,\"name\":\"Ada\"}"
  },
  "pack": "schema-guard",
  "steps": [
   {
    "ok": true,
    "slug": "json-validate",
    "result": {}
   },
   {
    "ok": true,
    "slug": "json-schema-infer",
    "result": {}
   },
   {
    "ok": true,
    "slug": "json-diff",
    "result": {}
   },
   {
    "ok": true,
    "slug": "json-format",
    "result": {}
   }
  ],
  "summary": "4/4 steps succeeded"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/agent402-schema-guard-965b853f/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agent402.tools](https://www.zero.xyz/host/agent402.tools/llms.txt)
