{
  "openapi": "3.1.0",
  "info": {
    "title": "Whale Radar (Hyperliquid perps)",
    "version": "0.1.0",
    "summary": "Where Hyperliquid whales and top-PnL traders are positioned on a coin, their liquidation prices, liquidation clusters, funding/OI crowding and squeeze risk.",
    "description": "Automated, point-in-time read of public Hyperliquid data. Cohort = ~50 largest accounts + ~50 best 30-day PnL accounts (>= $250k) from the public leaderboard; positions read live. Not investment advice.",
    "contact": {
      "name": "Seenly / Agentropolis",
      "email": "hello@agentropolis.io"
    },
    "x-guidance": "POST {\"coin\":\"BTC\"} (or ALL); pay the x402 402 challenge; read crowding, whales.net_bias, liquidation_map and verdict."
  },
  "servers": [
    {
      "url": "https://seenly-whale-radar.vercel.app"
    }
  ],
  "paths": {
    "/api/whale-radar": {
      "post": {
        "operationId": "whaleRadar",
        "summary": "Hyperliquid perps whale positioning, liquidation clusters and crowding for one coin (or ALL)",
        "description": "$0.05 USDC per call on Base mainnet. Unknown coin → 422 before payment. Settles only on success. 30 req/min per client. Typical latency 1–8 s (cohort snapshot cached ~90 s). Not investment advice.",
        "tags": [
          "Crypto"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.05"
          },
          "protocols": [
            {
              "x402": {}
            }
          ],
          "rails": [
            {
              "protocol": "x402",
              "version": 2,
              "scheme": "exact",
              "network": "eip155:8453",
              "networkName": "Base mainnet",
              "asset": "USDC",
              "assetAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
              "amount": "50000",
              "priceUsd": "0.05",
              "payTo": "0xeE6239F3E17bEBe5e89F21F29D74D68CAa0d78CE",
              "facilitator": "Coinbase CDP (gas sponsored; payer needs no ETH)",
              "header": "PAYMENT-SIGNATURE"
            }
          ]
        },
        "x-free-allowance": {
          "available": true,
          "per_caller_per_day": 3,
          "global_per_day": 50,
          "window": "UTC day (resets 00:00 UTC)",
          "how": "Add header \"X-Free-Allowance: use\" (or ?free=1) to a valid request. If you have free calls left it runs with no payment; otherwise you get this same x402 402.",
          "caller": "per client network: IPv4 /24 or IPv6 /64 (hashed, never stored raw)",
          "note": "Free calls are not sales and never count toward settlements or trust. Calls through the Agentropolis relay always use x402."
        },
        "parameters": [
          {
            "name": "X-Free-Allowance",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "use"
              ]
            },
            "description": "Opt in to the free daily allowance (3 calls per caller network (IPv4 /24, IPv6 /64) per UTC day, global daily cap; see x-free-allowance). Without it, unpaid calls get the normal x402 402."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RadarRequest"
              },
              "example": {
                "coin": "BTC",
                "top": 8
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Radar result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RadarResult"
                }
              }
            }
          },
          "402": {
            "description": "Payment required (x402 v2 PAYMENT-REQUIRED header)"
          },
          "422": {
            "description": "invalid_coin | unknown_coin | invalid_request (not charged)"
          },
          "429": {
            "description": "rate_limited"
          },
          "503": {
            "description": "upstream_unavailable / analysis_failed (not charged)"
          }
        }
      },
      "get": {
        "operationId": "whaleRadarGet",
        "summary": "Hyperliquid perps whale positioning, liquidation clusters and crowding for one coin (or ALL)",
        "description": "$0.05 USDC per call on Base mainnet. Unknown coin → 422 before payment. Settles only on success. 30 req/min per client. Typical latency 1–8 s (cohort snapshot cached ~90 s). Not investment advice.",
        "tags": [
          "Crypto"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.05"
          },
          "protocols": [
            {
              "x402": {}
            }
          ],
          "rails": [
            {
              "protocol": "x402",
              "version": 2,
              "scheme": "exact",
              "network": "eip155:8453",
              "networkName": "Base mainnet",
              "asset": "USDC",
              "assetAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
              "amount": "50000",
              "priceUsd": "0.05",
              "payTo": "0xeE6239F3E17bEBe5e89F21F29D74D68CAa0d78CE",
              "facilitator": "Coinbase CDP (gas sponsored; payer needs no ETH)",
              "header": "PAYMENT-SIGNATURE"
            }
          ]
        },
        "x-free-allowance": {
          "available": true,
          "per_caller_per_day": 3,
          "global_per_day": 50,
          "window": "UTC day (resets 00:00 UTC)",
          "how": "Add header \"X-Free-Allowance: use\" (or ?free=1) to a valid request. If you have free calls left it runs with no payment; otherwise you get this same x402 402.",
          "caller": "per client network: IPv4 /24 or IPv6 /64 (hashed, never stored raw)",
          "note": "Free calls are not sales and never count toward settlements or trust. Calls through the Agentropolis relay always use x402."
        },
        "parameters": [
          {
            "name": "coin",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "BTC, ETH, SOL, HYPE, ... or ALL"
          },
          {
            "name": "top",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 25
            }
          },
          {
            "name": "X-Free-Allowance",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "use"
              ]
            },
            "description": "Opt in to the free daily allowance (3 calls per caller network (IPv4 /24, IPv6 /64) per UTC day, global daily cap; see x-free-allowance). Without it, unpaid calls get the normal x402 402."
          }
        ],
        "responses": {
          "200": {
            "description": "Radar result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RadarResult"
                }
              }
            }
          },
          "402": {
            "description": "Payment required (x402 v2 PAYMENT-REQUIRED header)"
          },
          "422": {
            "description": "invalid_coin | unknown_coin | invalid_request (not charged)"
          },
          "429": {
            "description": "rate_limited"
          },
          "503": {
            "description": "upstream_unavailable / analysis_failed (not charged)"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "RadarRequest": {
        "type": "object",
        "properties": {
          "coin": {
            "type": "string",
            "pattern": "^[A-Za-z0-9]{1,20}$",
            "description": "Hyperliquid perp ticker (BTC, ETH, SOL, HYPE, ...) or ALL for the market-wide whale board."
          },
          "top": {
            "type": "integer",
            "minimum": 1,
            "maximum": 25,
            "default": 8,
            "description": "How many of the largest tracked positions to list."
          },
          "requestKey": {
            "type": "string",
            "maxLength": 128,
            "description": "Optional idempotency key, echoed back."
          }
        },
        "required": [
          "coin"
        ],
        "additionalProperties": false
      },
      "RadarResult": {
        "type": "object",
        "properties": {
          "kit": {
            "type": "string"
          },
          "analysis_version": {
            "type": "string"
          },
          "venue": {
            "type": "string"
          },
          "coin": {
            "type": "string"
          },
          "market": {
            "type": "object",
            "properties": {
              "mark_px": {
                "type": "number"
              },
              "oracle_px": {
                "type": "number"
              },
              "premium_pct": {
                "type": "number"
              },
              "funding_hourly_pct": {
                "type": "number"
              },
              "funding_apr_pct": {
                "type": "number"
              },
              "funding_percentile": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "open_interest_usd": {
                "type": "number"
              },
              "day_volume_usd": {
                "type": "number"
              },
              "change_24h_pct": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "max_leverage": {
                "type": "number"
              }
            }
          },
          "whales": {
            "type": "object",
            "description": "cohort, holders, long/short {count, notional_usd, avg_entry_px, upnl_usd}, net_notional_usd, gross_notional_usd, long_short_ratio, net_bias LONG|SHORT|MIXED|FLAT, share_of_open_interest_pct, smart_money {...}, top_positions[] {address, short_address, label, cohort whale|smart|both, side, notional_usd, entry_px, liquidation_px, distance_to_liq_pct, leverage, unrealized_pnl_usd, account_value_usd}"
          },
          "liquidation_map": {
            "type": "object",
            "description": "below[]/above[] 1% bands {from_px, to_px, distance_pct, notional_usd, positions, sides}, notional_within_5pct_below_usd/above_usd"
          },
          "crowding": {
            "type": "object",
            "properties": {
              "score": {
                "type": "integer"
              },
              "direction": {
                "type": "string"
              },
              "label": {
                "type": "string",
                "enum": [
                  "LONG_CROWDED",
                  "SHORT_CROWDED",
                  "BALANCED"
                ]
              },
              "squeeze_risk": {
                "type": "string",
                "enum": [
                  "long_squeeze",
                  "short_squeeze",
                  "low"
                ]
              },
              "whale_skew": {
                "type": "number"
              },
              "liquidation_magnet": {
                "type": "string",
                "enum": [
                  "below",
                  "above",
                  "none"
                ]
              },
              "reasons": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "whale_book": {
            "type": "array",
            "description": "coin=ALL only: top coins by tracked whale exposure"
          },
          "funding_extremes": {
            "type": "object",
            "description": "coin=ALL only"
          },
          "verdict": {
            "type": "string"
          },
          "one_liner": {
            "type": "string"
          },
          "as_of": {
            "type": "string"
          },
          "sources": {
            "type": "array"
          },
          "disclaimer": {
            "type": "string"
          },
          "request_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "pricing": {
            "type": "object"
          }
        }
      }
    }
  }
}