# JSON Canon > Pay-per-call utilities for agents: JSON Schema validation + RFC 8785 canonicalization, CSV to JSON, JSON diff/patch (RFC 6902), PDF text and table extraction, and Mexican RFC/CURP/CLABE validation. USDC on Base via x402. No account, no API key. Network: eip155:8453 (Base). Asset: USDC (0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913). Pay to: 0x4a850515EfAad14b1c3dBD9288828076683b0b95. Facilitator: PayAI (https://facilitator.payai.network). Unpaid calls return HTTP 402 and a Payment-Required header; retry with PAYMENT-SIGNATURE. Failed calls (4xx) are not charged. ## Docs - [Home](https://json-canon-x402.fly.dev/): human-readable usage and prices - [OpenAPI](https://json-canon-x402.fly.dev/openapi.json): machine-readable contract (preferred discovery) - [x402 well-known](https://json-canon-x402.fly.dev/.well-known/x402): discovery document - [Examples](https://json-canon-x402.fly.dev/v1/example): free request/response samples for every tool - [Health](https://json-canon-x402.fly.dev/health): liveness and payment configuration - [MCP](https://json-canon-x402.fly.dev/mcp): remote MCP server (Streamable HTTP); server card at https://json-canon-x402.fly.dev/.well-known/mcp/server-card.json ## Paid endpoints ### Validate + canonicalize JSON — 0.01 USDC GET|POST https://json-canon-x402.fly.dev/v1/validate (MCP tool: `validate_json`) Validate a JSON instance against an optional JSON Schema and return RFC 8785 canonical JSON plus SHA-256. Request: ```json {"instance":{"total":"10.00","items":[{"qty":2,"price":"5.00"}]},"schema":{"type":"object","required":["total","items"],"properties":{"total":{"type":"string"},"items":{"type":"array"}}},"canonicalize":true} ``` Response (abridged): ```json {"valid":true,"errors":[],"canonical":"{\"items\":[{\"price\":\"5.00\",\"qty\":2}],\"total\":\"10.00\"}","sha256":"a5f41d83fa6b2add743d818140bec00a7a4bc5ce02aed71182488be27f189547","bytes":52} ``` ### CSV to JSON with type inference — 0.01 USDC POST https://json-canon-x402.fly.dev/v1/csv-to-json (MCP tool: `csv_to_json`) Convert CSV to JSON rows with per-column type inference (integer, number, boolean, null, string), delimiter auto-detection and a generated JSON Schema. Leading-zero codes (ZIP, CLABE) stay strings. Request: ```json {"csv":"sku,qty,price,active,zip\nA-1,10,2.50,true,01234\nB-2,5,1.25,false,"} ``` Response (abridged): ```json {"columns":[{"name":"sku","type":"string"},{"name":"qty","type":"integer"},{"name":"price","type":"number"},{"name":"active","type":"boolean"},{"name":"zip","type":"string"}],"rows":[{"sku":"A-1","qty":10,"price":2.5,"active":true,"zip":"01234"},{"sku":"B-2","qty":5,"price":1.25,"active":false,"zip":null}],"row_count":2,"delimiter":",","header":true,"output":"objects","warnings":[]} ``` - Send either 'csv' or 'csv_base64'. ### JSON diff (RFC 6902 patch) — 0.01 USDC POST https://json-canon-x402.fly.dev/v1/json-diff (MCP tool: `json_diff`) Compare two JSON documents and return the RFC 6902 JSON Patch that turns source into target, plus canonical SHA-256 of each side. Request: ```json {"source":{"name":"Ana","tags":["a"],"age":30},"target":{"name":"Ana","tags":["a","b"],"city":"CDMX"}} ``` Response (abridged): ```json {"equal":false,"patch":[{"op":"remove","path":"/age"},{"op":"add","path":"/city","value":"CDMX"},{"op":"add","path":"/tags/1","value":"b"}],"operation_count":3,"operations_by_type":{"remove":1,"add":2},"source_sha256":"f0cec6d5599fbef45ae877a8a52e5fbdcd8852d7b7606da7711670ac59edb0af","target_sha256":"f813c9b470309ce79a4217746b45b6a39a7f269519e420936b3f8af89a482e2e","media_type":"application/json-patch+json"} ``` ### Apply JSON Patch (RFC 6902) — 0.01 USDC POST https://json-canon-x402.fly.dev/v1/json-patch (MCP tool: `json_patch`) Apply an RFC 6902 JSON Patch to a JSON document and return the result and its canonical SHA-256. Failed 'test' ops return 409 and are not charged. Request: ```json {"document":{"name":"Ana","tags":["a"]},"patch":[{"op":"add","path":"/tags/-","value":"b"},{"op":"replace","path":"/name","value":"Ana R."}]} ``` Response (abridged): ```json {"result":{"name":"Ana R.","tags":["a","b"]},"operation_count":2,"sha256":"d69237f38becabc7c60e755fd7050f3f963b872ac23029ada315c9ecdb4c2f78"} ``` ### PDF text extraction — 0.02 USDC POST https://json-canon-x402.fly.dev/v1/pdf-text (MCP tool: `pdf_text`) Extract text per page from a PDF given by public URL or base64 (max 4 MiB, 100 pages). No OCR: scanned PDFs are flagged as likely_scanned. Request: ```json {"url":"https://json-canon-x402.fly.dev/samples/invoice.pdf"} ``` Response (abridged): ```json {"page_count":1,"pages":[{"page":1,"text":"Factura de prueba 1\nCliente: ACME SA de CV. Total: 1,234.50 MXN\nSKU\n...","chars":157}],"total_chars":157,"likely_scanned":false,"pages_truncated":false} ``` - Send exactly one of 'url' or 'pdf_base64'. - Failures (not a PDF, encrypted, too large) return 4xx and are not charged. ### PDF table extraction — 0.04 USDC POST https://json-canon-x402.fly.dev/v1/pdf-tables (MCP tool: `pdf_tables`) Extract tables (rows and header-keyed records) from a PDF given by public URL or base64 (max 4 MiB, 30 pages). 'lines' strategy for ruled tables, 'text' for whitespace-aligned ones. Request: ```json {"url":"https://json-canon-x402.fly.dev/samples/invoice.pdf"} ``` Response (abridged): ```json {"page_count":1,"table_count":1,"tables":[{"page":1,"index":0,"rows":[["SKU","Descripcion","Cantidad","Precio"],["A-1","Tornillo","10","2.50"]],"records":[{"SKU":"A-1","Descripcion":"Tornillo","Cantidad":"10","Precio":"2.50"}]}],"pages_truncated":false} ``` - Send exactly one of 'url' or 'pdf_base64'. ### Validate Mexican RFC (SAT) — 0.01 USDC GET|POST https://json-canon-x402.fly.dev/v1/mx/rfc (MCP tool: `mx_rfc`) Validate a Mexican RFC tax ID (persona física or moral): format, embedded date, homoclave and SAT check digit. Offline; does not query SAT. Request: ```json {"value":"SAT970701NN3"} ``` Response (abridged): ```json {"type":"rfc","input":"SAT970701NN3","normalized":"SAT970701NN3","valid":true,"errors":[],"details":{"person_type":"moral","name_letters":"SAT","homoclave":"NN3","date":"1997-07-01","date_meaning":"incorporation date"},"check_digit":{"expected":"3","actual":"3","valid":true}} ``` ### Validate Mexican CURP (RENAPO) — 0.01 USDC GET|POST https://json-canon-x402.fly.dev/v1/mx/curp (MCP tool: `mx_curp`) Validate a Mexican CURP: format, birth date, sex, state code, internal consonants and RENAPO check digit. Offline; does not query RENAPO. Request: ```json {"value":"BOXW310820HNERXN09"} ``` Response (abridged): ```json {"type":"curp","input":"BOXW310820HNERXN09","normalized":"BOXW310820HNERXN09","valid":true,"errors":[],"details":{"birth_date":"1931-08-20","sex":"male (hombre)","state_code":"NE","state":"Born abroad (Nacido en el extranjero)","name_letters":"BOXW","internal_consonants":"RXN","century_hint":"born before 2000"},"check_digit":{"expected":"9","actual":"9","valid":true}} ``` ### Validate Mexican CLABE (SPEI) — 0.01 USDC GET|POST https://json-canon-x402.fly.dev/v1/mx/clabe (MCP tool: `mx_clabe`) Validate an 18-digit Mexican CLABE bank account: SPEI bank code (with bank name), plaza, account and check digit. Offline; does not confirm the account exists. Request: ```json {"value":"002010077777777771"} ``` Response (abridged): ```json {"type":"clabe","input":"002010077777777771","normalized":"002010077777777771","valid":true,"errors":[],"details":{"bank_code":"002","bank_name":"Banamex","plaza_code":"010","account_number":"07777777777"},"check_digit":{"expected":"1","actual":"1","valid":true}} ``` ## Optional Do not send secrets, private keys, or payment credentials in request bodies. Bodies are not stored; only request metrics (path, status, outcome) are kept.