API Reference

The Klarity read API exposes the mirrored ERC-7730 clear-signing registry: list and look up descriptors, and decode a call into its human-readable clear-signing view. All responses are JSON.

Every path below is relative to the API base. The web client resolves it from the NEXT_PUBLIC_KLARITY_API_BASE environment variable (see web/lib/api.ts), shown as {API_BASE} in the examples.

GET /descriptors

List mirrored descriptors matching one or more filters. A filterless query is rejected with 400, so at least one filter is required. Returns an array of descriptor rows.

Accepted filter query params: chainId (numeric), contract, selector, kind, intent, entityName, contractName, functionName, owner, sourcePath, source, eip712PrimaryType. Unknown params are ignored.

GET {API_BASE}/descriptors?chainId=1&entityName=1inch

[
  {
    "chainId": 1,
    "contract": "0x1111111254eeb25477b68fb85 ed929f73a960582",
    "selector": "0x12aa3caf",
    "functionName": "swap",
    "kind": "calldata",
    "intent": "Swap tokens",
    "entityName": "1inch",
    "contractName": "AggregationRouterV5",
    "owner": "0x...",
    "sourcePath": "1inch/calldata-swap.json",
    "schemaVersion": "1"
  }
]
GET /descriptors/:chainId/:address

All descriptors mirrored for a single contract on a chain. chainId must be numeric; address is the 0x contract address. Returns an array of descriptor rows (empty if none).

GET {API_BASE}/descriptors/1/0x1111111254eeb25477b68fb85ed929f73a960582

[ { "chainId": 1, "contract": "0x1111...", "selector": "0x12aa3caf", ... } ]
GET /descriptors/:chainId/:address/:selector

A single descriptor identified by chain, contract address and 4-byte selector. Returns the descriptor row plus a decoded formatBlock and a verified trust block; 404 if no such descriptor exists.

GET {API_BASE}/descriptors/1/0x1111111254eeb25477b68fb85ed929f73a960582/0x12aa3caf

{
  "chainId": 1,
  "contract": "0x1111...",
  "selector": "0x12aa3caf",
  "functionName": "swap",
  "kind": "calldata",
  "intent": "Swap tokens",
  "entityName": "1inch",
  "contractName": "AggregationRouterV5",
  "owner": "0x...",
  "sourcePath": "1inch/calldata-swap.json",
  "schemaVersion": "1",
  "$key": "1:0x1111...:0x12aa3caf",
  "formatBlock": { "...": "decoded ERC-7730 format block" },
  "verified": {
    "efApproved": true,
    "efAttester": "0x...",
    "efAttestationUID": "0x...",
    "publicVouches": 0,
    "rankedAttesters": []
  }
}
POST /decode

Decode a call into its clear-signing view drawn from the mirrored ERC-7730 descriptor. The request body is a DecodeRequest: required chainId (number) and contract (0x 20-byte address), plus either raw calldata (0x-hex with a 4-byte selector) or an EIP-712 typedData payload. An optional selector overrides selector derivation for typedData. Responds 404 if no descriptor matches the derived selector.

POST {API_BASE}/decode
Content-Type: application/json

{
  "chainId": 1,
  "contract": "0x1111111254eeb25477b68fb85ed929f73a960582",
  "calldata": "0x12aa3caf..."
}

The DecodeResponse carries a signing summary (including functionSignature when the descriptor is name-bearing), the visible fields and hiddenFields, a human-readable note, and the raw input echoed back. When the input is raw calldata and a function signature is known, each field is additionally resolved to its ABI-decoded value and type (best-effort — labels-only if a field does not resolve).

{
  "signing": {
    "chainId": 1,
    "contract": "0x1111...",
    "selector": "0x12aa3caf",
    "kind": "calldata",
    "decodedFrom": "calldata",
    "contractName": "AggregationRouterV5",
    "functionName": "swap",
    "functionSignature": "swap(address executor, (address,address,...) desc, bytes data)",
    "intent": "Swap tokens",
    "interpolatedIntent": "Swap 100 USDC for ETH",
    "summary": "Swap 100 USDC for ETH"
  },
  "fields": [
    {
      "label": "Amount",
      "path": "desc.amount",
      "format": "tokenAmount",
      "hidden": false,
      "value": "100000000",
      "type": "uint256"
    }
  ],
  "hiddenFields": [],
  "note": "Labels and intent come from the ERC-7730 descriptor; argument values are ABI-decoded from the calldata.",
  "raw": { "calldata": "0x12aa3caf..." },
  "functionSignature": "swap(address executor, (address,address,...) desc, bytes data)"
}
Not part of the public read API

Signed write submission and the registry webhook exist on the server but are authenticated / internal and are not part of this read API. Their contracts are intentionally omitted here.