# CanonicalHash Structured JSON Extraction

> CanonicalHash Structured JSON Extraction is a paid API for AI agents from canonicalhash-production.up.railway.app, paid per call via x402, $0.005/call, status unknown (last checked 2026-10-30).

Extracts structured, typed fields from messy or unstructured text using an optional JSON schema, returning results with an EIP-712 signed attestation for tamper-proof verification.

## Facts

- Endpoint: POST https://canonicalhash-production.up.railway.app/v1/structure/paid?utm_source=zero.xyz
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-30
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/canonicalhash-structured-json-extraction-8ffd0085
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_Omxz4UWJcrVkQQT6gJu1Y

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 canonicalhash-structured-json-extraction-8ffd0085 -d '<json body>'
```

Example prompt: Pull structured fields — name, email, company, amount, and due date — from this messy invoice text: 'Bill to Alice Smith at alice@example.com, ACME Corp owes $1,250 by November 1st, 2026.' Return the results with a signed attestation I can verify later.

## When to prefer this

Choose this endpoint when you need to turn free-form, unstructured text (emails, invoices, form submissions, notes) into typed, machine-readable JSON fields and want a cryptographically signed EIP-712 attestation alongside the result for auditability or downstream verification. Prefer it over generic LLM extraction when you need tamper-evident provenance on the extracted data, or when integrating into a pipeline that validates results against /.well-known/pubkey.json. It is especially valuable in financial, legal, or compliance contexts where you need a verifiable paper trail tied to a blockchain-compatible signature.

## Known failure modes

- Text is too ambiguous or short to extract meaningful fields — returns low confidence score or empty structured object
- Optional schema specifies fields that cannot be found in the text — missing fields returned as null with reduced confidence
- Payment not settled or invalid transaction — returns payment error, extraction not performed
- Malformed input JSON — returns 400 validation error
- Schema provided does not conform to JSON Schema spec — returns schema validation error
- Service unavailable on Railway infrastructure — returns 503 or timeout

## How this service works

Deterministic JSON hashing and structured extraction for AI agents. Three paid routes: /v1/canonicalize (RFC 8785 canonicalization + SHA-256/512 + EIP-712 attestation, $0.002), /v1/canonicalize/batch (up to 1000 payloads, $0.01), /v1/structure/paid (structured JSON extraction from messy text, $0.005). Every successful response includes an EIP-712 signed attestation verifiable against /.well-known/pubkey.json. Verify any attestation for free at POST /v1/verify.

## Output

Returns a JSON object containing: extracted structured fields (keyed by schema or inferred), the number of extracted and requested fields, a confidence score (0–1), elapsed processing time in milliseconds, the extraction method, an EIP-712 signed attestation with signer address, chain ID, and issued timestamp, and payment settlement details including transaction hash.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "text": {
   "type": "string",
   "description": "Messy text to extract structured data from."
  },
  "schema": {
   "type": "object",
   "description": "Optional JSON Schema describing the fields to extract."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "tier": 1,
  "method": "deterministic",
  "signer": "0x0326f9783c9C9b9De8b9dC63cCCefDC75A95C7cD",
  "payment": {
   "txHash": "0x...truncated",
   "settled": true
  },
  "success": true,
  "chain_id": 8453,
  "issued_at": "2026-10-16T00:00:00.000Z",
  "signature": "0x7a1c...truncated",
  "confidence": 0.98,
  "elapsed_ms": 12,
  "structured": {
   "name": "Alice Smith",
   "email": "alice@example.com",
   "amount": 1250,
   "company": "ACME Corp",
   "due_date": "2026-11-01"
  },
  "attestation_type": "EIP-712",
  "extracted_fields": 5,
  "requested_fields": 5
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/canonicalhash-structured-json-extraction-8ffd0085/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from canonicalhash-production.up.railway.app](https://www.zero.xyz/host/canonicalhash-production.up.railway.app/llms.txt)
