{"openapi":"3.1.0","info":{"title":"Zhen Provenance API","version":"1.0.0","description":"Deterministic provenance, reference-cost, template, PoD tie-loss risk, and processor deployer checks for TapeOut circuits on X Layer (chain 196).","license":{"name":"MIT","url":"https://github.com/bunnyyxtan/zhen/blob/main/LICENSE"}},"servers":[{"url":"https://usezhen.xyz","description":"Zhen API (X Layer 196)"}],"x-zhen-x402":{"protocol":"x402","version":2,"paymentsEnabled":false,"launchMode":"Free during launch","network":"eip155:196","asset":"0x779Ded0c9e1022225f8E0630b35a9b54bE713736","symbol":"USD₮0","freeDailyChecks":100,"standardCheckUsd":"0.005","standardCheckAmount":"5000","deepCheckUsd":"0.02","deepCheckAmount":"20000"},"paths":{"/api/v1/check":{"get":{"operationId":"checkProvenance","summary":"Check provenance and risk (100 free/day, then $0.005 USD₮0 via x402)","parameters":[{"name":"name","in":"query","schema":{"type":"string","example":"1056.2.323"},"description":"TapeOut dot-name (<id>.2.<processorIdx>)."},{"name":"processor","in":"query","schema":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"},"description":"Processor contract address."},{"name":"id","in":"query","schema":{"type":"integer","minimum":1},"description":"Circuit token ID on the processor."},{"name":"netlistId","in":"query","schema":{"type":"string","pattern":"^0x[0-9a-fA-F]{64}$"},"description":"keccak256(uint32 nIn || uint32 nOut || netlist)."},{"name":"fpHash","in":"query","schema":{"type":"string","pattern":"^0x[0-9a-fA-F]{64}$"},"description":"Optional @zhen/core behaviour fingerprint."},{"name":"cost","in":"query","schema":{"type":"integer","minimum":1},"description":"Optional FabX PoD cost C."}],"responses":{"200":{"description":"Deterministic verdict with block height, verdictHash, and scope limits.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckResponse"},"examples":{"duplicate":{"value":{"query":"?name=1056.2.323","summary":"DUPLICATE of origin #363 (level: caution)"}},"reference":{"value":{"query":"?name=1961.2.323","summary":"REFERENCE_DESIGN + POD_REFERENCE_COST (level: clear)"}},"originLeader":{"value":{"query":"?name=80.2.323","summary":"ORIGIN + POD_LEADER (level: clear)"}},"template":{"value":{"query":"?name=48.2.265","summary":"COMMON_TEMPLATE (level: clear)"}}}}}},"400":{"description":"Invalid query parameters."},"402":{"description":"Payment required via OKX x402 ($0.005 USD₮0) after 100 free daily checks."},"404":{"description":"Subject not found on X Layer or in the snapshot."}}}},"/api/v1/deep-check":{"get":{"operationId":"deepCheckProvenance","summary":"Live-verified provenance check with EIP-712 signed receipt ($0.02 USD₮0 via x402)","parameters":[{"name":"name","in":"query","schema":{"type":"string","example":"1056.2.323"}},{"name":"processor","in":"query","schema":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"}},{"name":"id","in":"query","schema":{"type":"integer","minimum":1}},{"name":"netlistId","in":"query","schema":{"type":"string","pattern":"^0x[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Verdict plus live ownerOf/badge facts and EIP-712 DeepCheckReceipt signature."},"402":{"description":"Payment required via OKX x402 ($0.02 USD₮0)."}}}},"/api/v1/badge/svg":{"get":{"operationId":"badgeSvg","summary":"Render live ZhenRegistry badge status shield as image/svg+xml","parameters":[{"name":"name","in":"query","schema":{"type":"string"}},{"name":"processor","in":"query","schema":{"type":"string"}},{"name":"id","in":"query","schema":{"type":"integer","minimum":1}}],"responses":{"200":{"description":"SVG status shield.","content":{"image/svg+xml":{"schema":{"type":"string"}}}},"400":{"description":"Invalid subject parameters."}}}},"/api/v1/watch":{"get":{"operationId":"watchFeed","summary":"Check live provenance, PoD rank, and look-alike alerts for a watchlist as JSON or RSS 2.0 (open, no signup)","parameters":[{"name":"targets","in":"query","schema":{"type":"string","example":"80.2.323,1056.2.323,task:100"},"description":"Comma-separated targets (dot-name, processor, task:<id>, address:<0x>, name:<norm>)."},{"name":"format","in":"query","schema":{"type":"string","enum":["json","rss"],"default":"json"},"description":"Response format."}],"responses":{"200":{"description":"Watchlist status and self-explaining alert feed (JSON or RSS 2.0 XML)."}}}},"/api/v1/webhooks":{"get":{"operationId":"listWebhooks","summary":"List registered webhooks for ?ownerAddress=0x... (cap 3/address) or inspect delivery logs for ?id=wh_...","parameters":[{"name":"ownerAddress","in":"query","schema":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"}},{"name":"id","in":"query","schema":{"type":"string"},"description":"Webhook ID (requires Authorization: Bearer <manageToken>)."}],"responses":{"200":{"description":"Webhook list or delivery log."}}},"post":{"operationId":"registerWebhook","summary":"Register an EIP-712 signed alert webhook (free up to 3 per address; Pro alerts coming soon)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["ownerAddress","url","targets"],"properties":{"ownerAddress":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"},"url":{"type":"string","format":"uri"},"targets":{"type":"array","items":{"type":"string"},"maxItems":20},"label":{"type":"string"}}}}}},"responses":{"201":{"description":"Registered webhook, one-time manageToken, and ZhenAlertWebhook/1/196 signature spec."},"429":{"description":"Rate limit or 3-webhook-per-address cap reached."}}},"delete":{"operationId":"deleteWebhook","summary":"Delete a registered webhook (?id=wh_... with Bearer manageToken)","parameters":[{"name":"id","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Webhook deleted."}}}}},"components":{"schemas":{"Finding":{"type":"object","required":["code","severity","title","detail","data"],"properties":{"code":{"type":"string","enum":["ORIGIN","REFERENCE_DESIGN","COMMON_TEMPLATE","DUPLICATE","OWN_REMINT","TRIVIAL_DESIGN","ALREADY_TAPED_OUT","NO_MATCH","SAME_FUNCTION","OFFICIAL_PROCESSOR","IMPERSONATES_KNOWN","NAME_SHARED_EARLIER","NAME_CONTAINS_KNOWN","NAME_DEPLOYER_LOOKALIKES","NAME_CLEAR","NAME_SHARED_LATER","SAME_DEPLOYER","NO_CIRCUITS","POD_LEADER","POD_REFERENCE_COST","POD_NOT_BEST","POD_TIE_LOST","POD_FAILS_VECTORS","POD_INELIGIBLE_REF"]},"severity":{"type":"string","enum":["info","caution","danger"]},"title":{"type":"string"},"detail":{"type":"string"},"data":{"type":"object","additionalProperties":true}}},"Verdict":{"type":"object","required":["subject","level","checkedAtBlock","findings","verdictHash"],"properties":{"subject":{"type":"object","additionalProperties":true},"level":{"type":"string","enum":["clear","caution","danger"]},"checkedAtBlock":{"type":"integer"},"findings":{"type":"array","items":{"$ref":"#/components/schemas/Finding"}},"verdictHash":{"type":"string","description":"keccak256 of canonical verdict JSON signed by ZhenRegistry."}}},"CheckResponse":{"type":"object","required":["ok","verdict","live","limits"],"properties":{"ok":{"type":"boolean"},"verdict":{"$ref":"#/components/schemas/Verdict"},"live":{"type":"boolean"},"limits":{"type":"object","required":["chainId","checkedAtBlock","unseen"],"properties":{"chainId":{"type":"integer","const":196},"checkedAtBlock":{"type":"integer"},"unseen":{"type":"array","items":{"type":"string"}}}},"proof":{"type":"object","description":"Merkle inclusion proof (scheme zhen-merkle-v1). Recompute verdictHash from the verdict above (code, severity and data of each finding, plus subject, level and checkedAtBlock), then leaf = keccak256(0x00 || subjectId || verdictHash), and fold the sibling hashes with node = keccak256(0x01 || min(a,b) || max(a,b)). The result must equal root.","required":["scheme","snapshotBlock","root","subjectId","verdictHash","leaf","proof"],"properties":{"scheme":{"type":"string","const":"zhen-merkle-v1"},"snapshotBlock":{"type":"integer"},"root":{"type":"string"},"subjectId":{"type":"string"},"verdictHash":{"type":"string"},"leaf":{"type":"string"},"proof":{"type":"array","items":{"type":"string"}}}},"anchor":{"type":"object","description":"ZhenAnchor on eip155:196. anchored is true when the contract holds this proof's root for snapshotBlock (read rootAt(snapshotBlock)); false when that snapshot's root has not been posted yet.","required":["address","chainId","anchored","snapshotBlock","latestAnchoredBlock","explorer"],"properties":{"address":{"type":"string"},"chainId":{"type":"integer"},"anchored":{"type":"boolean"},"snapshotBlock":{"type":"integer"},"latestAnchoredBlock":{"type":["integer","null"]},"explorer":{"type":"string"}}}}}}}}