{
  "openapi": "3.1.0",
  "info": {
    "title": "Token Preflight (Base)",
    "version": "0.1.0",
    "summary": "Base ERC-20 pre-trade check: buy/sell simulation (honeypot + taxes), owner powers, proxy, verification, liquidity, LP burn, holder concentration.",
    "description": "Automated, point-in-time technical observations from public on-chain data. Not investment advice. Labels describe signals, not intent.",
    "contact": {
      "name": "Seenly / Agentropolis",
      "email": "hello@agentropolis.io"
    },
    "x-guidance": "POST {\"chain\":\"base\",\"tokenAddress\":\"0x...\"}; pay the x402 402 challenge; read grade/score/verdict/checks."
  },
  "servers": [
    {
      "url": "https://seenly-token-preflight.vercel.app"
    }
  ],
  "paths": {
    "/api/token-preflight": {
      "post": {
        "operationId": "tokenPreflight",
        "summary": "Pre-trade safety check for a Base ERC-20 token",
        "description": "$0.02 USDC per call on Base mainnet. Invalid input → 4xx before payment. Settles only on success. 30 req/min per client. Typical latency 4–12 s. Not investment advice.",
        "tags": [
          "Crypto"
        ],
        "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/PreflightRequest"
              },
              "example": {
                "chain": "base",
                "tokenAddress": "0x4ed4E862860beD51a9570b96d89aF5E1B0Efefed",
                "sizeUsd": 100,
                "mode": "card"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verdict card",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PreflightResult"
                }
              }
            }
          },
          "402": {
            "description": "Payment required (x402 v2 PAYMENT-REQUIRED header)"
          },
          "422": {
            "description": "invalid_address | unsupported_chain | not_a_contract | not_erc20 (not charged)"
          },
          "429": {
            "description": "rate_limited"
          },
          "503": {
            "description": "analysis_failed / upstream_unavailable (not charged)"
          }
        }
      },
      "get": {
        "operationId": "tokenPreflightGet",
        "summary": "Pre-trade safety check for a Base ERC-20 token",
        "description": "$0.02 USDC per call on Base mainnet. Invalid input → 4xx before payment. Settles only on success. 30 req/min per client. Typical latency 4–12 s. Not investment advice.",
        "tags": [
          "Crypto"
        ],
        "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"
            }
          ]
        },
        "parameters": [
          {
            "name": "chain",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "base"
              ]
            }
          },
          {
            "name": "address",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^0x[0-9a-fA-F]{40}$"
            }
          },
          {
            "name": "sizeUsd",
            "in": "query",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "mode",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "card",
                "full"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Verdict card",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PreflightResult"
                }
              }
            }
          },
          "402": {
            "description": "Payment required (x402 v2 PAYMENT-REQUIRED header)"
          },
          "422": {
            "description": "invalid_address | unsupported_chain | not_a_contract | not_erc20 (not charged)"
          },
          "429": {
            "description": "rate_limited"
          },
          "503": {
            "description": "analysis_failed / upstream_unavailable (not charged)"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "PreflightRequest": {
        "type": "object",
        "properties": {
          "chain": {
            "type": "string",
            "enum": [
              "base"
            ],
            "default": "base",
            "description": "Only Base mainnet (chain id 8453) in v1."
          },
          "tokenAddress": {
            "type": "string",
            "pattern": "^0x[0-9a-fA-F]{40}$",
            "description": "ERC-20 token contract address on Base."
          },
          "sizeUsd": {
            "type": "number",
            "minimum": 1,
            "maximum": 100000,
            "default": 100,
            "description": "Simulated trade size in USD."
          },
          "mode": {
            "type": "string",
            "enum": [
              "card",
              "full"
            ],
            "default": "card",
            "description": "card = verdict + compact checks; full = adds raw evidence."
          },
          "requestKey": {
            "type": "string",
            "maxLength": 128,
            "description": "Optional idempotency key, echoed back."
          }
        },
        "required": [
          "tokenAddress"
        ],
        "additionalProperties": false
      },
      "PreflightResult": {
        "type": "object",
        "properties": {
          "kit": {
            "type": "string"
          },
          "chain": {
            "type": "string"
          },
          "token": {
            "type": "object",
            "properties": {
              "address": {
                "type": "string"
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "symbol": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "decimals": {
                "type": "integer"
              },
              "total_supply": {
                "type": "string"
              }
            }
          },
          "grade": {
            "type": "string",
            "enum": [
              "OK",
              "CAUTION",
              "DANGER",
              "UNKNOWN"
            ]
          },
          "score": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "verdict": {
            "type": "string",
            "maxLength": 220
          },
          "one_liner": {
            "type": "string"
          },
          "checks": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "enum": [
                    "trade_simulation",
                    "taxes",
                    "liquidity",
                    "lp_lock",
                    "ownership",
                    "owner_powers",
                    "proxy",
                    "contract_verified",
                    "holder_concentration",
                    "token_age"
                  ]
                },
                "label": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "pass",
                    "warn",
                    "fail",
                    "info",
                    "unknown"
                  ]
                },
                "penalty": {
                  "type": "number"
                },
                "severity": {
                  "type": "string",
                  "enum": [
                    "none",
                    "low",
                    "medium",
                    "high",
                    "critical"
                  ]
                },
                "detail": {
                  "type": "string"
                },
                "evidence": {
                  "type": "object",
                  "description": "Raw evidence (mode=full only)."
                }
              }
            }
          },
          "simulation": {
            "type": "object"
          },
          "card_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "share_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "as_of_block": {
            "type": "string"
          },
          "as_of_time": {
            "type": "string"
          },
          "sources": {
            "type": "array"
          },
          "disclaimer": {
            "type": "string"
          },
          "request_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "pricing": {
            "type": "object"
          }
        }
      }
    }
  }
}