{"openapi":"3.1.0","info":{"title":"Preflight Security API","version":"0.1.0","contact":{"name":"Preflight","email":"preflight-contact@protonmail.com","url":"https://github.com/dainidude/preflight-x402"},"x-guidance":"Paid smart-contract security API. POST Solidity source to /v1/scan ($0.01), a transaction to /v1/sim ($0.05), multi-file projects to /v1/scan/project ($0.10), or an address to /v1/address-risk ($0.005). Each POST returns HTTP 402 with payment requirements; pay via the x402 protocol (USDC, Base) and retry with the PAYMENT-SIGNATURE header to receive a severity-scored, EIP-712-attested verdict: looks_ok | review | block. Trading agents: POST a token address to /v1/token-risk ($0.02) for a honeypot verdict, transfer tax %, and owner-privilege checks — or preview the full report free at /v1/token-risk/demo?address=0x... (5/day). First 10 calls/day are free with the X-Preflight-Free: trial header. Full service description at /llms.txt."},"paths":{"/metrics":{"get":{"summary":"Metrics Endpoint","description":"Return metrics snapshot.\n\nReturns:\n    Dictionary with status and metrics","operationId":"metrics_endpoint_metrics_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Metrics Endpoint Metrics Get"}}}}},"security":[]},"head":{"summary":"Metrics Endpoint","description":"Return metrics snapshot.\n\nReturns:\n    Dictionary with status and metrics","operationId":"metrics_endpoint_metrics_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Metrics Endpoint Metrics Get"}}}}}}},"/":{"get":{"summary":"Root","description":"Content-negotiated root: JSON for API clients (Accept: application/json),\nHTML landing (with OG/meta tags) for browsers, scrapers and `*/*` clients —\ndirectory scrapers like x402scan read the description from the HTML.","operationId":"root__head","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[]},"head":{"summary":"Root","description":"Content-negotiated root: JSON for API clients (Accept: application/json),\nHTML landing (with OG/meta tags) for browsers, scrapers and `*/*` clients —\ndirectory scrapers like x402scan read the description from the HTML.","operationId":"root__head","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/health":{"get":{"summary":"Health","operationId":"health_health_head","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"string"},"type":"object","title":"Response Health Health Head"}}}}},"security":[]},"head":{"summary":"Health","operationId":"health_health_head","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"string"},"type":"object","title":"Response Health Health Head"}}}}}}},"/llms.txt":{"get":{"summary":"Llms Txt","operationId":"llms_txt_llms_txt_head","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[]},"head":{"summary":"Llms Txt","operationId":"llms_txt_llms_txt_head","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/.well-known/x402":{"get":{"summary":"X402 Fanout","description":"x402scan compatibility fan-out (docs/DISCOVERY.md option B).","operationId":"x402_fanout__well_known_x402_head","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response X402 Fanout  Well Known X402 Head"}}}}},"security":[]},"head":{"summary":"X402 Fanout","description":"x402scan compatibility fan-out (docs/DISCOVERY.md option B).","operationId":"x402_fanout__well_known_x402_head","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response X402 Fanout  Well Known X402 Head"}}}}}}},"/verdicts":{"get":{"summary":"Verdicts","description":"Free: the latest trending-token verdicts (public social proof).\n\nContent-negotiated: JSON for agents (Accept: application/json),\na minimal HTML card list for browsers and search engines.","operationId":"verdicts_verdicts_head","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[]},"head":{"summary":"Verdicts","description":"Free: the latest trending-token verdicts (public social proof).\n\nContent-negotiated: JSON for agents (Accept: application/json),\na minimal HTML card list for browsers and search engines.","operationId":"verdicts_verdicts_head","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/v1/scan":{"post":{"summary":"Scan Source","description":"Scan Solidity source — $0.01 via x402.","operationId":"scan_source_v1_scan_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScanRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"402":{"description":"x402 Payment Required (PAYMENT-REQUIRED header + accepts)"}},"x-payment-info":{"protocols":[{"x402":{}}],"price":{"mode":"fixed","currency":"USD","amount":"0.01"}}}},"/v1/scan/project":{"post":{"summary":"Scan Project","description":"Scan a multi-file project — $0.10 via x402.","operationId":"scan_project_v1_scan_project_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectScanRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"402":{"description":"x402 Payment Required (PAYMENT-REQUIRED header + accepts)"}},"x-payment-info":{"protocols":[{"x402":{}}],"price":{"mode":"fixed","currency":"USD","amount":"0.10"}}}},"/v1/sim":{"post":{"summary":"Sim Transaction","description":"Transaction pre-flight simulation — $0.05 via x402.","operationId":"sim_transaction_v1_sim_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SimRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"402":{"description":"x402 Payment Required (PAYMENT-REQUIRED header + accepts)"}},"x-payment-info":{"protocols":[{"x402":{}}],"price":{"mode":"fixed","currency":"USD","amount":"0.05"}}}},"/v1/token-risk":{"post":{"summary":"Token Risk","description":"Token risk by address — honeypot, tax, owner privileges. $0.02 via x402.","operationId":"token_risk_v1_token_risk_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenRiskRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"402":{"description":"x402 Payment Required (PAYMENT-REQUIRED header + accepts)"}},"x-payment-info":{"protocols":[{"x402":{}}],"price":{"mode":"fixed","currency":"USD","amount":"0.02"}}}},"/v1/token-risk/demo":{"get":{"summary":"Token Risk Demo","description":"FREE (5/day per identity): the FULL token-risk report, no payment.\n\nThe conversion showcase — an agent sees exactly what a paid call returns\nbefore ever paying (Greenlight's pair-check demo pattern, its proven\nsurface). NOT in ROUTE_PRICES, so the x402 middleware passes it through.","operationId":"token_risk_demo_v1_token_risk_demo_get","parameters":[{"name":"address","in":"query","required":false,"schema":{"type":"string","default":"","title":"Address"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[]}},"/v1/bundle":{"post":{"summary":"Bundle","description":"Bundle: token-risk + address-risk + (optional) source scan. $0.03 via x402.","operationId":"bundle_v1_bundle_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BundleRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"402":{"description":"x402 Payment Required (PAYMENT-REQUIRED header + accepts)"}},"x-payment-info":{"protocols":[{"x402":{}}],"price":{"mode":"fixed","currency":"USD","amount":"0.03"}}}},"/v1/sim/deep":{"post":{"summary":"Sim Deep","description":"Deep transaction simulation (anvil fork) — $0.25 via x402.","operationId":"sim_deep_v1_sim_deep_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SimRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"402":{"description":"x402 Payment Required (PAYMENT-REQUIRED header + accepts)"}},"x-payment-info":{"protocols":[{"x402":{}}],"price":{"mode":"fixed","currency":"USD","amount":"0.25"}}}},"/v1/address-risk":{"post":{"summary":"Address Risk","description":"Address risk — checksum, contract-vs-EOA, basic bytecode flags. $0.005 via x402.\n\nP1.2 honesty upgrade: a valid checksum alone is not a product. When RPC_URL\nis configured, we check whether the address is a contract, whether it is a\nminimal proxy, and note selfdestruct reachability — without ever claiming\nmore than was checked.","operationId":"address_risk_v1_address_risk_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddressRiskRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"402":{"description":"x402 Payment Required (PAYMENT-REQUIRED header + accepts)"}},"x-payment-info":{"protocols":[{"x402":{}}],"price":{"mode":"fixed","currency":"USD","amount":"0.005"}}}}},"components":{"schemas":{"AddressRiskRequest":{"properties":{"address":{"type":"string","maxLength":42,"minLength":42,"title":"Address"}},"type":"object","required":["address"],"title":"AddressRiskRequest","description":"Body of POST /v1/address-risk."},"BundleRequest":{"properties":{"address":{"type":"string","maxLength":42,"minLength":42,"title":"Address","description":"Token or contract address to analyze"},"source":{"anyOf":[{"type":"string","maxLength":2000000},{"type":"null"}],"title":"Source","description":"Optional Solidity source for a full scan"},"contract_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contract Name","description":"Target contract name when source has several"},"solc_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Solc Version","description":"e.g. 0.8.20; auto-detected from pragma when omitted"}},"type":"object","required":["address"],"title":"BundleRequest","description":"Body of POST /v1/bundle — combined analysis ($0.15).\n\nRuns token-risk + address-risk (+ source scan if provided) in one call.\n43% convenience premium over the $0.105 individual total."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ProjectScanRequest":{"properties":{"files":{"additionalProperties":{"type":"string"},"type":"object","maxProperties":64,"minProperties":1,"title":"Files","description":"file name -> Solidity source"},"contract_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contract Name"},"solc_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Solc Version"}},"type":"object","required":["files"],"title":"ProjectScanRequest","description":"Body of POST /v1/scan/project (multi-file)."},"ScanRequest":{"properties":{"source":{"type":"string","maxLength":2000000,"minLength":1,"title":"Source","description":"Solidity source (single file)"},"contract_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contract Name","description":"Target contract if source has several"},"solc_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Solc Version","description":"e.g. '0.8.20'; auto-detected from pragma when omitted"}},"type":"object","required":["source"],"title":"ScanRequest","description":"Body of POST /v1/scan."},"SimRequest":{"properties":{"to":{"type":"string","maxLength":42,"minLength":42,"title":"To"},"data":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]*$"},{"type":"null"}],"title":"Data"},"value_wei":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Value Wei","description":"Wei value, decimal string"},"from_address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"From Address","description":"Optional sender override"},"source":{"anyOf":[{"type":"string","maxLength":2000000},{"type":"null"}],"title":"Source"},"mode":{"type":"string","pattern":"^(quick|deep)$","title":"Mode","default":"quick"}},"type":"object","required":["to"],"title":"SimRequest","description":"Body of POST /v1/sim and POST /v1/sim/deep — pre-flight simulation.\n\n`to` is required (the contract being called). `data` is 0x-hex calldata\n(omit for a plain value transfer). `value_wei` is the wei sent. `source`\noptionally carries Solidity source of the target contract so static\nhoneypot detectors can run alongside the RPC simulation. `mode` selects\nquick (eth_call) or deep (local anvil fork: gas, balance deltas, traces).\nThe /v1/sim/deep endpoint forces mode=\"deep\" server-side."},"TokenRiskRequest":{"properties":{"address":{"type":"string","maxLength":42,"minLength":42,"title":"Address","description":"Token contract address"}},"type":"object","required":["address"],"title":"TokenRiskRequest","description":"Body of POST /v1/token-risk — the trading-agent pivot route ($0.05).\n\nAnalyze a token by ADDRESS (no source needed): honeypot verdict via the\nfork probe, transfer tax %, contract sanity, bytecode owner-privilege\nheuristics. Returns the same attested ScanReport shape."},"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"}}},"x-discovery":{"ownershipProofs":["0x5515f59a30fe2b9152cd5648a3a0d8c30c837d41"]}}