{"openapi":"3.1.0","info":{"title":"Dedaub Decompiler API","description":"\nHigh-performance API to fetch a smart contract's **ABI**, **decompilation** and\n**AI decompilation** (\"AI reconstruction\") from Dedaub.\n\n### Authentication\nAll endpoints except `/health` require an API token, sent as either header:\n\n```\nAuthorization: Bearer <token>\nX-API-Key: <token>\n```\n\n### Recommended usage\nCall **`GET /bundle/{network}/{address}`** — it returns ABI + decompiled + AI\nreconstruction (+ verified source when available) in a single JSON object.\nProxies are followed to their implementation automatically; diamonds (EIP-2535)\nare aggregated across all facets.\n\n### Behavior an agent should rely on\n- `network` is a chain name: `ethereum`, `arbitrum`, `base`, `polygon`, … .\n- `address` is a hex `0x…` address, case-insensitive.\n- **Proxies** are auto-followed (`follow_proxy=true` by default on `/bundle`).\n- **Diamonds** are aggregated (`facets=true` by default on `/bundle`).\n- **No contract** at the address (EOA or unknown to Dedaub) → `/bundle`, `/abi`,\n  `/decompiled`, `/ai`, `/code` return **404**; `/resolve` returns `200` with\n  `exists:false`.\n- Responses are **cached** server-side; calling repeatedly is cheap and safe.\n- Not every contract has every artifact — check the `available` object.\n\n### Machine-readable docs\n- OpenAPI JSON: `/openapi.json`\n- Agent-oriented summary: `/llms.txt`\n","contact":{"name":"Internal API"},"license":{"name":"Proprietary"},"version":"3.1.0"},"servers":[{"url":"https://decoder.cyberninja.top"}],"paths":{"/llms.txt":{"get":{"tags":["docs"],"summary":"Agent-oriented documentation","description":"Concise, machine-readable description of the API for AI agents.","operationId":"llms_txt_llms_txt_get","responses":{"200":{"description":"Successful Response","content":{"text/plain":{"schema":{"type":"string"}}}}}}},"/health":{"get":{"tags":["meta"],"summary":"Health","operationId":"health_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}}}}},"/whoami":{"get":{"tags":["meta"],"summary":"Whoami","description":"Dedaub account currently used by the server.","operationId":"whoami_whoami_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"401":{"description":"Missing or invalid API token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/bundle/{network}/{address}":{"get":{"tags":["contract"],"summary":"All-in-one artifacts (recommended)","description":"Return ABI + decompiled + AI reconstruction (+ source) in one object.\n\nStandard/proxy contracts derive from a single cached `/code` call. Diamonds\n(EIP-2535) are aggregated by default: merged ABI + per-facet code from all\nfacets (the real logic); pass `facets=false` to get the bare diamond only.\nReturns 404 for addresses without a contract.","operationId":"bundle_bundle__network___address__get","parameters":[{"name":"network","in":"path","required":true,"schema":{"type":"string","title":"Network"}},{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}},{"name":"follow_proxy","in":"query","required":false,"schema":{"type":"boolean","description":"Follow proxy → implementation","default":true,"title":"Follow Proxy"},"description":"Follow proxy → implementation"},{"name":"facets","in":"query","required":false,"schema":{"type":"boolean","description":"Aggregate diamond facets (ABI + code)","default":true,"title":"Facets"},"description":"Aggregate diamond facets (ABI + code)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BundleResponse"}}}},"401":{"description":"Missing or invalid API token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No contract at address","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"502":{"description":"Upstream (Dedaub) error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/resolve/{network}/{address}":{"get":{"tags":["contract"],"summary":"Full resolution (never 404 on EOA)","description":"Complete, robust view: proxy/diamond/EOA detection + all artifacts.\n\nAlways returns HTTP 200. For addresses without code: `exists:false`,\n`reason:\"no_contract_or_eoa\"`.","operationId":"resolve_resolve__network___address__get","parameters":[{"name":"network","in":"path","required":true,"schema":{"type":"string","title":"Network"}},{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}},{"name":"follow_proxy","in":"query","required":false,"schema":{"type":"boolean","description":"Follow proxy → implementation","default":true,"title":"Follow Proxy"},"description":"Follow proxy → implementation"},{"name":"facets","in":"query","required":false,"schema":{"type":"boolean","description":"Include facet code for diamonds","default":false,"title":"Facets"},"description":"Include facet code for diamonds"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResolveResponse"}}}},"401":{"description":"Missing or invalid API token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/decompiled/{network}/{address}":{"get":{"tags":["contract"],"summary":"Classic decompilation (text)","description":"Classic decompilation (Solidity-like pseudocode), as plain text.","operationId":"decompiled_decompiled__network___address__get","parameters":[{"name":"network","in":"path","required":true,"schema":{"type":"string","title":"Network"}},{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}},{"name":"follow_proxy","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Follow Proxy"}}],"responses":{"200":{"description":"Decompiled source","content":{"text/plain":{"schema":{"type":"string"}}}},"401":{"description":"Missing or invalid API token","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No contract at address","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/ai/{network}/{address}":{"get":{"tags":["contract"],"summary":"AI reconstruction (text)","description":"AI source reconstruction (more readable Solidity), as plain text.","operationId":"ai_reconstruction_ai__network___address__get","parameters":[{"name":"network","in":"path","required":true,"schema":{"type":"string","title":"Network"}},{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}},{"name":"follow_proxy","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Follow Proxy"}}],"responses":{"200":{"description":"AI reconstruction","content":{"text/plain":{"schema":{"type":"string"}}}},"401":{"description":"Missing or invalid API token","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No contract at address","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/abi/{network}/{address}":{"get":{"tags":["contract"],"summary":"Contract ABI (JSON array)","description":"Contract ABI (JSON array).","operationId":"abi_abi__network___address__get","parameters":[{"name":"network","in":"path","required":true,"schema":{"type":"string","title":"Network"}},{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}},{"name":"follow_proxy","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Follow Proxy"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"401":{"description":"Missing or invalid API token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No contract at address","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"502":{"description":"Upstream (Dedaub) error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/code/{network}/{address}":{"get":{"tags":["contract"],"summary":"Raw Dedaub payload (all levels)","description":"Raw Dedaub payload (all levels) for the exact address (no proxy follow).","operationId":"code_code__network___address__get","parameters":[{"name":"network","in":"path","required":true,"schema":{"type":"string","title":"Network"}},{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"401":{"description":"Missing or invalid API token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No contract at address","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"502":{"description":"Upstream (Dedaub) error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/proxy/{network}/{address}":{"get":{"tags":["contract"],"summary":"Raw proxy info","description":"Raw proxy information (404 if the address is not a proxy).","operationId":"proxy_proxy__network___address__get","parameters":[{"name":"network","in":"path","required":true,"schema":{"type":"string","title":"Network"}},{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"401":{"description":"Missing or invalid API token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No contract at address","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"502":{"description":"Upstream (Dedaub) error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/cache":{"get":{"tags":["admin"],"summary":"Cache Stats","operationId":"cache_stats_admin_cache_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CacheStats"}}}},"401":{"description":"Missing or invalid API token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"tags":["admin"],"summary":"Cache Clear","operationId":"cache_clear_admin_cache_delete","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"401":{"description":"Missing or invalid API token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/admin/cache/purge":{"post":{"tags":["admin"],"summary":"Cache Purge","operationId":"cache_purge_admin_cache_purge_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"401":{"description":"Missing or invalid API token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"Available":{"properties":{"abi":{"type":"boolean","title":"Abi"},"decompiled":{"type":"boolean","title":"Decompiled"},"ai_reconstruction":{"type":"boolean","title":"Ai Reconstruction"},"source":{"type":"boolean","title":"Source"}},"type":"object","required":["abi","decompiled","ai_reconstruction","source"],"title":"Available"},"BundleResponse":{"properties":{"network":{"type":"string","title":"Network","examples":["ethereum"]},"query_address":{"type":"string","title":"Query Address","description":"Address as requested","examples":["0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"]},"resolved_address":{"type":"string","title":"Resolved Address","description":"Address the code actually comes from (implementation if proxy)"},"is_proxy":{"type":"boolean","title":"Is Proxy"},"is_diamond":{"type":"boolean","title":"Is Diamond"},"proxy_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Proxy Type","examples":["ADMIN_UPGRADEABLE","DIAMOND",null]},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"Contract name if known","examples":["USD Coin"]},"abi":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Abi","description":"ABI (merged union of facets for diamonds)"},"decompiled":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Decompiled","description":"Classic decompilation (Solidity-like)"},"ai_reconstruction":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ai Reconstruction","description":"AI source reconstruction (more readable)"},"source":{"anyOf":[{},{"type":"null"}],"title":"Source","description":"Verified source if available (string or {file: source})"},"available":{"anyOf":[{"$ref":"#/components/schemas/Available"},{"type":"null"}]},"facets":{"anyOf":[{"items":{"$ref":"#/components/schemas/FacetInfo"},"type":"array"},{"type":"null"}],"title":"Facets","description":"Per-facet breakdown (diamonds only)"},"facet_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Facet Count"}},"type":"object","required":["network","query_address","resolved_address","is_proxy","is_diamond"],"title":"BundleResponse","description":"All-in-one artifacts for a contract (proxy auto-followed, diamond aggregated).","example":{"abi":[{"inputs":[],"name":"transfer","type":"function"}],"ai_reconstruction":"// AI source reconstruction ...\npragma solidity 0.6.12; ...","available":{"abi":true,"ai_reconstruction":true,"decompiled":true,"source":true},"decompiled":"contract Decompiled { ... }","is_diamond":false,"is_proxy":true,"name":"USD Coin","network":"ethereum","proxy_type":"ADMIN_UPGRADEABLE","query_address":"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48","resolved_address":"0x43506849d7c04f9138d1a2050bbf3a0c054402dd"}},"CacheStats":{"properties":{"disk_entries":{"type":"integer","title":"Disk Entries"},"memory_entries":{"type":"integer","title":"Memory Entries"},"memory_max":{"type":"integer","title":"Memory Max"}},"type":"object","required":["disk_entries","memory_entries","memory_max"],"title":"CacheStats"},"ErrorResponse":{"properties":{"detail":{"type":"string","title":"Detail","examples":["No contract at address (EOA or unknown to Dedaub)."]}},"type":"object","required":["detail"],"title":"ErrorResponse"},"FacetInfo":{"properties":{"address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Address","description":"Facet contract address"},"selectors":{"items":{"type":"string"},"type":"array","title":"Selectors","description":"4-byte function selectors routed to this facet"},"abi":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Abi"},"decompiled":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Decompiled"},"ai_reconstruction":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ai Reconstruction"},"available":{"anyOf":[{"$ref":"#/components/schemas/Available"},{"type":"null"}]}},"type":"object","title":"FacetInfo"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"HealthResponse":{"properties":{"status":{"type":"string","title":"Status","examples":["ok"]}},"type":"object","required":["status"],"title":"HealthResponse"},"ResolveResponse":{"properties":{"network":{"type":"string","title":"Network"},"query_address":{"type":"string","title":"Query Address"},"exists":{"type":"boolean","title":"Exists","description":"False for EOAs or addresses unknown to Dedaub"},"is_proxy":{"type":"boolean","title":"Is Proxy"},"is_diamond":{"type":"boolean","title":"Is Diamond"},"proxy":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Proxy","description":"Raw proxy info (implementation_address, transitive_address, proxy_type)"},"resolved_address":{"type":"string","title":"Resolved Address"},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata"},"artifacts":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Artifacts"},"implementation":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Implementation","description":"Implementation contract when a proxy is followed"},"facets":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Facets"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason","description":"Set when exists=false","examples":["no_contract_or_eoa"]},"chain_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Chain Id"}},"type":"object","required":["network","query_address","exists","is_proxy","is_diamond","resolved_address"],"title":"ResolveResponse","description":"Full resolution view: proxy/diamond/EOA detection + artifacts."},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"tags":[{"name":"contract","description":"Fetch contract artifacts (ABI, decompilation, AI reconstruction)."},{"name":"meta","description":"Liveness and account information."},{"name":"admin","description":"Cache inspection and maintenance."},{"name":"docs","description":"Machine-readable documentation."}]}