{
  "openapi": "3.1.0",
  "info": {
    "title": "Approval Exposure Report by Agentropolis (Base)",
    "version": "0.1.0",
    "summary": "Audit a Base wallet before an agent funds or reuses it: every open ERC-20 allowance, NFT setApprovalForAll and Permit2 approval, flagging unlimited allowances, plain-wallet (no code) or unverified spenders and drainer patterns → clean / review / revoke_now, with ready-to-sign revoke calldata.",
    "description": "Finds approval events for the wallet in Coinbase CDP Base data (ERC-20 approvals from the last 180 days; NFT operator and Permit2 approvals all-time), then re-reads every pair on-chain (allowance, isApprovedForAll, Permit2 allowance and expiry) so only approvals that are still open are reported. Each spender is checked for contract code (EIP-7702 delegated wallets count as wallets), a well-known router label and Sourcify verification; one unknown spender holding approvals over 3+ assets is flagged as a sweeper pattern. Unlimited approvals to well-known routers are reported as ok. Read-only: nothing is signed or broadcast. Not investment advice.",
    "contact": {
      "name": "Agentropolis",
      "url": "https://agentropolis.io",
      "email": "hello@agentropolis.io"
    },
    "x-guidance": "POST {\"chain\":\"base\",\"wallet\":\"0x...\"}; pay the x402 402; if verdict is revoke_now, send each block-level approval's revoke {to,data} from that wallet; review warn items."
  },
  "servers": [
    {
      "url": "https://seenly-token-preflight.vercel.app"
    }
  ],
  "paths": {
    "/api/approval-exposure": {
      "post": {
        "operationId": "approvalExposure",
        "summary": "Audit a Base wallet before an agent funds or reuses it",
        "tags": [
          "Crypto"
        ],
        "description": "$0.02 USDC per call on Base mainnet. Invalid input → 4xx before payment. Settles only on success. 30 req/min per client.",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.02"
          },
          "protocols": [
            {
              "x402": {}
            }
          ],
          "rails": [
            {
              "protocol": "x402",
              "version": 2,
              "scheme": "exact",
              "network": "eip155:8453",
              "networkName": "Base mainnet",
              "asset": "USDC",
              "assetAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
              "amount": "20000",
              "priceUsd": "0.02",
              "payTo": "0xeE6239F3E17bEBe5e89F21F29D74D68CAa0d78CE",
              "facilitator": "Coinbase CDP (gas sponsored; payer needs no ETH)",
              "header": "PAYMENT-SIGNATURE"
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Request"
              },
              "example": {
                "chain": "base",
                "wallet": "0xcaA54748dA198081A89b6f369d798Ad78FC35B83"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Result"
                }
              }
            }
          },
          "402": {
            "description": "Payment required (x402 v2 PAYMENT-REQUIRED header)"
          },
          "422": {
            "description": "invalid_address | unsupported_chain | invalid_request (not charged)"
          },
          "429": {
            "description": "rate_limited"
          },
          "503": {
            "description": "analysis_failed (not charged)"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Request": {
        "type": "object",
        "required": [
          "wallet"
        ],
        "properties": {
          "chain": {
            "type": "string",
            "enum": [
              "base"
            ],
            "default": "base"
          },
          "wallet": {
            "type": "string",
            "pattern": "^0x[0-9a-fA-F]{40}$",
            "description": "Base wallet (EOA or smart wallet) whose open approvals to audit."
          },
          "requestKey": {
            "type": "string",
            "maxLength": 128
          }
        }
      },
      "Result": {
        "type": "object",
        "properties": {
          "verdict": {
            "type": "string",
            "enum": [
              "clean",
              "review",
              "revoke_now"
            ]
          },
          "summary": {
            "type": "string"
          },
          "counts": {
            "type": "object",
            "description": "open, revoke_now, review, ok, unlimited, by_type {erc20, nft_all, permit2}"
          },
          "approvals": {
            "type": "array",
            "description": "Open approvals, riskiest first: type, token, token_symbol, spender, spender_label, spender_is_contract, spender_verified, allowance(_formatted), unlimited, expires_at, owner_balance_formatted, last_set_at, last_set_tx, risk ok|warn|block, flags[], revoke {to, data} (unsigned calldata to revoke).",
            "items": {
              "type": "object"
            }
          },
          "coverage": {
            "type": "object",
            "description": "erc20_lookback_days, pairs_checked, truncated."
          },
          "as_of_block": {
            "type": [
              "string",
              "null"
            ]
          },
          "disclaimer": {
            "type": "string"
          }
        },
        "required": [
          "verdict",
          "summary",
          "counts",
          "approvals"
        ]
      }
    }
  }
}