{"uid":"cap_jl-0Yr5m-y2bVLhoUO4V3","slug":"canonicalhash-5a1cead8","name":"CanonicalHash","description":"RFC 8785 JSON Canonicalization + SHA-256/SHA-512. Stable, deterministic hash of any JSON payload for idempotency keys, cache keys, and cross-runtime dedup.","url":"https://canonicalhash-production.up.railway.app/v1/canonicalize?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method","bodyType","body"],"properties":{"body":{"type":"object"},"type":{"type":"string","const":"http"},"method":{"enum":["POST","PUT","PATCH"],"type":"string"},"headers":{"type":"object","additionalProperties":{"type":"string"}},"bodyType":{"enum":["json","form-data","text"],"type":"string"},"queryParams":{"type":"object","additionalProperties":{"type":"string"}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object"}}}}},"responseSchema":{"type":"json","example":{"hash":"60196f74f027a2b2a0c2eb1143dd6cc1a2319c87479a846ed0d140e4bc2403e7","spec":"RFC 8785","success":true,"algorithm":"sha256","canonical":"{\"amount\":1.5,\"note\":\"example\",\"user_id\":42}"}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.002","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"registry","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.002/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_H7BO_dzUIJRsQoqWDvDot","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.002","costPer":"request","priority":0,"asset":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Produces a stable, deterministic SHA-256 or SHA-512 hash of any JSON payload using RFC 8785 canonicalization, suitable for idempotency keys, cache keys, and cross-runtime deduplication.","exampleAgentPrompt":"Can you canonicalize and SHA-256 hash this JSON payload for me so I can use it as an idempotency key: {\"user_id\": 42, \"amount\": 1.5, \"note\": \"hi\"}?","exampleUseCases":[{"title":"Idempotency key for payment requests","prompt":"Take this payment request JSON — {\"user_id\": 99, \"amount\": 250.00, \"currency\": \"USD\"} — and give me a SHA-256 canonical hash I can use as an idempotency key so duplicate submissions don't get processed twice."},{"title":"Cache key generation for API responses","prompt":"I need a stable cache key for this config object: {\"region\": \"us-east-1\", \"tier\": \"pro\", \"features\": [\"search\", \"analytics\"]}. Can you run it through RFC 8785 canonicalization and return the SHA-256 hash?"},{"title":"Cross-runtime JSON deduplication","prompt":"I'm getting the same event logged from two different services but the JSON key order differs — can you canonicalize both of these payloads with SHA-512 and tell me if they produce the same hash so I know they're actually duplicates?"}],"resultDescription":"Returns a JSON object containing the canonical JSON string (with keys sorted per RFC 8785), the hex-encoded SHA-256 or SHA-512 hash of that canonical form, the hashing algorithm used, input byte count, canonical byte count, and a success flag.","failureModes":["Missing 'payload' body parameter returns an error","Non-JSON or malformed payload may fail canonicalization","Unsupported algorithm value (not 'sha256' or 'sha512') returns validation error","Payment not settled or insufficient funds triggers 402 response","Network timeout on the Railway-hosted endpoint"],"whenToPreferThis":"Choose this endpoint when you need a language- and runtime-agnostic, reproducible hash of a JSON value — especially when key ordering may vary between producers. It is ideal for idempotency keys, cache key generation, and deduplication across heterogeneous systems. Prefer it over ad-hoc JSON serialization + hash because RFC 8785 guarantees canonical ordering, number formatting, and Unicode normalization.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-12T12:30:25.083Z","isFirstParty":false,"canonicalSlug":"canonicalhash-5a1cead8"}