Documentation

HTTP API Reference

Zero-key public read endpoints backed by the X Layer SQLite snapshot, plus live badge SVG shields and EIP-712 seller signing.

Base URLhttps://usezhen.xyz/api/v1
AuthNone for reads
Sign limit10 req/min / IP
01

GET /api/v1/check

Returns a public verdict JSON object with checkedAtBlock, verdictHash, level, and public findings. Supports four lookup modes:

# 1. By TapeOut dot-name (circuit, processor.circuit, or task.processor.circuit)
curl "https://usezhen.xyz/api/v1/check?name=1961.2.323"

# 2. By processor address + circuit ID
curl "https://usezhen.xyz/api/v1/check?processor=0x87bfca3494aa228ff589ab9b642143a5e8c8f9a6&id=1961"

# 3. By processor address alone
curl "https://usezhen.xyz/api/v1/check?processor=0x87bfca3494aa228ff589ab9b642143a5e8c8f9a6"

# 4. By untaped netlist hash (plus optional behaviour fingerprint & PoD cost)
curl "https://usezhen.xyz/api/v1/check?netlistId=<32-byte-hash>&fpHash=<hash>&cost=351"

For untaped designs, compute netlistId and fpHash locally on /check so raw netlist bytes never leave the browser.

02

GET /api/v1/badge/svg

Reads ZhenRegistry.isVerified live from X Layer and returns a cache-friendly image/svg+xml shield for marketplaces, docs, and README embeds.

curl "https://usezhen.xyz/api/v1/badge/svg?processor=0x87bfca3494aa228ff589ab9b642143a5e8c8f9a6&id=1961"

# Markdown embed
[![Zhen status](https://usezhen.xyz/api/v1/badge/svg?processor=0x87bfca3494aa228ff589ab9b642143a5e8c8f9a6&id=1961)](https://usezhen.xyz/c/0x87bfca3494aa228ff589ab9b642143a5e8c8f9a6/1961)
03

POST /api/v1/badge/sign

Issues a short-lived (15-minute) EIP-712 signature bound to the caller wallet address (seller), subject, verdictHash, checkedAtBlock, and a 256-bit nonce. Refuses danger verdicts, duplicates, common templates, and hidden findings.

curl -X POST "https://usezhen.xyz/api/v1/badge/sign" \
  -H "content-type: application/json" \
  -d '{
    "kind": "circuit",
    "processor": "0x87bfca3494aa228ff589ab9b642143a5e8c8f9a6",
    "id": "80",
    "seller": "0xYourWalletAddress"
  }'
04

Agent discovery, RSS watchlist & embed

All read endpoints send Access-Control-Allow-Origin: * and OPTIONS preflight headers so bots, marketplaces, and browser-hosted X Layer DeWEB frontends can query Zhen directly.

Beyond 100 free daily checks per IP/wallet, agents pay $0.005 USD₮0 on /api/v1/check or $0.02 USD₮0 on /api/v1/deep-check (EIP-712 signed) using OKX x402:

import { wrapFetchWithPayment, x402Client } from '@okxweb3/x402-fetch'
import { ExactEvmScheme } from '@okxweb3/x402-evm/exact/client'

const client = new x402Client().register('eip155:196', new ExactEvmScheme(evmSigner))
const fetchWithPay = wrapFetchWithPayment(fetch, client)
const res = await fetchWithPay('https://usezhen.xyz/api/v1/deep-check?name=1056.2.323')
  • /openapi.json — OpenAPI 3.1.0 schema
  • /llms.txt — LLM & agent quick guide
  • /.well-known/agent.json — Agent capability manifest (eip155:196)
  • GET /api/v1/watch?targets=80.2.323,1056.2.323,task:100&format=rss — Live JSON / RSS 2.0 watchlist alerts (open, no signup)
  • POST /api/v1/webhooks — Register up to 3 EIP-712 signed webhooks per address (ZhenAlertWebhook/1/196)
  • <script src="https://usezhen.xyz/embed.js" data-zhen="1056.2.323" async></script> — Drop-in provenance card widget
// Register & verify signed Zhen alert webhooks (EIP-712 ZhenAlertWebhook/1/196)
import { keccak256, toBytes, verifyTypedData } from 'viem'

const bodyHash = keccak256(toBytes(rawBody))
const ok = await verifyTypedData({
  address: headers['x-zhen-signer'],
  domain: { name: 'ZhenAlertWebhook', version: '1', chainId: 196 },
  types: {
    AlertEvent: [
      { name: 'eventId', type: 'string' },
      { name: 'webhookId', type: 'string' },
      { name: 'kind', type: 'string' },
      { name: 'severity', type: 'string' },
      { name: 'target', type: 'string' },
      { name: 'block', type: 'uint64' },
      { name: 'timestamp', type: 'uint64' },
      { name: 'bodyHash', type: 'bytes32' },
    ],
  },
  primaryType: 'AlertEvent',
  message: {
    eventId: headers['x-zhen-event-id'],
    webhookId: headers['x-zhen-webhook-id'],
    kind: payload.event.kind,
    severity: payload.event.severity,
    target: payload.event.target,
    block: BigInt(payload.event.block),
    timestamp: BigInt(headers['x-zhen-timestamp']),
    bodyHash,
  },
  signature: headers['x-zhen-signature'],
})
05

Verify a verdict yourself (Merkle anchoring)

Each index snapshot has a Merkle root over the public verdict of every circuit and processor. The root is posted to the ZhenAnchor contract on X Layer, so a verdict can be checked against the chain without trusting Zhen’s server. Every verdict page has a “Verify this yourself” panel that does the check in your browser.

  • Contract: 0xb29e3974d4819aa0907205077475449363a8c006 (eip155:196, explorer)
  • Read: rootAt(uint64 snapshotBlock), latestRoot(), latestBlock(), anchorCount()
  • API: /api/v1/check adds proof and anchor for any verdict that is in the snapshot’s tree. anchor.anchored is false for a snapshot whose root has not been posted yet.
PartDefinition (zhen-merkle-v1)
subjectIdkeccak256(abi.encode(uint8 1, address processor, uint256 id)) for a circuit; the address left-padded to 32 bytes for a processor
verdictHashkeccak256 of the canonical JSON {v:1, subject, level, checkedAtBlock, findings:[{code, severity, data}]} (keys sorted)
leafkeccak256(0x00 ‖ subjectId ‖ verdictHash)
nodekeccak256(0x01 ‖ min(a, b) ‖ max(a, b)) so a proof is only the sibling hashes; leaves are sorted by subjectId and an odd node moves up unchanged
# 1. Get a verdict with its proof
curl "https://usezhen.xyz/api/v1/check?name=1056.2.323"

# 2. Recompute verdictHash from the verdict, build the leaf, fold proof.proof with the node rule,
#    and compare with the root the contract holds for proof.snapshotBlock:
cast call 0xb29e3974d4819aa0907205077475449363a8c006 "rootAt(uint64)(bytes32)" <snapshotBlock> --rpc-url https://rpc.xlayer.tech

# Or run the independent checker. Download it from this site (it needs only @noble/hashes):
curl -O https://usezhen.xyz/verify.mjs && npm install @noble/hashes
node verify.mjs 1056.2.323 --anchor 0xb29e3974d4819aa0907205077475449363a8c006 --rpc https://rpc.xlayer.tech

A snapshot can be checked once its root has been posted; a newer snapshot shows anchored: false until then. Roots already posted stay on-chain, so a proof saved from an anchored snapshot keeps verifying against rootAt(snapshotBlock).