{
  "openapi": "3.1.0",
  "info": {
    "title": "Trade Preflight by Agentropolis (Base)",
    "version": "0.1.0",
    "summary": "One call before a Base token swap: Token Preflight honeypot/rug checks + simulated swap quote at your size + price impact + suggested slippage cap → go / caution / avoid. Not investment advice.",
    "description": "Bundles Token Preflight (simulated buy then sell for honeypots and taxes, owner powers, proxy, verification, liquidity, LP burn, holder concentration) with a live simulated quote at the planned trade size across up to 3 Base pools (Uniswap V2/V3/V4, Aerodrome), buy price impact against a small reference trade, and a suggested slippage cap (impact + tax + 0.5 pt). The decision is a checklist signal for that size, never a recommendation. Not investment advice.",
    "contact": {
      "name": "Agentropolis",
      "url": "https://agentropolis.io",
      "email": "hello@agentropolis.io"
    },
    "x-guidance": "POST {\"chain\":\"base\",\"tokenAddress\":\"0x...\",\"sizeUsd\":250}; pay the x402 402; read decision, reasons, quote, price_impact_pct and suggested_slippage_cap_pct. Use min_tokens_out_at_cap as amountOutMinimum."
  },
  "servers": [
    {
      "url": "https://seenly-token-preflight.vercel.app"
    }
  ],
  "paths": {
    "/api/trade-preflight": {
      "post": {
        "operationId": "tradePreflight",
        "summary": "One call before a Base token swap",
        "tags": [
          "Crypto"
        ],
        "description": "$0.03 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.03"
          },
          "protocols": [
            {
              "x402": {}
            }
          ],
          "rails": [
            {
              "protocol": "x402",
              "version": 2,
              "scheme": "exact",
              "network": "eip155:8453",
              "networkName": "Base mainnet",
              "asset": "USDC",
              "assetAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
              "amount": "30000",
              "priceUsd": "0.03",
              "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",
                "tokenAddress": "0x4ed4E862860beD51a9570b96d89aF5E1B0Efefed",
                "sizeUsd": 250
              }
            }
          }
        },
        "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 | not_a_contract | not_erc20 | invalid sizeUsd (not charged)"
          },
          "429": {
            "description": "rate_limited"
          },
          "503": {
            "description": "analysis_failed (not charged)"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Request": {
        "type": "object",
        "required": [
          "tokenAddress"
        ],
        "properties": {
          "chain": {
            "type": "string",
            "enum": [
              "base"
            ],
            "default": "base"
          },
          "tokenAddress": {
            "type": "string",
            "pattern": "^0x[0-9a-fA-F]{40}$",
            "description": "ERC-20 token on Base you plan to trade."
          },
          "sizeUsd": {
            "type": "number",
            "minimum": 1,
            "maximum": 100000,
            "default": 100,
            "description": "Planned trade size in USD (quote, price impact and slippage are computed for this size)."
          },
          "requestKey": {
            "type": "string",
            "maxLength": 128
          }
        }
      },
      "Result": {
        "type": "object",
        "properties": {
          "decision": {
            "type": "string",
            "enum": [
              "go",
              "caution",
              "avoid"
            ],
            "description": "Pre-trade checklist signal for this size (not advice)."
          },
          "summary": {
            "type": "string"
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string"
                },
                "level": {
                  "type": "string"
                },
                "text": {
                  "type": "string"
                }
              }
            }
          },
          "quote": {
            "type": [
              "object",
              "null"
            ],
            "description": "Best simulated venue at the target size: dex, pool, amount_in, expected_tokens_out, effective_price_usd, min_tokens_out_at_cap."
          },
          "price_impact_pct": {
            "type": "object",
            "description": "buy / sell price impact (%) vs a small reference trade."
          },
          "taxes_pct": {
            "type": "object"
          },
          "suggested_slippage_cap_pct": {
            "type": "object",
            "description": "buy / sell slippage caps (%): impact + tax + 0.5 pt buffer."
          },
          "token_preflight": {
            "type": "object",
            "description": "Full Token Preflight grade, score, verdict and checks."
          },
          "as_of_block": {
            "type": "string"
          },
          "disclaimer": {
            "type": "string"
          }
        },
        "required": [
          "decision",
          "summary",
          "reasons",
          "price_impact_pct",
          "suggested_slippage_cap_pct",
          "token_preflight",
          "as_of_block"
        ]
      }
    }
  }
}