{
  "openapi": "3.0.3",
  "info": {
    "title": "Remora Live On-Chain Intelligence API",
    "version": "2.0.0",
    "description": "# Remora On-Chain Intelligence API\n\nWelcome to the developer documentation for **Remora**. Remora monitors large whale trades, profitable trader wallets, and DEX arbitrage opportunities across **5 sovereign EVM chains** (Base, Ethereum, Polygon, Arbitrum, and BNB Chain) in real time.\n\n---\n\n## ⚡ Quickstart: Where do I put my API Key?\n\nAll API requests require your API key in the HTTP headers:\n- **Header:** `X-API-Key: YOUR_API_KEY`\n- *Or standard Bearer:* `Authorization: Bearer YOUR_API_KEY`\n\n### 1. Test in your Terminal (cURL)\n\n```bash\ncurl -X GET \"https://remoradata.com/api/v1/whales?chain=base&limit=5\" \\\n  -H \"X-API-Key: YOUR_API_KEY\"\n```\n\n### 2. Test in JavaScript / Node.js\n\n```javascript\nconst res = await fetch(\"https://remoradata.com/api/v1/whales?chain=base&limit=5\", {\n  headers: { \"X-API-Key\": \"YOUR_API_KEY\" }\n});\nconst data = await res.json();\nconsole.log(data);\n```\n\n### 3. Test in Python\n\n```python\nimport requests\n\nres = requests.get(\n    \"https://remoradata.com/api/v1/whales?chain=base&limit=5\",\n    headers={\"X-API-Key\": \"YOUR_API_KEY\"}\n)\nprint(res.json())\n```\n\n---\n\n## 🔐 Pricing & Quotas\n\n| Tier | Price | Monthly Quota | Rate Limit | Chains Included | Support | Features |\n| :--- | :--- | :--- | :--- | :--- | :--- | :--- |\n| **Free Developer** | 0 € / month | 50,000 credits | 60 req/min | Base Mainnet | Discord | Instant Sandbox Key |\n| **Pro Desk** | 49 € / month | 5,000,000 credits | 600 req/min | Base + Ethereum | Priority Email | Single Quant Desk |\n| **Institutional Desk** | 499 € / month | 25,000,000 credits | 1,200 req/min | 5 Sovereign EVM Chains | Private Telegram Desk | Multi-Seat: 5 API Keys (~99 €/seat) |\n| **Enterprise AMM** | 1,999 € / month | 50,000,000 credits | 3,000 req/min | 5 Sovereign EVM Chains | 24/7 Dedicated SLA | Dedicated Node Cluster, IP Allowlist |\n\n*Note: 1 Remora credit = 1 enriched whale intelligence event (equivalent to ~50 raw non-enriched RPC calls).*\n\n---\n\n## 🌐 Supported EVM Chains\n\nRemora runs sovereign P2P direct RPC connections with zero third-party intermediaries:\n- **Base Mainnet** (Chain ID: 8453)\n- **Ethereum Mainnet** (Chain ID: 1)\n- **Polygon PoS** (Chain ID: 137)\n- **Arbitrum One** (Chain ID: 42161)\n- **BNB Chain** (Chain ID: 56)\n\n---\n\n## 📚 4 Ready-to-Use Recipes\n\n### Recipe 1: DEX Price Arbitrage Bot\nListen to live trades on Base. When token prices differ between Aerodrome and Uniswap V3, buy low on one DEX and sell high on the other in a single transaction.\n\n```typescript\nimport { RemoraClient } from '@remora/sdk';\n\nconst remora = new RemoraClient({\n  apiKey: \"YOUR_API_KEY\",\n  chains: ['base']\n});\n\nremora.mempool.on('swap', async (trade) => {\n  if (trade.usdValue < 50000) return;\n\n  const spreadBps = calculatePriceGap(trade.tokenIn, trade.tokenOut);\n  if (spreadBps > 15.0) {\n    await executeSwap({\n      tokenIn: trade.tokenIn,\n      buyOn: 'Aerodrome',\n      sellOn: 'UniswapV3',\n      amount: trade.amount\n    });\n    console.log(\"⚡ Profit captured! Spread: \" + spreadBps + \" bps\");\n  }\n});\n```\n\n---\n\n### Recipe 2: Smart Money & Profitable Trader Tracker\nFollow top performing wallets and funds. See their historical win rate and get alerted when they start accumulating a new token.\n\n```typescript\nimport { RemoraClient } from '@remora/sdk';\n\nconst remora = new RemoraClient({ apiKey: \"YOUR_API_KEY\" });\nconst TOP_TRADER = '0x129060fa092f31b481dbc5fe08f405e19459d82';\n\nasync function trackTrader() {\n  const { data } = await remora.wallet.getPnl(TOP_TRADER);\n  console.log(\"Trader: \" + data.cluster_label);\n  console.log(\"Total Profit: $\" + data.total_profit_usd.toLocaleString());\n  console.log(\"Win Rate: \" + data.win_rate + \"%\");\n\n  data.positions.forEach((pos) => {\n    if (pos.profit_usd > 50000) {\n      console.log(\"💎 Big holding: \" + pos.amount + \" \" + pos.asset + \" (+$\" + pos.profit_usd.toLocaleString() + \")\");\n    }\n  });\n}\ntrackTrader();\n```\n\n---\n\n### Recipe 3: VIP Telegram Whale Alerts Bot\nRun an automated Telegram channel on 100% autopilot. When a whale swaps $100,000+, Remora triggers your webhook and posts directly to your Telegram channel.\n\n```typescript\nimport express from 'express';\n\nconst app = express();\napp.use(express.json());\n\nconst TELEGRAM_BOT_TOKEN = process.env.TELEGRAM_BOT_TOKEN;\nconst TELEGRAM_CHAT_ID = '@remoradata';\n\napp.post('/webhook/remora', async (req, res) => {\n  const { whale } = req.body;\n  if (whale && whale.usdValue >= 100000) {\n    const message =\n      '🚨 <b>WHALE BUY: $' + whale.usdValue.toLocaleString() + '</b>\\n' +\n      '• <b>Chain:</b> ' + whale.chain.toUpperCase() + '\\n' +\n      '• <b>Amount:</b> ' + whale.amount + ' ' + whale.token + '\\n' +\n      '• <b>Trader:</b> ' + whale.fromLabel + '\\n\\n' +\n      '<a href=\"https://remoradata.com\">View on Remora</a>';\n\n    await fetch(`https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage`, {\n      method: 'POST',\n      headers: { 'Content-Type': 'application/json' },\n      body: JSON.stringify({ chat_id: TELEGRAM_CHAT_ID, parse_mode: 'HTML', text: message })\n    });\n  }\n  res.status(200).json({ status: 'ok' });\n});\n```\n\n---\n\n### Recipe 4: Live Whale Ticker Widget\nA clean React component that displays recent big trades in real time right next to your swap button or in your crypto wallet.\n\n```tsx\nimport React, { useEffect, useState } from 'react';\nimport { RemoraClient } from '@remora/sdk';\n\nconst remora = new RemoraClient({ apiKey: \"YOUR_API_KEY\" });\n\nexport const LiveWhaleTicker = ({ token = 'ETH', chain = 'base' }) => {\n  const [trades, setTrades] = useState([]);\n\n  useEffect(() => {\n    remora.whales.list({ chain, token, limit: 3 }).then((res) => setTrades(res.data));\n    const unsubscribe = remora.stream.subscribe({ chain, token }, (trade) => {\n      setTrades((prev) => [trade, ...prev.slice(0, 2)]);\n    });\n    return () => unsubscribe();\n  }, [token, chain]);\n\n  return (\n    <div className=\"rounded-xl bg-[#0C0C10] border border-white/10 p-3 font-mono text-xs\">\n      <div className=\"text-emerald-400 font-bold mb-2\">Live Whale Trades ({chain.toUpperCase()})</div>\n      {trades.map((t) => (\n        <div key={t.id} className=\"flex justify-between py-1 border-b border-white/5\">\n          <span>{t.amount} {token}</span>\n          <span className=\"text-emerald-400 font-bold\">${t.usdValue?.toLocaleString()}</span>\n        </div>\n      ))}\n    </div>\n  );\n};\n```\n",
    "contact": {
      "name": "Remora Institutional Engineering Desk",
      "url": "https://remoradata.com",
      "email": "desk@remoradata.com"
    },
    "license": {
      "name": "Remora Proprietary Commercial Enterprise License",
      "url": "https://remoradata.com/terms"
    }
  },
  "servers": [
    {
      "url": "https://remoradata.com",
      "description": "Production Global Cluster (Europe - CX23 24/7)"
    },
    {
      "url": "http://localhost:3001",
      "description": "Local Development Node Instance"
    }
  ],
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key",
        "description": "Remora API key generated via /api/v1/auth/keys or the client portal"
      },
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API-Key",
        "description": "Standard Bearer token authorization header: Authorization: Bearer <API_KEY>"
      }
    },
    "schemas": {
      "WhaleTransaction": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "tx-base-51144021"
          },
          "hash": {
            "type": "string",
            "example": "0xdd5568d5e814e9ea50fa5cf00bb152d461ac0d141cf8e71811c98e68a570be90"
          },
          "chain": {
            "type": "string",
            "enum": [
              "base",
              "ethereum",
              "polygon",
              "arbitrum",
              "bnb"
            ],
            "example": "base"
          },
          "from": {
            "type": "string",
            "example": "0x129060fa092f31b481dbc5fe08f405e19459d82"
          },
          "to": {
            "type": "string",
            "example": "0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24"
          },
          "fromLabel": {
            "type": "string",
            "example": "Whale Cluster Victor-104 (Informed Accumulator)"
          },
          "toLabel": {
            "type": "string",
            "example": "Aerodrome Concentrated AMM (Base)"
          },
          "token": {
            "type": "string",
            "example": "ETH"
          },
          "amount": {
            "type": "string",
            "example": "49.119 ETH"
          },
          "usdValue": {
            "type": "number",
            "example": 120399
          },
          "direction": {
            "type": "string",
            "enum": [
              "INFLOW",
              "OUTFLOW",
              "SWAP",
              "TRANSFER"
            ],
            "example": "SWAP"
          },
          "type": {
            "type": "string",
            "enum": [
              "ACCUMULATION",
              "DUMP",
              "SWAP"
            ],
            "example": "ACCUMULATION"
          },
          "timestamp": {
            "type": "integer",
            "example": 1789079787000
          },
          "latency": {
            "type": "string",
            "example": "14.2ms"
          },
          "aiExplanation": {
            "type": "string",
            "example": "Base Forensic Analysis: Spot accumulation routed through Base DEX pools. Microstructure engine registered elevated slippage and informed buyer pressure."
          }
        }
      },
      "NetworkStatus": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "example": "healthy"
          },
          "service": {
            "type": "string",
            "example": "Remora Institutional Radar API v1"
          },
          "uptime": {
            "type": "integer",
            "example": 3600
          },
          "live_chains": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "base",
              "ethereum",
              "polygon",
              "arbitrum",
              "bnb"
            ]
          },
          "database": {
            "type": "string",
            "example": "sqlite-wal-ready"
          }
        }
      },
      "SovereignChainNode": {
        "type": "object",
        "properties": {
          "chain": {
            "type": "string",
            "example": "base"
          },
          "name": {
            "type": "string",
            "example": "Base Mainnet"
          },
          "chainId": {
            "type": "integer",
            "example": 8453
          },
          "status": {
            "type": "string",
            "example": "ONLINE"
          },
          "latestBlock": {
            "type": "integer",
            "example": 51145360
          },
          "latencyMs": {
            "type": "integer",
            "example": 115
          },
          "nativeCurrency": {
            "type": "string",
            "example": "ETH"
          }
        }
      },
      "ToxicityMetrics": {
        "type": "object",
        "properties": {
          "vpin": {
            "type": "object",
            "properties": {
              "score": {
                "type": "number",
                "example": 0.142
              },
              "toxicityLevel": {
                "type": "string",
                "enum": [
                  "LOW",
                  "MODERATE",
                  "CRITICAL_TOXIC"
                ],
                "example": "LOW"
              },
              "sampleWindowBuckets": {
                "type": "integer",
                "example": 50
              }
            }
          },
          "kyle": {
            "type": "object",
            "properties": {
              "lambda": {
                "type": "number",
                "example": 0.00042
              },
              "estimatedSlippageBps": {
                "type": "number",
                "example": 4.2
              },
              "depthStatus": {
                "type": "string",
                "example": "DEEP_HEALTHY"
              }
            }
          },
          "marketVerdict": {
            "type": "object",
            "properties": {
              "toxicityLevel": {
                "type": "string",
                "example": "LOW"
              },
              "isHighRisk": {
                "type": "boolean",
                "example": false
              },
              "cexRegime": {
                "type": "string",
                "example": "NEUTRAL_EQUILIBRIUM"
              }
            }
          }
        }
      },
      "ApiKeyResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "apiKey": {
            "type": "string",
            "example": "remora_live_sk_a92f8b3c104e7"
          },
          "tier": {
            "type": "string",
            "example": "pro"
          },
          "quotaMonthly": {
            "type": "integer",
            "example": 5000000
          },
          "rateLimitPerMin": {
            "type": "integer",
            "example": 600
          }
        }
      },
      "ApiKeyUsage": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "example": "active"
          },
          "tier": {
            "type": "string",
            "example": "pro"
          },
          "monthlyQuota": {
            "type": "integer",
            "example": 5000000
          },
          "usedCredits": {
            "type": "integer",
            "example": 142500
          },
          "remainingCredits": {
            "type": "integer",
            "example": 4857500
          },
          "percentUsed": {
            "type": "number",
            "example": 2.85
          },
          "rateLimitPerMin": {
            "type": "integer",
            "example": 600
          }
        }
      },
      "PricingPlan": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "enum": [
              "free",
              "pro",
              "desk",
              "enterprise"
            ],
            "example": "desk"
          },
          "name": {
            "type": "string",
            "example": "Institutional Desk"
          },
          "priceMonthly": {
            "type": "number",
            "example": 499
          },
          "rateLimitPerMinute": {
            "type": "integer",
            "example": 1200
          },
          "monthlyQuota": {
            "type": "integer",
            "example": 25000000
          },
          "seatsIncluded": {
            "type": "integer",
            "example": 5
          },
          "pricePerSeat": {
            "type": "string",
            "example": "~99 EUR / seat"
          },
          "infrastructure": {
            "type": "string",
            "example": "Dedicated Private Cluster"
          },
          "sla": {
            "type": "string",
            "example": "Contractual with 24/7 engineering on-call"
          },
          "creditUnitEquivalent": {
            "type": "string",
            "example": "1 credit = 1 enriched event (~50 raw RPC calls)"
          },
          "mempoolLatency": {
            "type": "string",
            "example": "< 10ms (Sub-10ms pooled priority bandwidth)"
          },
          "historicalRetention": {
            "type": "string",
            "example": "365 days"
          },
          "webhooksAllowed": {
            "oneOf": [
              {
                "type": "integer"
              },
              {
                "type": "string"
              }
            ],
            "example": 50
          },
          "chains": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "base",
              "ethereum",
              "polygon",
              "arbitrum",
              "bnb"
            ]
          },
          "features": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "PricingResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "currency": {
            "type": "string",
            "example": "EUR"
          },
          "billingCycle": {
            "type": "string",
            "example": "monthly"
          },
          "creditDefinition": {
            "type": "string",
            "example": "1 Remora credit = 1 enriched intelligence event equivalent to ~50 raw RPC calls"
          },
          "provenChains": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "base",
              "ethereum",
              "polygon",
              "arbitrum",
              "bnb"
            ]
          },
          "plans": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PricingPlan"
            }
          }
        }
      }
    }
  },
  "paths": {
    "/api/v1/health": {
      "get": {
        "tags": [
          "System & Health"
        ],
        "summary": "Healthcheck & System Status",
        "description": "Returns operational status, uptime, node sync status, and active subscribers count.",
        "responses": {
          "200": {
            "description": "System operational and healthy",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkStatus"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ready": {
      "get": {
        "tags": [
          "System & Health"
        ],
        "summary": "Readiness Probe (Base Node Listener)",
        "description": "Verifies live sovereign Base node synchronization, latest block height, and sub-second RPC latency.",
        "responses": {
          "200": {
            "description": "Base node online and synchronizing mempool blocks"
          },
          "503": {
            "description": "Base node synchronization degraded"
          }
        }
      }
    },
    "/api/v1/network/status": {
      "get": {
        "tags": [
          "System & Health"
        ],
        "summary": "Sovereign Multi-Chain EVM Matrix",
        "description": "Continuously audits all 5 sovereign EVM chains (Base, Ethereum, Polygon, Arbitrum, BNB), returning active block heights, node latencies, and RPC health.",
        "responses": {
          "200": {
            "description": "Real-time 5-chain sovereign EVM health matrix",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "layer": {
                      "type": "string",
                      "example": "Sovereign EVM Block Scan Matrix"
                    },
                    "active_chains_count": {
                      "type": "integer",
                      "example": 5
                    },
                    "online_count": {
                      "type": "integer",
                      "example": 5
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/SovereignChainNode"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/whales": {
      "get": {
        "tags": [
          "Whale Intelligence"
        ],
        "summary": "List & Filter Whale Transactions",
        "description": "Query historical and real-time whale transactions filtered by sovereign chain, minimum USD amount, token, and flow direction.\n\n*Note for Free tier keys*: Access is strictly scoped to the Base Mainnet stream. Pro/Desk/Enterprise unlock multi-chain Ethereum, Polygon, Arbitrum, and BNB.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum number of transactions to return (1-100)",
            "schema": {
              "type": "integer",
              "default": 50
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Pagination offset",
            "schema": {
              "type": "integer",
              "default": 0
            }
          },
          {
            "name": "chain",
            "in": "query",
            "description": "EVM Chain filter ('base', 'ethereum', 'polygon', 'arbitrum', 'bnb')",
            "schema": {
              "type": "string",
              "example": "base"
            }
          },
          {
            "name": "token",
            "in": "query",
            "description": "Token symbol filter (e.g. 'ETH', 'USDC', 'WBTC')",
            "schema": {
              "type": "string",
              "example": "ETH"
            }
          },
          {
            "name": "min_value",
            "in": "query",
            "description": "Minimum transaction USD value threshold",
            "schema": {
              "type": "number",
              "example": 100000
            }
          },
          {
            "name": "direction",
            "in": "query",
            "description": "Flow direction classification",
            "schema": {
              "type": "string",
              "enum": [
                "INFLOW",
                "OUTFLOW",
                "SWAP",
                "TRANSFER"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of matching enriched whale transactions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "count": {
                      "type": "integer",
                      "example": 25
                    },
                    "total": {
                      "type": "integer",
                      "example": 1420
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WhaleTransaction"
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden: Non-Base chain requested on Free Developer tier key"
          }
        }
      }
    },
    "/api/v1/whales/{hash}": {
      "get": {
        "tags": [
          "Whale Intelligence"
        ],
        "summary": "Get Transaction Details by Hash",
        "description": "Retrieve comprehensive forensic metadata, heuristics, and white-box accounting details for a specific on-chain transaction.",
        "parameters": [
          {
            "name": "hash",
            "in": "path",
            "required": true,
            "description": "EVM Transaction 32-byte hexadecimal hash (0x...)",
            "schema": {
              "type": "string",
              "example": "0xdd5568d5e814e9ea50fa5cf00bb152d461ac0d141cf8e71811c98e68a570be90"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Detailed forensic transaction payload",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WhaleTransaction"
                }
              }
            }
          },
          "404": {
            "description": "Transaction hash not indexed"
          }
        }
      }
    },
    "/api/v1/stream": {
      "get": {
        "tags": [
          "Whale Intelligence"
        ],
        "summary": "Server-Sent Events (SSE) Live Whale Pulse",
        "description": "Opens a persistent HTTP Server-Sent Events stream pushing real-time whale detections within sub-18ms of block serialization.",
        "parameters": [
          {
            "name": "min_value",
            "in": "query",
            "description": "Filter by minimum USD value",
            "schema": {
              "type": "number",
              "default": 100000
            }
          },
          {
            "name": "chain",
            "in": "query",
            "description": "Filter by sovereign chain",
            "schema": {
              "type": "string",
              "default": "all"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Continuous text/event-stream of JSON-encoded whale alerts",
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "example": "data: {\"id\":\"tx-51145360\",\"amount\":\"49.119 ETH\",\"usdValue\":120399}\n\n"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/explorer/tx/{hash}": {
      "get": {
        "tags": [
          "Whale Intelligence"
        ],
        "summary": "Remora Sovereign Explorer (Direct RPC)",
        "description": "Directly decodes raw EVM transactions via local sovereign RPC nodes without query limits or Etherscan reliance.",
        "parameters": [
          {
            "name": "hash",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Direct decoded on-chain receipt and gas telemetry"
          }
        }
      }
    },
    "/api/v1/wallets/{address}": {
      "get": {
        "tags": [
          "Forensics & Wallets"
        ],
        "summary": "Profile Wallet & Cluster Intelligence",
        "description": "Returns audited historical PnL, win-rate, Victor 2020 cluster classification, and transaction count for any EVM address.",
        "parameters": [
          {
            "name": "address",
            "in": "path",
            "required": true,
            "description": "EVM 20-byte address (0x...)",
            "schema": {
              "type": "string",
              "example": "0x129060fa092f31b481dbc5fe08f405e19459d82"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Wallet profile with historical PnL, Winrate and detected cluster"
          }
        }
      }
    },
    "/api/v1/analytics/clustering/{address}": {
      "get": {
        "tags": [
          "Forensics & Wallets"
        ],
        "summary": "Heuristic Wallet Clustering (Victor 2020)",
        "description": "Resolves co-spending peeling chains, syndicate clusters, and deposit addresses associated with the specified root address.",
        "parameters": [
          {
            "name": "address",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Cluster graph and associated secondary addresses"
          }
        }
      }
    },
    "/api/v1/metrics/flows": {
      "get": {
        "tags": [
          "Microstructure & Analytics"
        ],
        "summary": "Global Market Flows & CEX Netflow",
        "description": "Returns net inflow/outflow balance across major centralized exchanges and decentralized protocols to identify systemic market accumulation or distribution.",
        "responses": {
          "200": {
            "description": "Aggregated market flow metrics and liquidity shift vectors"
          }
        }
      }
    },
    "/api/v1/analytics/toxicity": {
      "get": {
        "tags": [
          "Microstructure & Analytics"
        ],
        "summary": "AMM Microstructure & VPIN Toxicity Metric",
        "description": "Quantifies informed trader flow toxicity using Volume-Synchronized Probability of Toxicity (VPIN) and calculates Kyle's Lambda price impact slippage.",
        "responses": {
          "200": {
            "description": "Current order flow toxicity metrics",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ToxicityMetrics"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/auth/keys": {
      "post": {
        "tags": [
          "Auth & Quotas"
        ],
        "summary": "Generate Production / Sandbox API Key",
        "description": "Generates a high-entropy secret API key (`remora_live_sk_...`) with configured rate limit and tier quota.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "example": "Quant Desk Algorithmic Feed"
                  },
                  "tier": {
                    "type": "string",
                    "enum": [
                      "free",
                      "pro",
                      "desk",
                      "enterprise"
                    ],
                    "default": "free"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "API Key generated successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiKeyResponse"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Auth & Quotas"
        ],
        "summary": "List Active API Keys",
        "description": "Lists all active API keys associated with the institutional master account.",
        "responses": {
          "200": {
            "description": "List of active keys and associated consumption metadata"
          }
        }
      }
    },
    "/api/v1/auth/usage": {
      "get": {
        "tags": [
          "Auth & Quotas"
        ],
        "summary": "Check API Key Consumption & Monthly Quota",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "BearerAuth": []
          }
        ],
        "description": "Returns real-time percentage used, remaining quota credits, rate limit, and operational status for the calling key.",
        "responses": {
          "200": {
            "description": "Current quota usage metrics",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiKeyUsage"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Monthly quota exhausted - upgrade required"
          }
        }
      }
    },
    "/api/v1/pricing": {
      "get": {
        "tags": [
          "Auth & Quotas"
        ],
        "summary": "Institutional B2B Pricing Plans & Quotas",
        "description": "Returns official pricing, multi-seat team entitlements, chain scopes, rate limits, and dedicated infrastructure specifications for Free Developer (50,000 credits), Pro Desk (49 €), Institutional Desk (499 € with 5 team seats), and Enterprise AMM (1,999 € with Dedicated Private Cluster).",
        "responses": {
          "200": {
            "description": "Detailed tier specifications and feature entitlements",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PricingResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/webhooks": {
      "post": {
        "tags": [
          "Webhooks & Alerts"
        ],
        "summary": "Register HMAC-SHA256 Signed Webhook",
        "description": "Registers an endpoint URL to receive sub-15ms push notifications for qualifying whale orders. Generates a secret key for signature verification.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "targetUrl"
                ],
                "properties": {
                  "targetUrl": {
                    "type": "string",
                    "example": "https://desk.hedgefund.internal/hooks/whales"
                  },
                  "minUsd": {
                    "type": "number",
                    "default": 100000
                  },
                  "chains": {
                    "type": "string",
                    "default": "all"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Webhook registered with secretKey for signature validation"
          }
        }
      },
      "get": {
        "tags": [
          "Webhooks & Alerts"
        ],
        "summary": "List Registered Webhooks",
        "description": "Returns active webhooks, failure counts, and last delivery status.",
        "responses": {
          "200": {
            "description": "List of active webhooks"
          }
        }
      }
    },
    "/api/v1/auth/keys/{id}/seats": {
      "post": {
        "tags": [
          "Auth & Quotas"
        ],
        "summary": "Provision Multi-Seat Team License Key",
        "description": "Provisions an additional sub-key under an Institutional Desk (up to 5 seats included, ~€99/seat) or Enterprise AMM license. Seats share the desk priority bandwidth and credit pool.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Master Key ID",
            "schema": {
              "type": "string",
              "example": "key_0cc9ddfb4405b714"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "example": "Trader Alpha Desk 2"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Team seat provisioned successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "message": {
                      "type": "string",
                      "example": "Team seat provisioned successfully."
                    },
                    "rawKey": {
                      "type": "string",
                      "example": "remora_live_sk_..."
                    },
                    "seat": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "tier": {
                          "type": "string",
                          "example": "desk"
                        },
                        "seatNumber": {
                          "type": "integer",
                          "example": 2
                        },
                        "parentKeyId": {
                          "type": "string"
                        },
                        "maxSeatsIncluded": {
                          "type": "integer",
                          "example": 5
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Maximum seat capacity reached or tier unauthorized"
          },
          "404": {
            "description": "Master key not found"
          }
        }
      },
      "get": {
        "tags": [
          "Auth & Quotas"
        ],
        "summary": "List Team Seats & Organization Pool Usage",
        "description": "Lists all team seats provisioned under an Institutional Desk or Enterprise AMM master key, returning remaining seat capacity and shared credit consumption.",
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Master Key ID",
            "schema": {
              "type": "string",
              "example": "key_0cc9ddfb4405b714"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of team seats and organization pool metrics",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "totalSeatsIncluded": {
                      "type": "integer",
                      "example": 5
                    },
                    "remainingSeats": {
                      "type": "integer",
                      "example": 3
                    },
                    "organizationUsage": {
                      "type": "integer",
                      "example": 124000
                    },
                    "monthlyLimit": {
                      "type": "integer",
                      "example": 25000000
                    },
                    "monthlyRemaining": {
                      "type": "integer",
                      "example": 24876000
                    },
                    "pricePerSeat": {
                      "type": "string",
                      "example": "~99 EUR / seat"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Master key not found"
          }
        }
      }
    },
    "/api/v1/billing/checkout": {
      "post": {
        "tags": [
          "Billing & Subscriptions"
        ],
        "summary": "Initialize Stripe Checkout Session",
        "description": "Creates an official Stripe Checkout Session for Pro Desk (49 €), Institutional Desk (499 € - Multi-seat 5 traders), or Enterprise AMM (1,999 € - Dedicated Private Cluster).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "customerEmail",
                  "planId"
                ],
                "properties": {
                  "customerEmail": {
                    "type": "string",
                    "example": "trader@propfirm.com"
                  },
                  "planId": {
                    "type": "string",
                    "enum": [
                      "pro",
                      "desk",
                      "enterprise"
                    ],
                    "example": "desk"
                  },
                  "paymentMethod": {
                    "type": "string",
                    "default": "stripe"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Stripe checkout URL generated successfully"
          }
        }
      }
    },
    "/api/v1/billing/enterprise-inquiry": {
      "post": {
        "tags": [
          "Billing & Subscriptions"
        ],
        "summary": "Submit Enterprise Custom Quota & Cluster Inquiry",
        "description": "Submit an institutional quote request for dedicated private clusters, custom API quotas (>50M credits), and 24/7 on-call SLA arrangements.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "companyName",
                  "contactName",
                  "email"
                ],
                "properties": {
                  "companyName": {
                    "type": "string",
                    "example": "Wintermute Algo Desk"
                  },
                  "contactName": {
                    "type": "string",
                    "example": "Head of Execution"
                  },
                  "email": {
                    "type": "string",
                    "example": "execution@wintermute.com"
                  },
                  "telegramHandle": {
                    "type": "string",
                    "example": "@wintermute_quant"
                  },
                  "monthlyVolume": {
                    "type": "string",
                    "example": "> $250M"
                  },
                  "requestedChains": {
                    "type": "string",
                    "example": "Base, Ethereum, Arbitrum"
                  },
                  "notes": {
                    "type": "string",
                    "example": "Dedicated sub-10ms mempool peering RPCs requested"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Enterprise inquiry recorded with support ticket",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "message": {
                      "type": "string",
                      "example": "Enterprise infrastructure inquiry recorded."
                    },
                    "inquiryId": {
                      "type": "string",
                      "example": "inq_7a8b9c0d1e2f3a4b"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing required fields (companyName, contactName, email)"
          }
        }
      }
    },
    "/api/v1/billing/webhook": {
      "post": {
        "tags": [
          "Billing & Subscriptions"
        ],
        "summary": "Stripe Signed Webhook Listener",
        "description": "Secure listener for Stripe `checkout.session.completed` events. Automatically provisions production API keys and sends credentials via email.",
        "responses": {
          "200": {
            "description": "Webhook processed successfully"
          },
          "400": {
            "description": "Invalid or unsigned Stripe signature"
          }
        }
      }
    },
    "/api/v1/legal/sla": {
      "get": {
        "tags": [
          "Legal & Compliance"
        ],
        "summary": "Production Service Level Agreement (SLA)",
        "description": "Returns contractual availability commitments, sub-15ms latency benchmarks across 5 sovereign EVM chains, response times, and service credit schedules.",
        "responses": {
          "200": {
            "description": "SLA targets, latency benchmarks, and compensation matrix"
          }
        }
      }
    }
  }
}