# JSON Schema Guard for Agent Output

> JSON Schema Guard for Agent Output is a paid API for AI agents from api.fadeandco.workers.dev, paid per call via x402, $0.001/call, status unknown (last checked 2026-10-29).

Validates a JSON value against a JSON Schema (draft 2020-12 subset) and returns a valid/invalid result, error details with paths, and a sanitized copy with disallowed fields removed.

## Facts

- Endpoint: POST https://api.fadeandco.workers.dev/api/agent-intel/agent-json-schema-guard?utm_source=zero.xyz
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-29
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/json-schema-guard-for-agent-output-8fbbc69c
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_DKDL1giMwuY8siGUSLViJ

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 json-schema-guard-for-agent-output-8fbbc69c -d '<json body>'
```

Example prompt: Check this JSON object against my schema and tell me whether it's valid, what errors exist and where, and give me a cleaned copy with any extra fields removed.

## When to prefer this

Use this endpoint when you need to validate AI agent or LLM-generated JSON against a schema before passing it downstream, especially when you also need a sanitized output with disallowed fields stripped. Prefer this over client-side validation when you want a deterministic, server-side check with explicit error paths and automatic field removal. It is particularly well-suited for agentic pipelines where output structure must be enforced and unsupported schema keywords should surface as explicit failures rather than silent passes.

## Known failure modes

- Schema uses unsupported keywords ($ref, allOf, anyOf, oneOf, if/then, format) — returns an error rather than passing silently
- Input 'schema' field is not a valid object — will fail to parse
- Input 'value' is missing — validation cannot proceed
- Malformed JSON in request body — returns parse error
- Schema constraints conflict in ways the subset validator cannot handle

## How this service works

Checks an agent's JSON output against a JSON Schema (draft 2020-12 keywords: type, properties, required, additionalProperties, items, enum, const, length, pattern, minimum/maximum, item counts). Returns valid yes/no, each error with its path and the value with disallowed fields removed. $ref, allOf/anyOf/oneOf, if/then and format return an error instead of passing silently.

## Output

Returns a JSON object with: a 'valid' boolean, an 'errors' array where each entry includes the path and nature of the violation, a 'sanitized' copy of the input with disallowed fields removed, a 'removedFields' list of paths that were stripped, a 'checkedAt' ISO timestamp, and a note that unsupported keywords are rejected rather than silently ignored.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "value": {
   "description": "The JSON value to check (any JSON)"
  },
  "schema": {
   "type": "object",
   "description": "The JSON Schema"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "note": "Subset of JSON Schema 2020-12. Unsupported keywords are rejected, not ignored.",
  "valid": true,
  "errors": [],
  "source": "https://json-schema.org/draft/2020-12",
  "checkedAt": "2026-10-23T09:35:20.029Z",
  "sanitized": {
   "age": 36,
   "name": "Ada"
  },
  "removedFields": [
   "/extra"
  ]
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/json-schema-guard-for-agent-output-8fbbc69c/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.fadeandco.workers.dev](https://www.zero.xyz/host/api.fadeandco.workers.dev/llms.txt)
