{"openapi":"3.1.0","info":{"title":"SpendPreflight API","version":"1.0.0","summary":"Pay-per-call payee screening and spend preflight for AI agents (x402, USDC).","description":"Call this BEFORE your agent pays anyone: before settling an x402 402 challenge, before agent checkout, or before sending funds to a new wallet or merchant. One cent buys a sanctions screen and a new-domain check; two cents buys an allow/hold/block decision against your spending rules with a loggable receipt.\n\nNo account or API key. Free trial: add ?trial=1 (3/day per IP).\n\nInformational screening only. Not legal advice, not a compliance certification, and not a guarantee. Sanctions data is from the public OFAC SDN list as of data_as_of. Verify matches before acting.","contact":{"email":"contact@spendpreflight.com","url":"https://spendpreflight.com"},"termsOfService":"https://api.spendpreflight.com/terms","license":{"name":"Service terms","url":"https://api.spendpreflight.com/terms"},"x-guarantees":["Read-only: never signs, settles, or holds your funds; payment goes directly to our public wallet via the Coinbase x402 facilitator.","Not charged on our errors: invalid requests (4xx) and data-unavailable (503) are never settled.","Explainable: every decision is rule-based and returns its reasons; no hidden scoring.","Public data with stated freshness: OFAC SDN + alias lists (U.S. Treasury), refreshed daily; every response has data_as_of.","Minimal data: no request bodies stored; free-trial IP counter deleted after 48h.","Verifiable: payments on-chain (Base), open-source client (MIT), live /status."],"x-trust":{"status_page":"https://status.spendpreflight.com","status":"https://api.spendpreflight.com/status","terms":"https://api.spendpreflight.com/terms","privacy":"https://api.spendpreflight.com/privacy","security":"https://api.spendpreflight.com/.well-known/security.txt","trust_page":"https://spendpreflight.com/trust.html","source":"https://github.com/spendpreflight/spendpreflight-js"}},"servers":[{"url":"https://api.spendpreflight.com"}],"x-payment":{"protocol":"x402","network":"eip155:8453","asset":"USDC","payTo":"0xBf4164e07552e4c1b1B1597E72C7acAA3F0a1c58"},"paths":{"/v1/check":{"get":{"operationId":"checkPayee","summary":"Screen a payee before paying (sanctions + domain age)","description":"Payee risk check. Screens a payee wallet address and name against the OFAC SDN sanctions list and checks the merchant domain's registration age and DNS. Returns risk low|medium|high|unknown with flags such as sanctioned_address, sanctioned_name_possible, new_domain. Use before paying an unfamiliar merchant or wallet.","x-price":"$0.01","parameters":[{"name":"domain","in":"query","schema":{"type":"string"},"description":"Merchant domain or URL"},{"name":"address","in":"query","schema":{"type":"string"},"description":"Payee wallet address"},{"name":"name","in":"query","schema":{"type":"string"},"description":"Merchant or payee legal name"},{"name":"trial","in":"query","schema":{"type":"string","enum":["1"]},"description":"Use a free trial call"}],"responses":{"200":{"description":"Risk result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckResult"}}}},"400":{"description":"No input given (not charged)"},"402":{"description":"Payment required: $0.01 USDC via x402 on eip155:8453. Retry with the payment header from any x402 client."}}}},"/v1/preflight":{"post":{"operationId":"preflightPayment","summary":"Decide allow/hold/block before an agent pays","description":"Spend preflight for AI agents. Send the x402 PaymentRequired body (v1 or v2) you received, or a cart, plus optional rules (per-payment max, hold threshold, daily cap, allowlists, new-domain days). Returns allow|hold|block with reasons, the cheapest acceptable payment option, and a receipt id. Read-only: never signs, settles, or holds funds. Use before every payment.","x-price":"$0.02","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PreflightInput"}}}},"responses":{"200":{"description":"Decision","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PreflightResult"}}}},"400":{"description":"Bad input (not charged)"},"402":{"description":"Payment required: $0.02 USDC via x402 on eip155:8453. Retry with the payment header from any x402 client."}}}},"/v1/sample":{"get":{"operationId":"sample","summary":"Free example check response","responses":{"200":{"description":"Example"}}}},"/v1/rules/default":{"get":{"operationId":"defaultRules","summary":"Free default rule set","responses":{"200":{"description":"Rules"}}}},"/health":{"get":{"operationId":"health","summary":"Service health and sanctions data freshness","responses":{"200":{"description":"Health"}}}}},"components":{"schemas":{"CheckResult":{"type":"object","properties":{"risk":{"type":"string","enum":["low","medium","high","unknown"]},"flags":{"type":"array","items":{"type":"string"}},"sanctions":{"type":"object"},"domain":{"type":["object","null"]},"data_as_of":{"type":"string","format":"date-time"},"disclaimer":{"type":"string"}}},"Rules":{"type":"object","description":"All optional; defaults shown.","example":{"max_per_payment_usd":1,"hold_above_usd":0.25,"daily_cap_usd":25,"allowed_networks":["eip155:8453","base"],"usdc_only":true,"strict_allowlist":false,"new_domain_days":30,"screen_sanctions":true,"domain_allowlist":[],"domain_blocklist":[],"payto_allowlist":[],"payto_blocklist":[]}},"PreflightInput":{"type":"object","properties":{"challenge":{"type":"object","description":"x402 PaymentRequired body (v1 or v2)"},"cart":{"type":"object","properties":{"merchant_domain":{"type":"string"},"total_usd":{"type":"number"},"pay_to":{"type":"string"},"merchant_name":{"type":"string"}}},"resource_url":{"type":"string"},"rules":{"$ref":"#/components/schemas/Rules"},"context":{"type":"object","properties":{"spent_today_usd":{"type":"number"},"agent_id":{"type":"string"}}}}},"PreflightResult":{"type":"object","properties":{"decision":{"type":"string","enum":["allow","hold","block"]},"reasons":{"type":"array","items":{"type":"string"}},"chosen_option":{"type":["object","null"]},"options_evaluated":{"type":"integer"},"payee":{"type":["object","null"]},"receipt":{"type":"object","properties":{"id":{"type":"string"},"ts":{"type":"string"},"input_sha256":{"type":"string"},"decision":{"type":"string"}}}}}}}}