{"openapi":"3.1.0","info":{"title":"AgentSpendGuard API","version":"0.1.0","description":"x402-paid preflight risk guardrail for agent spending, token checks, and EVM transaction intent."},"paths":{"/":{"get":{"summary":"Get capability manifest","responses":{"200":{"description":"Manifest"}}}},"/health":{"get":{"summary":"Health check","responses":{"200":{"description":"Healthy"}}}},"/v1/capabilities":{"get":{"summary":"Get capability manifest","responses":{"200":{"description":"Manifest"}}}},"/v1/buyer-guide":{"get":{"summary":"Get machine-readable buyer integration guide","responses":{"200":{"description":"Buyer guide"}}}},"/v1/payment-help":{"get":{"summary":"Explain how to complete x402 payment after HTTP 402","responses":{"200":{"description":"Payment help"}}}},"/v1/payment-quote":{"post":{"summary":"Get endpoint price, payment flow, and response contract before paying","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"endpoint":{"type":"string","enum":["/v1/x402-risk","/v1/token-risk","/v1/tx-explain","POST /v1/x402-risk","POST /v1/token-risk","POST /v1/tx-explain"],"default":"/v1/x402-risk"}}},"example":{"endpoint":"/v1/x402-risk"}}}},"responses":{"200":{"description":"Payment quote"},"400":{"description":"Invalid endpoint"}}}},"/v1/payment-preview":{"post":{"summary":"Preview the paid analysis contract before paying, without returning a final risk verdict","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"endpoint":{"type":"string","enum":["/v1/x402-risk","/v1/token-risk","/v1/tx-explain","POST /v1/x402-risk","POST /v1/token-risk","POST /v1/tx-explain"],"default":"/v1/x402-risk"},"input":{"type":"object"}}},"example":{"endpoint":"/v1/x402-risk","input":{"resourceUrl":"https://api.oatp.cc/tools/token_risk_scan","expectedNetwork":"eip155:8453","expectedMaxPriceUsd":1}}}}},"responses":{"200":{"description":"Payment preview"},"400":{"description":"Invalid endpoint"}}}},"/v1/examples":{"get":{"summary":"Get request examples","responses":{"200":{"description":"Examples"}}}},"/v1/usage":{"get":{"summary":"Get in-memory usage summary for launch monitoring","responses":{"200":{"description":"Usage summary"}}}},"/v1/x402-risk":{"post":{"summary":"Preflight an x402 endpoint before paying","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"resourceUrl":{"type":"string","format":"uri"},"payTo":{"type":"string"},"expectedNetwork":{"type":"string","default":"eip155:8453"},"expectedMaxPriceUsd":{"type":"number"},"requireRecentActivityDays":{"type":"integer","default":30}},"anyOf":[{"required":["resourceUrl"]},{"required":["payTo"]}]},"example":{"resourceUrl":"https://api.oatp.cc/tools/token_risk_scan","expectedNetwork":"eip155:8453","expectedMaxPriceUsd":1}}}},"responses":{"200":{"description":"Risk report","content":{"application/json":{"schema":{"type":"object","properties":{"verdict":{"type":"string","enum":["allow","caution","block"]},"riskLevel":{"type":"string","enum":["low","medium","high","critical"]},"score":{"type":"integer","minimum":0,"maximum":100},"decision":{"type":"object","properties":{"shouldPay":{"type":"boolean"},"maxRecommendedPriceUsd":{"type":"number"},"requiresHumanReview":{"type":"boolean"},"retryable":{"type":"boolean"}}},"recommendedAction":{"type":"string"},"reasons":{"type":"array"},"evidence":{"type":"array"}}},"example":{"verdict":"allow","riskLevel":"low","score":92,"matched":true,"resource":"https://api.oatp.cc/tools/token_risk_scan","recommendedAction":"Buyer agent may proceed if the endpoint matches task intent and budget.","decision":{"shouldPay":true,"maxRecommendedPriceUsd":1,"requiresHumanReview":false,"retryable":false},"reasons":[{"code":"BROAD_BUYER_COVERAGE","severity":"info","message":"Broad recent buyer coverage found.","evidence":[]}],"quality":{"l30DaysTotalCalls":11150,"l30DaysUniquePayers":2236,"metadataQualityScore":85,"priceUsd":0.5},"alternatives":[]}}}},"402":{"description":"x402 payment required"}}}},"/v1/token-risk":{"post":{"summary":"Scan an EVM token before interaction","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"chainId":{"type":"integer","enum":[1,8453,84532,10,42161,137],"default":8453},"tokenAddress":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$"},"minLiquidityUsd":{"type":"number","default":10000},"minHolderCount":{"type":"integer","default":100}},"required":["tokenAddress"]},"example":{"chainId":8453,"tokenAddress":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","minLiquidityUsd":10000,"minHolderCount":100}}}},"responses":{"200":{"description":"Token risk report","content":{"application/json":{"schema":{"type":"object","properties":{"verdict":{"type":"string","enum":["allow","caution","block"]},"riskLevel":{"type":"string","enum":["low","medium","high","critical"]},"score":{"type":"integer","minimum":0,"maximum":100},"decision":{"type":"object","properties":{"shouldPay":{"type":"boolean"},"maxRecommendedPriceUsd":{"type":"number"},"requiresHumanReview":{"type":"boolean"},"retryable":{"type":"boolean"}}},"recommendedAction":{"type":"string"},"reasons":{"type":"array"},"evidence":{"type":"array"}}},"example":{"verdict":"allow","riskLevel":"low","score":90,"token":{"chainId":8453,"address":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","name":"USD Coin","symbol":"USDC","liquidityUsd":100000,"holderCount":1000000},"recommendedAction":"Buyer agent may proceed if token identity matches user intent.","reasons":[{"code":"NO_MAJOR_FLAGS","severity":"info","message":"No major automated token risk flags were found.","evidence":[]}],"evidence":[]}}}},"402":{"description":"x402 payment required"}}}},"/v1/tx-explain":{"post":{"summary":"Explain EVM calldata before signing","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"chainId":{"type":"integer","enum":[1,8453,84532,10,42161,137],"default":8453},"to":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$"},"from":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$"},"valueWei":{"type":"string","pattern":"^\\d+$","default":"0"},"data":{"type":"string","pattern":"^0x[a-fA-F0-9]*$"},"knownSpenders":{"type":"array","items":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$"}}},"required":["data"]},"example":{"chainId":8453,"to":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","valueWei":"0","data":"0x095ea7b30000000000000000000000001111111111111111111111111111111111111111ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","knownSpenders":[]}}}},"responses":{"200":{"description":"Transaction intent report","content":{"application/json":{"schema":{"type":"object","properties":{"verdict":{"type":"string","enum":["allow","caution","block"]},"riskLevel":{"type":"string","enum":["low","medium","high","critical"]},"score":{"type":"integer","minimum":0,"maximum":100},"decision":{"type":"object","properties":{"shouldPay":{"type":"boolean"},"maxRecommendedPriceUsd":{"type":"number"},"requiresHumanReview":{"type":"boolean"},"retryable":{"type":"boolean"}}},"recommendedAction":{"type":"string"},"reasons":{"type":"array"},"evidence":{"type":"array"}}},"example":{"verdict":"caution","riskLevel":"medium","score":55,"intent":{"selector":"0x095ea7b3","functionName":"approve","category":"approval","summary":"ERC20 approval call.","decodedArgs":{}},"recommendedAction":"Require explicit confirmation or deeper simulation before signing.","reasons":[{"code":"APPROVAL_CALL","severity":"warning","message":"This transaction grants or changes spending permission.","evidence":[]}],"evidence":[]}}}},"402":{"description":"x402 payment required"}}}}}}