{"openapi":"3.1.0","info":{"title":"FastAPI","version":"0.1.0"},"paths":{"/api/v2/wallet/{address}":{"get":{"summary":"Wallet Root","description":"Alias to /wallet/{address}/overview — restores documented Public endpoint\nthat 404'd before 2026-06-08 (Polybot API audit finding #2). Same response\nshape as /overview; thin pass-through, no extra cost.","operationId":"wallet_root_api_v2_wallet__address__get","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}},{"name":"view","in":"query","required":false,"schema":{"type":"string","default":"proxy","title":"View"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/wallet/{address}/overview":{"get":{"summary":"Wallet Overview","description":"Instant overview: profile + stats from DB. No Data API calls.","operationId":"wallet_overview_api_v2_wallet__address__overview_get","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}},{"name":"view","in":"query","required":false,"schema":{"type":"string","default":"proxy","title":"View"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/wallet/{address}/positions":{"get":{"summary":"Wallet Positions","description":"DB-first active positions with approximate values. Data API refines in background.\n\n2026-06-08 Phase B (#30 fix): LATERAL per-address index scan with early termination\nvia idx_wmp_wallet_value caps response at top-`limit` positions by current_value.\nPrevents 30K+ position payloads for market-maker wallets that produced 8-15s\ntail-latency 504 timeouts. Hard cap 500 per call (Polymarket-parity); deep\npagination via ?offset (consider keyset migration if offset iteration shows up\nin heavy-wallet logs).","operationId":"wallet_positions_api_v2_wallet__address__positions_get","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}},{"name":"proxy","in":"query","required":false,"schema":{"type":"string","default":"","title":"Proxy"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"exclusiveMinimum":0,"description":"Max positions to return (default 200, cap 500)","default":200,"title":"Limit"},"description":"Max positions to return (default 200, cap 500)"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Pagination offset","default":0,"title":"Offset"},"description":"Pagination offset"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/wallet/{address}/closed":{"get":{"summary":"Wallet Closed","description":"Closed positions from PM Data API cache (source of truth).","operationId":"wallet_closed_api_v2_wallet__address__closed_get","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}},{"name":"proxy","in":"query","required":false,"schema":{"type":"string","default":"","title":"Proxy"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":200,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}},{"name":"sort","in":"query","required":false,"schema":{"type":"string","default":"recent","title":"Sort"}},{"name":"min_buy_cost","in":"query","required":false,"schema":{"type":"number","default":0,"title":"Min Buy Cost"}},{"name":"avg_entry_min","in":"query","required":false,"schema":{"type":"number","default":0,"title":"Avg Entry Min"}},{"name":"avg_entry_max","in":"query","required":false,"schema":{"type":"number","default":0,"title":"Avg Entry Max"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/wallet/{address}/pending-redemption":{"get":{"summary":"Wallet Pending Redemption","operationId":"wallet_pending_redemption_api_v2_wallet__address__pending_redemption_get","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}},{"name":"proxy","in":"query","required":false,"schema":{"type":"string","default":"","title":"Proxy"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/wallet/{address}/closed-insights":{"get":{"summary":"Wallet Closed Insights","operationId":"wallet_closed_insights_api_v2_wallet__address__closed_insights_get","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}},{"name":"proxy","in":"query","required":false,"schema":{"type":"string","default":"","title":"Proxy"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/wallet/{address}/alignment":{"get":{"summary":"Wallet Alignment","description":"Whale alignment — ONLY from precise Data API positions.","operationId":"wallet_alignment_api_v2_wallet__address__alignment_get","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}},{"name":"proxy","in":"query","required":false,"schema":{"type":"string","default":"","title":"Proxy"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/wallet/{address}/related-markets":{"get":{"summary":"Wallet Related Markets","description":"Top active markets in the wallet's primary categories.\n\nDrives discovery loop on wallet page: wallet -> market -> new whale lookup.\nReturns top 2 categories where wallet has >= 5% share, with up to 5 active\nhigh-quality markets each (volume_24h DESC, end_date in future, not extreme prices).\nCached 5 min in Redis.","operationId":"wallet_related_markets_api_v2_wallet__address__related_markets_get","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/wallet/{address}/similar-traders":{"get":{"summary":"Wallet Similar Traders","description":"Top 4 smart whales з пересічним category-mix.\n\nMVP: same primary_category + is_smart + positive PnL. ORDER BY total_pnl DESC.\nDiscovery loop on wallet page: shows traders with similar style.\nCached 10 min in Redis.","operationId":"wallet_similar_traders_api_v2_wallet__address__similar_traders_get","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/wallet/{address}/ping":{"post":{"summary":"Wallet Ping","description":"Register a browser session as actively viewing this wallet page.\n\nStores a Redis key presence:wallet:{wallet}:{session_id} with 90s TTL.\nSession id comes from the X-OrcaLayer-Session header (browser cookie,\nrandom UUID); falls back to client IP for non-cooperating clients.\nLightweight вЂ” single SETEX, no DB hop.","operationId":"wallet_ping_api_v2_wallet__address__ping_post","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/wallet/{address}/watching":{"get":{"summary":"Wallet Watching","description":"Count unique sessions currently viewing this wallet page.\n\nReturns the number of presence:wallet:{wallet}:* keys still alive in Redis.\nCheap: SCAN over a narrow prefix (typical wallet ~0-10 keys).","operationId":"wallet_watching_api_v2_wallet__address__watching_get","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/whale-alerts":{"get":{"summary":"Api Whale Alerts","description":"Recent smart whale trades. Core endpoint for alerts, bots, subscriptions.\n\nParams:\n    minutes: lookback window (default 10, max 1440 = 24h)\n    wallet: filter by specific wallet address\n    market_id: filter by specific market\n    min_usd: minimum trade size in USD (default $10)\n    smart_only: only show smart whale trades (default true)\n    limit: max results (default 50, max 200)","operationId":"api_whale_alerts_api_v2_whale_alerts_get","parameters":[{"name":"minutes","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Minutes"}},{"name":"wallet","in":"query","required":false,"schema":{"type":"string","default":"","title":"Wallet"}},{"name":"wallets","in":"query","required":false,"schema":{"type":"string","default":"","title":"Wallets"}},{"name":"market_id","in":"query","required":false,"schema":{"type":"string","default":"","title":"Market Id"}},{"name":"min_usd","in":"query","required":false,"schema":{"type":"number","default":10,"title":"Min Usd"}},{"name":"smart_only","in":"query","required":false,"schema":{"type":"boolean","default":true,"title":"Smart Only"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}},{"name":"before_ts","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Before Ts"}},{"name":"after_ts","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"After Ts"}},{"name":"category","in":"query","required":false,"schema":{"type":"string","default":"","title":"Category"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/whale-alerts/summary":{"get":{"summary":"Api Whale Alerts Summary","description":"Summary stat strip for the Whale Alerts page (4 cards).\n\nReads ONLY from smart_trades_recent — the rolling 48h table of smart-whale\ntrades (>= $1K) maintained by update_smart_trades_recent.py. Zero scans of\ntrades_apr2026_plus, so it stays a sub-10ms query and adds no load to the\nlive DB. The 48h retention is exactly what powers the \"vs previous 24h\"\ndelta (current window vs the equal-length window before it).\n\nReturns: total alerts (+delta% vs prev window), total USD volume, biggest\nsingle trade (with market for click-through), most active whale.\n\nCaveat: smart_trades_recent has a $1K floor while the feed shows from $500,\nso these totals count from $1K. Acceptable for an overview strip; the delta\nis only meaningful once the table holds a full 48h (it does as of 21.05).","operationId":"api_whale_alerts_summary_api_v2_whale_alerts_summary_get","parameters":[{"name":"minutes","in":"query","required":false,"schema":{"type":"integer","default":1440,"title":"Minutes"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/whale-alerts/big-positions":{"get":{"summary":"Api Big Positions","description":"Latest big_position snapshots (held ≥ $500K), dedup per (wallet, market).\n\nParams:\n  category: '' for all, else CRYPTO/GEOPOLITICS/SPORTS/POLITICS/...\n  min_usd: floor on cost_basis (default $500K — same as detector floor)\n  limit:  max rows (default 50, max 200)","operationId":"api_big_positions_api_v2_whale_alerts_big_positions_get","parameters":[{"name":"category","in":"query","required":false,"schema":{"type":"string","default":"","title":"Category"}},{"name":"min_usd","in":"query","required":false,"schema":{"type":"number","default":500000,"title":"Min Usd"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/whale-alerts/big-positions/summary":{"get":{"summary":"Api Big Positions Summary","description":"4-card stat strip for Big Positions tab.\n\nCards: Total positions · Total held value · Biggest position · Top whale.\nAll computed over the deduped latest-snapshot set, optionally filtered\nby category.","operationId":"api_big_positions_summary_api_v2_whale_alerts_big_positions_summary_get","parameters":[{"name":"category","in":"query","required":false,"schema":{"type":"string","default":"","title":"Category"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/markets/hot":{"get":{"summary":"Api Markets Hot","description":"Markets where smart whales are actively trading right now.\n\nRanked by number of smart whale trades in the last N minutes.","operationId":"api_markets_hot_api_v2_markets_hot_get","parameters":[{"name":"minutes","in":"query","required":false,"schema":{"type":"integer","default":60,"title":"Minutes"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":20,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/whales/leaderboard":{"get":{"summary":"Api Whales Leaderboard","description":"Top smart whales by P&L, win rate, volume, or trades.\nfilter: smart (default) or all","operationId":"api_whales_leaderboard_api_v2_whales_leaderboard_get","parameters":[{"name":"sort","in":"query","required":false,"schema":{"type":"string","default":"pnl","title":"Sort"}},{"name":"category","in":"query","required":false,"schema":{"type":"string","default":"","title":"Category"}},{"name":"filter","in":"query","required":false,"schema":{"type":"string","default":"smart","title":"Filter"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}},{"name":"min_markets","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Min Markets"}},{"name":"min_wr","in":"query","required":false,"schema":{"type":"number","default":0,"title":"Min Wr"}},{"name":"min_pnl","in":"query","required":false,"schema":{"type":"number","default":0,"title":"Min Pnl"}},{"name":"min_profit_factor","in":"query","required":false,"schema":{"type":"number","default":0,"title":"Min Profit Factor"}},{"name":"max_avg_entry","in":"query","required":false,"schema":{"type":"number","default":0,"title":"Max Avg Entry"}},{"name":"max_sports_pct","in":"query","required":false,"schema":{"type":"number","default":0,"title":"Max Sports Pct"}},{"name":"exclude_wallets","in":"query","required":false,"schema":{"type":"string","default":"","title":"Exclude Wallets"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/whale/{address}/history":{"get":{"summary":"Api Whale History","description":"Full trading history of a specific whale.","operationId":"api_whale_history_api_v2_whale__address__history_get","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/whale/{address}/backtest":{"get":{"summary":"Api Whale Backtest","description":"Resolved positions for backtesting copy-trade strategies.\nReturns per-outcome data with won/lost, entry price, category.","operationId":"api_whale_backtest_api_v2_whale__address__backtest_get","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":500,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/markets/resolved":{"get":{"summary":"Api Markets Resolved","description":"Recently resolved markets with outcomes.","operationId":"api_markets_resolved_api_v2_markets_resolved_get","parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","default":7,"title":"Days"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":30,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/isw/status":{"get":{"summary":"Api Isw Status","description":"ISW Territory Monitor — current status grouped by city, with per-subscription rows.\n\nv3 (post-2026-04-26): backed by isw_market_subscriptions + isw_subscription_status.\nEach city has 1+ subscriptions, each with own check_type (single/enter/entirety),\ngeometry (polygon vertices or single point), and threat assessment.","operationId":"api_isw_status_api_v2_isw_status_head","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"head":{"summary":"Api Isw Status","description":"ISW Territory Monitor — current status grouped by city, with per-subscription rows.\n\nv3 (post-2026-04-26): backed by isw_market_subscriptions + isw_subscription_status.\nEach city has 1+ subscriptions, each with own check_type (single/enter/entirety),\ngeometry (polygon vertices or single point), and threat assessment.","operationId":"api_isw_status_api_v2_isw_status_head","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v2/isw/webhook/register":{"post":{"summary":"Api Isw Webhook Register","description":"Register a webhook URL to receive ISW territory events.","operationId":"api_isw_webhook_register_api_v2_isw_webhook_register_post","parameters":[{"name":"request","in":"query","required":true,"schema":{"title":"Request"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/isw/webhook/unregister":{"delete":{"summary":"Api Isw Webhook Unregister","description":"Unregister a webhook URL.","operationId":"api_isw_webhook_unregister_api_v2_isw_webhook_unregister_delete","parameters":[{"name":"request","in":"query","required":true,"schema":{"title":"Request"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/wallet/{addr}/trades":{"get":{"summary":"Api Wallet Market Trades","description":"Premium: historical trades for wallet+market+time slice.\n\nQuery params:\n  market — condition_id of the market (required)\n  before — unix timestamp upper bound (required)\n  after  — unix timestamp lower bound (required, must be < before)\n  limit  — max rows (default 100, max 500)","operationId":"api_wallet_market_trades_api_v2_wallet__addr__trades_get","parameters":[{"name":"addr","in":"path","required":true,"schema":{"type":"string","title":"Addr"}},{"name":"market","in":"query","required":false,"schema":{"type":"string","default":"","title":"Market"}},{"name":"before","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Before"}},{"name":"after","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"After"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":100,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/market/{condition_id}/whale-trades":{"get":{"summary":"Api Market Whale Trades","description":"Premium: all whale-class trades on market before timestamp.\n\nA trade is whale-class if either maker or taker is in smart_whales.\nQuery params:\n  before  — unix timestamp upper bound (required)\n  min_usd — minimum trade USD size (default 500, min 1)\n  limit   — max rows (default 100, max 500)","operationId":"api_market_whale_trades_api_v2_market__condition_id__whale_trades_get","parameters":[{"name":"condition_id","in":"path","required":true,"schema":{"type":"string","title":"Condition Id"}},{"name":"before","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Before"}},{"name":"min_usd","in":"query","required":false,"schema":{"type":"integer","default":500,"title":"Min Usd"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":100,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/wallet/{addr}/market-summary/{condition_id}":{"get":{"summary":"Api Wallet Market Summary","description":"Premium: wallet position snapshot on a market.\n\nWith `at=0` (default): current state from wallet_market_stats (per-side rows).\nWith `at=<unix_ts>`: reconstructs aggregate from trades up to that timestamp.","operationId":"api_wallet_market_summary_api_v2_wallet__addr__market_summary__condition_id__get","parameters":[{"name":"addr","in":"path","required":true,"schema":{"type":"string","title":"Addr"}},{"name":"condition_id","in":"path","required":true,"schema":{"type":"string","title":"Condition Id"}},{"name":"at","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"At"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/isw/premium/status":{"get":{"summary":"Api Isw Premium Status","description":"Premium mirror of /isw/status — requires Bearer (Premium plan). Same data.\n\nNOTE (2026-06-08 Polybot audit #5): legacy from when ISW section was Premium-only.\nISW data is now free (/isw/status public). This mirror returns identical payload\nbehind auth — kept for compat with any existing customer integration. NOT in /docs.\nIf access logs show 0 hits over 30+ days, safe to cleanup. Same for /isw/premium/events.","operationId":"api_isw_premium_status_api_v2_isw_premium_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v2/isw/premium/events":{"get":{"summary":"Api Isw Premium Events","description":"Premium mirror of /isw/events — requires Bearer (Premium plan). Same data.","operationId":"api_isw_premium_events_api_v2_isw_premium_events_get","parameters":[{"name":"hours","in":"query","required":false,"schema":{"type":"integer","default":24,"title":"Hours"}},{"name":"city","in":"query","required":false,"schema":{"type":"string","default":"","title":"City"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/isw/events":{"get":{"summary":"Api Isw Events","description":"ISW Territory events — changes in control/advance status.\n\nv3 (post-2026-04-26): events are per-subscription. Each event includes\nsubscription context (label, check_type, geometry-derived coverage/distance,\nmarket_slug_pattern). Backward-compat fields (city/event_type/severity/details/timestamp)\nare preserved.\n\nQuery params:\n  hours          — lookback window (default 24, max 720)\n  city           — filter by city name\n  subscription_id — filter by specific subscription\n  check_type     — filter by 'single' / 'enter' / 'entirety'\n  min_severity   — return only events at or above this severity\n                   (SAFE / LOW / MEDIUM / HIGH / CRITICAL)\n  limit          — max events (default 50, max 200)","operationId":"api_isw_events_api_v2_isw_events_get","parameters":[{"name":"hours","in":"query","required":false,"schema":{"type":"integer","default":24,"title":"Hours"}},{"name":"city","in":"query","required":false,"schema":{"type":"string","default":"","title":"City"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}},{"name":"subscription_id","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Subscription Id"}},{"name":"check_type","in":"query","required":false,"schema":{"type":"string","default":"","title":"Check Type"}},{"name":"min_severity","in":"query","required":false,"schema":{"type":"string","default":"","title":"Min Severity"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/markets/search":{"get":{"summary":"Api Markets Search","description":"Search / browse markets with server-side filters.\n\nFilters (all SQL-side so `total` reflects full match set, not just page):\n    q           — text search (also accepts Polymarket URL/slug)\n    category    — All | Crypto | Geopolitics | Sports | Politics | Economics | Tech/AI\n    min_volume  — minimum volume USD\n    min_whales  — minimum total smart whales (yes+no)\n    min_days    — minimum days until end_date\n    max_days    — maximum days until end_date\n    limit       — page size (default 50, max 200)\n    offset      — pagination offset\n\nReturns: {markets, total, limit, offset, _elapsed_ms}","operationId":"api_markets_search_api_v2_markets_search_get","parameters":[{"name":"q","in":"query","required":false,"schema":{"type":"string","default":"","title":"Q"}},{"name":"category","in":"query","required":false,"schema":{"type":"string","default":"","title":"Category"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}},{"name":"min_volume","in":"query","required":false,"schema":{"type":"number","default":0,"title":"Min Volume"}},{"name":"min_whales","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Min Whales"}},{"name":"min_days","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Min Days"}},{"name":"max_days","in":"query","required":false,"schema":{"type":"integer","default":365,"title":"Max Days"}},{"name":"price_min","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Price Min"}},{"name":"price_max","in":"query","required":false,"schema":{"type":"integer","default":100,"title":"Price Max"}},{"name":"window_hours","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Window Hours"}},{"name":"created_within_days","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Created Within Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/markets/category-stats":{"get":{"summary":"Api Category Stats","description":"Returns 3 counts for a category: active_quality (default-filtered),\nall_open (closed=0/NULL), all_time (every market ever indexed).\n\nUsed by /category/{slug} hub pages for hero counts (\"333 active · 867 open · 7,901 all-time\").\nCached 10 min in Redis since counts shift slowly.","operationId":"api_category_stats_api_v2_markets_category_stats_get","parameters":[{"name":"category","in":"query","required":false,"schema":{"type":"string","default":"","title":"Category"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/market/{market_id}":{"get":{"summary":"Api Market","description":"Market page data: prices, whale consensus, top traders, event group.","operationId":"api_market_api_v2_market__market_id__get","parameters":[{"name":"market_id","in":"path","required":true,"schema":{"type":"string","title":"Market Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/market/{market_id}/trades":{"get":{"summary":"Api Market Trades","description":"Recent smart whale trades on this market + daily price history.","operationId":"api_market_trades_api_v2_market__market_id__trades_get","parameters":[{"name":"market_id","in":"path","required":true,"schema":{"type":"string","title":"Market Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/market/{market_id}/lookup":{"get":{"summary":"Api Market Lookup","description":"Lightweight market resolve for bots / integrations.\n\nSingle SQL query, Redis-cached. Bot-callable contract:\n  {id, condition_id, slug, question, prices: {yes, no}, closed,\n   end_date, image_url, event_id, event_slug, neg_risk, is_negrisk}\n\nCache TTL: 60s for open, 3600s for closed.\nIncludes Polymarket disambiguation slug fallback (closed_positions_cache).\nDesigned for sub-50ms p99 — does NOT trigger heavy aggregations.\n\nReturns 404 on unknown OR malformed market_id. Format pre-check skips DB\nhit on garbage paths (Polybot audit 2026-06-08 #6: garbage IDs were taking\n960-1015ms via full DB search).","operationId":"api_market_lookup_api_v2_market__market_id__lookup_get","parameters":[{"name":"market_id","in":"path","required":true,"schema":{"type":"string","title":"Market Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/wallet/{address}/trades":{"get":{"summary":"Wallet Trades","description":"Trade history for a wallet.","operationId":"wallet_trades_api_v2_wallet__address__trades_get","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"default":100,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}},{"name":"since","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Since"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/wallet/{address}/whale-matches":{"get":{"summary":"Wallet Whale Matches","description":"Whales with the most overlapping market+side positions as the user.\n\nFor each smart whale, count markets where they have same nonusdc_side as user.\nReturns top N whales by overlap_count.","operationId":"wallet_whale_matches_api_v2_wallet__address__whale_matches_get","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/wallet/{address}/missed-opportunities":{"get":{"summary":"Wallet Missed Opportunities","description":"Markets where >=3 of user's matched whales went same side AND won AND user wasn't there.\n\nReuses /whale-matches (Redis 5min cache) for top 10 matched whales,\nthen queries missed_markets_mv (refreshed every 6h via cron) for their winning closed markets.\nUser's own market_ids excluded.","operationId":"wallet_missed_opportunities_api_v2_wallet__address__missed_opportunities_get","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":5,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/wallet/{address}/active-whale-markets":{"get":{"summary":"Wallet Active Whale Markets","description":"Active markets where >=3 of user's matched whales currently hold open position same side, user not there.\n\nSister endpoint to /missed-opportunities but for *active* (unresolved) markets.\nNo MV needed — open positions change frequently; direct query <3s, Redis-cached 60s.","operationId":"wallet_active_whale_markets_api_v2_wallet__address__active_whale_markets_get","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":5,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/wallet-search":{"get":{"summary":"Wallet Search Combined","description":"Search wallets by 0x prefix, display_name, or pseudonym across BOTH\nprofiles_cache (Polymarket user profiles) and smart_whales (chain-derived\naliases for OrcaLayer's tracked whales). The legacy /api/search only\nhit profiles_cache, missing OrcaLayer-known whales like Theo4 whose\ndisplay_name lives in smart_whales.\n\nReturns: {results: [{address, name, source}], _elapsed_ms}","operationId":"wallet_search_combined_api_v2_wallet_search_get","parameters":[{"name":"q","in":"query","required":false,"schema":{"type":"string","default":"","title":"Q"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/wallet/{address}/pnl-history-chain":{"get":{"summary":"Wallet Pnl History Chain","description":"Chain-derived cumulative P&L timeseries from closed_positions_cache.\n\nPolymarket user-pnl-api starts measurements from when they indexed the\nwallet — for inactive whales like Theo4 (last trade Nov 2024) it returns\nonly the post-peak plateau, missing the ramp-up. closed_positions_cache\nhas every closed position with its actual close timestamp and realized\nPnL, so we can reconstruct the real growth curve.\n\nDaily-bucketed cumulative sum. Returns {address, source: \"chain\",\npoints: [{t: unix_ts, p: cumulative_pnl}, ...]}.\n\nCoverage: ~3K wallets in cache (top earners + active syncs). Wallets\nnot in cache return empty points — frontend should fall back to\nPolymarket user-pnl-api.","operationId":"wallet_pnl_history_chain_api_v2_wallet__address__pnl_history_chain_get","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/wallet/{address}/pnl-history":{"get":{"summary":"Wallet Pnl History","description":"Proxy for Polymarket user-pnl-api. Returns cumulative P&L timeseries.\n\nPeriod → PM interval/fidelity:\n    1D   → 1d/1h   (hourly, last 24h)\n    1W   → 1w/1h   (hourly, last week)\n    1M   → 1m/1d   (daily, last month)\n    ALL  → max/1d  (daily, full history)\n\nResponse: {address, period, points: [{t: unix_ts, p: cumulative_pnl}, ...]}","operationId":"wallet_pnl_history_api_v2_wallet__address__pnl_history_get","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}},{"name":"period","in":"query","required":false,"schema":{"type":"string","default":"1M","title":"Period"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/whale-flips":{"get":{"summary":"Api Whale Flips","description":"List recent whale flips (sign reversal on a market over 24h, smart whales).\n\nCompares wallet_market_position today vs wallet_position_snapshots N days ago.\nReturns wallets that flipped direction with $200K+ swing.","operationId":"api_whale_flips_api_v2_whale_flips_get","parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","default":7,"title":"Days"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":20,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/conviction-clusters":{"get":{"summary":"Api Conviction Clusters","description":"List current conviction clusters — events where 3+ smart whales aligned same side\nacross 2+ related markets. Aggregate signal stronger than single-market position.","operationId":"api_conviction_clusters_api_v2_conviction_clusters_get","parameters":[{"name":"min_whales","in":"query","required":false,"schema":{"type":"integer","default":3,"title":"Min Whales"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/pm/{market_id}":{"get":{"summary":"Pm Redirect","description":"Resolve and 302-redirect to current Polymarket URL for a given market_id.\n\nTries in order: DB event_slug, DB market slug, live Gamma fetch, URL-encoded search.\nCaches the resolved URL in Redis for 1 hour. Affiliate code appended at response time.","operationId":"pm_redirect_api_v2_pm__market_id__get","parameters":[{"name":"market_id","in":"path","required":true,"schema":{"type":"string","title":"Market Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/channel/ingest":{"post":{"summary":"Channel Ingest","description":"Accept a just-published channel post from CX23 (localhost only).\n\nNginx does NOT proxy this path publicly. It is reachable solely through\nthe SSH tunnel CX23→CX33 which surfaces as a 127.0.0.1 source.","operationId":"channel_ingest_api_v2_channel_ingest_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_channel_ingest_api_v2_channel_ingest_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/channel/feed":{"get":{"summary":"Channel Feed","description":"Public feed of recent channel posts (read-only JSON).","operationId":"channel_feed_api_v2_channel_feed_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":50,"minimum":1,"default":20,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":0,"default":0,"title":"Offset"}},{"name":"type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"filter by signal_type","title":"Type"},"description":"filter by signal_type"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/wallet/{address}/ai-analysis":{"get":{"summary":"Wallet Ai Analysis Get","description":"Return saved AI analysis. 404 if none generated yet.","operationId":"wallet_ai_analysis_get_api_v2_wallet__address__ai_analysis_get","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/wallet/{address}/ai-analysis/generate":{"post":{"summary":"Wallet Ai Analysis Generate","description":"Internal-only generator. Caller must validate quota upstream.\n\nBehavior:\n  - If existing record AND age < 24h AND not force → return cached (no spend).\n  - Otherwise: call Gemini, save row, return content.\n\nRestricted to 127.0.0.1 (Next.js calls via internal URL).","operationId":"wallet_ai_analysis_generate_api_v2_wallet__address__ai_analysis_generate_post","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}},{"name":"force","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Force"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/isw/status-summary":{"get":{"summary":"Isw Status Summary","description":"Return aggregate counts by threat level. Used by /analytics live banner.","operationId":"isw_status_summary_api_v2_isw_status_summary_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v2/whales/recent-trades":{"get":{"summary":"Whales Recent Trades","description":"Most recent trades by smart whales (PnL > $100K). Cached 60s.\n\nOptional category filter for /category/{slug} hub pages. Note SQL is\nsplit into UNION ALL on lower(maker) and lower(taker) — Postgres\ncannot use the lower(maker)/lower(taker) functional indexes when the\njoin condition is `OR`, so we run two index-friendly halves and\nUNION ALL them together. ~6x faster (5s vs 32s) for category-filtered\nqueries.","operationId":"whales_recent_trades_api_v2_whales_recent_trades_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Limit"}},{"name":"hours","in":"query","required":false,"schema":{"type":"integer","default":1,"title":"Hours"}},{"name":"min_size_usd","in":"query","required":false,"schema":{"type":"number","default":100,"title":"Min Size Usd"}},{"name":"category","in":"query","required":false,"schema":{"type":"string","default":"","title":"Category"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/hot-traders":{"get":{"summary":"Api Hot Traders","description":"Top winners + top losers over last 24h for the global header ticker.\n\nAggregates realized_pnl from closed_positions_cache windowed at 24h.\nReturns 8 biggest winners + 7 biggest losers, mixed by client.\nRedis-cached 60s since query is ~1.2s and acceptable to be slightly stale.","operationId":"api_hot_traders_api_v2_hot_traders_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v2/wallet/{address}/highlights":{"get":{"summary":"Api Wallet Highlights","description":"Highlight row for wallet page: current/best winning streak + biggest single win.\n\nStreak = consecutive UTC days where SUM(realized_pnl) > 0 AND >=1 closed\nposition that day. No-trade day breaks the streak (day off != day winning).\n\nBiggest win = MAX(realized_pnl) across all closed positions, with market\ntitle/slug/condition_id for click-through.","operationId":"api_wallet_highlights_api_v2_wallet__address__highlights_get","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/wallet/{address}/rankings":{"get":{"summary":"Api Wallet Rankings","description":"Lazy-loaded rankings (5 subqueries over smart_whales 1.3M rows).\nExtracted from /overview so overview can return in ~300ms instead of 3s.","operationId":"api_wallet_rankings_api_v2_wallet__address__rankings_get","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}},{"name":"view","in":"query","required":false,"schema":{"type":"string","default":"proxy","title":"View"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/wallet/{address}/hold":{"get":{"summary":"Api Wallet Hold","description":"Lazy-loaded typical hold (slow JOIN of wms + closed_positions_cache + markets).\nExtracted from /overview so overview can return in ~300ms instead of 3s.","operationId":"api_wallet_hold_api_v2_wallet__address__hold_get","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/market/{market_id}/breakdown":{"get":{"summary":"Api Market Breakdown","description":"Lazy-loaded entry-type breakdown (MINT/MERGE/COMPLEMENTARY).\nExtracted from /market because the underlying SUM on trades_apr2026_plus\nwas 30+ seconds cold for high-volume markets with millions of trades.\n1h cache — breakdown changes slowly.","operationId":"api_market_breakdown_api_v2_market__market_id__breakdown_get","parameters":[{"name":"market_id","in":"path","required":true,"schema":{"type":"string","title":"Market Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/home/whale-moves":{"get":{"summary":"Home Whale Moves","description":"Top 8 smart-whale trades in the last 6h, $50K+ size.\n\nSource: trades_apr2026_plus joined to smart_whales + wallet_lb_api_pnl.\nUses lb_api_pnl > total_pnl chain (see feedback_polymarket_farmer_pnl_methodology).","operationId":"home_whale_moves_api_v2_home_whale_moves_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v2/home/hot-markets":{"get":{"summary":"Home Hot Markets","description":"Top 5 active markets by 24h volume.\n\nReturns market metadata + last 24h price points for inline sparkline.\nSparkline is derived from market_price_history if available.","operationId":"home_hot_markets_api_v2_home_hot_markets_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v2/home/top-whales-7d":{"get":{"summary":"Home Top Whales 7D","description":"Top 5 smart whales by 7-day realized P&L.\n\nUses closed_positions_cache.realized_pnl summed over the trailing 7 days,\nthen joins to smart_whales for the leaderboard metrics (PF/WR/volume).\nFilters out farmers.","operationId":"home_top_whales_7d_api_v2_home_top_whales_7d_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v2/home/category-rotation":{"get":{"summary":"Home Category Rotation","description":"Net volume change by category — 24h current vs 24h previous.\n\nUses markets.volume_24h (refreshed every 4h by cron) joined to\nmarket_categories. Delta = (current 24h vol) − (prev 24h vol).","operationId":"home_category_rotation_api_v2_home_category_rotation_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v2/home/community-lookups":{"get":{"summary":"Home Community Lookups","description":"Top 6 most-looked-up wallets in the last 24h.\n\nSource: wallet_lookup_log (resolves nicknames to addresses where possible).\nExcludes the lookup if wallet is not in profiles_cache or smart_whales\n(avoids exposing test/garbage queries).","operationId":"home_community_lookups_api_v2_home_community_lookups_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v2/home/ping":{"post":{"summary":"Home Ping","description":"Register a browser session as currently viewing the homepage.\n\nStores a Redis key presence:home:{sid} with 30s TTL (shorter than wallet\nping because the counter on hero updates every 5s — we want the count to\ndecay quickly when someone closes the tab).","operationId":"home_ping_api_v2_home_ping_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v2/home/watching":{"get":{"summary":"Home Watching","description":"Count unique sessions currently viewing the homepage.\n\nReturns the count of presence:home:* keys still alive in Redis.","operationId":"home_watching_api_v2_home_watching_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v2/wallet/{address}/changes-since":{"get":{"summary":"Wallet Changes Since","description":"Diff summary of wallet activity since `since` timestamp.\n\nPowers the 'What changed since last visit' banner shown to returning users.\nReturns trades count, P&L delta, and the single most recent trade for context.\n\n- trades_count: real-time, sourced from trades_apr2026_plus (indexer).\n- pnl_delta_usd: closed_positions_cache (may be slightly stale; lazy-refreshed by /overview).\n- last_move: most recent trade by this wallet in the window, with market title.\n- since is capped at NOW - 30d (banner stops being useful past that horizon).\n- If `since` is < 60s ago, returns trades_count=0 (\"nothing changed since you blinked\").","operationId":"wallet_changes_since_api_v2_wallet__address__changes_since_get","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}},{"name":"since","in":"query","required":true,"schema":{"type":"integer","description":"Unix timestamp seconds","title":"Since"},"description":"Unix timestamp seconds"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/wallet/{address}/last-moves":{"get":{"summary":"Wallet Last Moves","description":"Per-market last trade summary — { condition_id: { entry_type, action_label, usd, side_label, ts } }.\n\nReads from pre-aggregated wallet_last_moves (PK: wallet, condition_id),\nrefreshed by cron every 5min. Constant-time lookup regardless of wallet\nactivity volume (high-frequency wallets like RN1 with 600K trades over\n30d are now ~10ms instead of 30s+).\n\nPowers the \"+$8K added · 3h ago\" temporal chip on positions table rows.","operationId":"wallet_last_moves_api_v2_wallet__address__last_moves_get","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/wallet/{address}/stat-deltas":{"get":{"summary":"Wallet Stat Deltas","description":"Per-stat delta over the longest window with available history.\n\nReads wallet_pnl_snapshots (daily 02:30 UTC). For each metric:\n  - if a snapshot 7 days ago exists -> return (delta_value, window: \"7d\")\n  - else if 1 day ago exists      -> return (delta_value, window: \"24h\")\n  - else null (no baseline yet, e.g. fresh fields just added today)\n\nStats: total_pnl, closed_count, profit_factor, win_rate.\n\nPowers small sub-row chips under each stat card on the wallet page.\nCache 5min — snapshots change once a day so this is plenty.","operationId":"wallet_stat_deltas_api_v2_wallet__address__stat_deltas_get","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/wallet/{address}/pnl-events":{"get":{"summary":"Wallet Pnl Events","description":"Top realized-P&L events (closures) for the wallet within a period.\n\nPowers clickable markers on the Performance Over Time chart — each event\nrenders as a dot on the chart with hover tooltip + click → market page.\n\nSource: closed_positions_cache. Ordered by ABS(realized_pnl) DESC so the\nmost visually impactful wins/losses surface.","operationId":"wallet_pnl_events_api_v2_wallet__address__pnl_events_get","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}},{"name":"period","in":"query","required":false,"schema":{"type":"string","description":"1D, 1W, 1M, or ALL","default":"ALL","title":"Period"},"description":"1D, 1W, 1M, or ALL"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":30,"minimum":1,"default":12,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/payments/whop-webhook":{"post":{"summary":"Whop Webhook","operationId":"whop_webhook_api_v2_payments_whop_webhook_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v2/payments/nowpayments-ipn":{"post":{"summary":"Nowpayments Ipn","operationId":"nowpayments_ipn_api_v2_payments_nowpayments_ipn_post","parameters":[{"name":"x-nowpayments-sig","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Nowpayments-Sig"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/payments/checkout-session":{"post":{"summary":"Create Checkout Session","operationId":"create_checkout_session_api_v2_payments_checkout_session_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/payments/confirm-nowpayments":{"post":{"summary":"Confirm Nowpayments","description":"Checks DB + optionally polls NOWPayments API for latest payment status.","operationId":"confirm_nowpayments_api_v2_payments_confirm_nowpayments_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfirmNowRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/payments/confirm-whop":{"post":{"summary":"Confirm Whop","description":"Queries Whop API for memberships matching orcalayer_user_id in metadata,\nactivates tier IMMEDIATELY after payment (no webhook dependency).\nCalled by /upgrade/success on load for instant UX.","operationId":"confirm_whop_api_v2_payments_confirm_whop_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfirmWhopRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/payments/subscription":{"get":{"summary":"Get User Subscription","operationId":"get_user_subscription_api_v2_payments_subscription_get","parameters":[{"name":"user_id","in":"query","required":true,"schema":{"type":"string","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/live/trades":{"get":{"tags":["live-internal"],"summary":"Live Trades","description":"SSE stream — INTERNAL ONLY. Nginx enforces localhost access.","operationId":"live_trades_api_v2_live_trades_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v2/live/stats":{"get":{"tags":["live-internal"],"summary":"Live Stats","description":"Monitoring: WS messages seen per hour (last 48h).","operationId":"live_stats_api_v2_live_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/public/v1/live/trades":{"get":{"tags":["live-premium"],"summary":"Premium Live Trades","description":"SSE stream — PREMIUM TIER ONLY.\n\nAuth: `Authorization: Bearer <api_key>` (or `X-API-Key: <api_key>`).\nRate limit: per key, 300 req/min default (shared across all public endpoints).\nMax concurrent live connections per key: 5.\n\nEvent format:\n  event: trade\n  data: { ...Polymarket Trade payload... }\n\nClient usage:\n  curl -N -H \"Authorization: Bearer YOUR_KEY\" https://orcalayer.com/api/public/v1/live/trades","operationId":"premium_live_trades_api_public_v1_live_trades_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-API-Key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/public/v1/live/isw/live":{"get":{"tags":["live-premium"],"summary":"Isw Live Stream","description":"Push-based SSE stream of ISW territorial events.\n\nClient example:\n  curl -N -H \"Authorization: Bearer YOUR_KEY\"            \"https://orcalayer.com/api/public/v1/isw/live?threat=HIGH,CRITICAL\"","operationId":"isw_live_stream_api_public_v1_live_isw_live_get","parameters":[{"name":"threat","in":"query","required":false,"schema":{"type":"string","default":"","title":"Threat"}},{"name":"city","in":"query","required":false,"schema":{"type":"string","default":"","title":"City"}},{"name":"event_type","in":"query","required":false,"schema":{"type":"string","default":"","title":"Event Type"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-API-Key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/internal/sentry-webhook":{"post":{"tags":["internal"],"summary":"Sentry Webhook","operationId":"sentry_webhook_internal_sentry_webhook_post","parameters":[{"name":"sentry-hook-signature","in":"header","required":false,"schema":{"type":"string","default":"","title":"Sentry-Hook-Signature"}},{"name":"sentry-hook-resource","in":"header","required":false,"schema":{"type":"string","default":"","title":"Sentry-Hook-Resource"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/cowork/feed":{"get":{"tags":["cowork"],"summary":"Cowork Feed","operationId":"cowork_feed_api_admin_cowork_feed_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/cowork/health":{"get":{"tags":["cowork"],"summary":"Cowork Health","operationId":"cowork_health_api_admin_cowork_health_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/cowork/feedback":{"get":{"tags":["cowork"],"summary":"Cowork Feedback","operationId":"cowork_feedback_api_admin_cowork_feedback_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/track-record":{"get":{"tags":["admin-track-record"],"summary":"Track Record","description":"Returns all rows of signal_track_record, grouped by signal_type.\n\nResponse:\n{\n  \"updated_at\": \"2026-05-23T...\",\n  \"signals\": [\n    {\n      \"signal_type\": \"big_position\",\n      \"periods\": [\n        {\n          \"label\": \"all_time\", \"period_start\": null, \"period_end\": null,\n          \"total_alerts\": 340, \"unique_calls\": 108, \"with_market\": 108,\n          \"closed\": 86, \"resolved\": 60, \"scoreable\": 53, \"hits\": 29,\n          \"hit_rate\": 54.72,\n          \"unscoreable_sports\": 7, \"unscoreable_noside\": 0,\n          \"closed_unresolved\": 25\n        }, ... monthly ...\n      ]\n    }, ...\n  ]\n}","operationId":"track_record_api_admin_track_record_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/track-record/breakdown":{"get":{"tags":["admin-track-record"],"summary":"Track Record Breakdown","description":"Per-category breakdown for one signal_type. Cached 60s in Redis.\n\nReturns rows: { category, calls, resolved, scoreable, hits, hit_rate }\nsorted by call count DESC. 'hit_rate' is null when scoreable=0.","operationId":"track_record_breakdown_api_admin_track_record_breakdown_get","parameters":[{"name":"signal_type","in":"query","required":true,"schema":{"type":"string","title":"Signal Type"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/search":{"get":{"summary":"Api Search","description":"Search traders by nickname or wallet address","operationId":"api_search_api_search_get","parameters":[{"name":"q","in":"query","required":false,"schema":{"type":"string","default":"","title":"Q"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/wallet/{address}":{"get":{"summary":"Api Wallet","operationId":"api_wallet_api_wallet__address__get","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/wallet/{address}/timeseries":{"get":{"summary":"Api Wallet Timeseries","description":"Cumulative PnL timeseries from PM closed_positions_cache (source of truth).","operationId":"api_wallet_timeseries_api_wallet__address__timeseries_get","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}},{"name":"view","in":"query","required":false,"schema":{"type":"string","default":"proxy","title":"View"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/analytics/global":{"get":{"summary":"Api Analytics Global","operationId":"api_analytics_global_api_analytics_global_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/analytics/latest-headline":{"get":{"summary":"Api Analytics Latest Headline","description":"Latest AI-generated headline for the Analytics narrator strip.\n\nSource: analytics_headline_history table (fed by analytics_headline_generator.py\ncron, every 4h). Returns the most recent row.","operationId":"api_analytics_latest_headline_api_analytics_latest_headline_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/analytics/smart-money-flow":{"get":{"summary":"Api Analytics Smart Money Flow","description":"Per-category smart-money flow with 24h vs prev-24h signed delta.\n\nReplaces the static % composition bar (descriptive — where capital SITS)\nwith a directional signal (actionable — where capital is MOVING).\n\nData sources:\n  - whale_consensus_cache + market_categories + markets: current whale\n    positions per category (the prior 'pct' value).\n  - smart_trades_recent (rolling 48h): volume in last-24h vs previous-24h,\n    per category. Signed delta % = direction of flow.\n\nNo new tables, no new cron — reuses rolling 48h smart_trades_recent.","operationId":"api_analytics_smart_money_flow_api_analytics_smart_money_flow_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/analytics/whale-volume-24h":{"get":{"summary":"Api Analytics Whale Volume 24H","description":"24h hourly smart-whale volume series for the Analytics time-series chart.\n\nReads from smart_trades_recent (~270 trades/hour smart-only). Returns 24\nhour buckets (yes/no volume + total trades) plus a dots list of mega trades\n(>$100K) from big_trades_recent for the overlay.","operationId":"api_analytics_whale_volume_24h_api_analytics_whale_volume_24h_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/analytics/whale-clusters":{"get":{"summary":"Api Analytics Whale Clusters","description":"Whale clusters — markets where >=3 smart wallets took the same side\ninside a short window. Strongest co-action signal on Polymarket.\n\nReads from smart_trades_recent (rolling 48h table maintained by cron */5).\nOn-demand groupby — no new table, no extra cron. Cheap (<15K rows scan).","operationId":"api_analytics_whale_clusters_api_analytics_whale_clusters_get","parameters":[{"name":"minutes","in":"query","required":false,"schema":{"type":"integer","default":60,"title":"Minutes"}},{"name":"min_whales","in":"query","required":false,"schema":{"type":"integer","default":3,"title":"Min Whales"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":5,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/analytics/top-movers":{"get":{"summary":"Api Analytics Top Movers","description":"Top movers over N days — wallets with biggest P&L swing (up or down).\n\nReplaces the duplicate \"Top 10 Smart Whales\" block (which mirrored\n/leaderboard verbatim). Reads from wallet_pnl_snapshots (daily snapshot,\n16+ days of history as of 25.05.2026) — no new cron, no new data.\n\nReturns winners (positive delta, mint) and losers (negative delta, coral)\nside-by-side with a 7-point P&L trajectory for the mini-sparkline.","operationId":"api_analytics_top_movers_api_analytics_top_movers_get","parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","default":7,"title":"Days"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":5,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/wallet/{address}/og":{"get":{"summary":"Api Wallet Og","description":"Lightweight wallet snapshot for OpenGraph image generation.\n\nReads smart_whales row (~5ms) for badges, name, markets, WR. For\ntotal_pnl, prefers Polymarket canonical user-pnl-api (matches what\n/wallet page displays) and falls back to smart_whales.total_pnl on\ntimeout/failure. Side metrics (volume, trades, roi) stay from\nsmart_whales.","operationId":"api_wallet_og_api_wallet__address__og_get","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/referral/stats":{"get":{"summary":"Api Referral Stats","description":"Returns the current user's referral state.\nAuth: requires header X-Orca-User-Id from the Next.js session-bound proxy.","operationId":"api_referral_stats_api_referral_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/referral/claim":{"post":{"summary":"Api Referral Claim","description":"Atomically: check threshold, mark payments consumed, grant 30-day reward.\nBody: {\"tier\": \"pro\" | \"premium\"}.","operationId":"api_referral_claim_api_referral_claim_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/leaderboard":{"get":{"summary":"Api Leaderboard","operationId":"api_leaderboard_api_leaderboard_get","parameters":[{"name":"sort","in":"query","required":false,"schema":{"type":"string","default":"total_pnl","title":"Sort"}},{"name":"filter","in":"query","required":false,"schema":{"type":"string","default":"smart","title":"Filter"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1,"title":"Page"}},{"name":"sort_dir","in":"query","required":false,"schema":{"type":"string","default":"desc","title":"Sort Dir"}},{"name":"category","in":"query","required":false,"schema":{"type":"string","default":"","title":"Category"}},{"name":"hide_farmers","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Hide Farmers"}},{"name":"hide_sports","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Hide Sports"}},{"name":"hide_crypto","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Hide Crypto"}},{"name":"hide_bots","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Hide Bots"}},{"name":"period","in":"query","required":false,"schema":{"type":"string","default":"All Time","title":"Period"}},{"name":"min_wr","in":"query","required":false,"schema":{"type":"number","default":0,"title":"Min Wr"}},{"name":"min_pnl","in":"query","required":false,"schema":{"type":"number","default":0,"title":"Min Pnl"}},{"name":"min_markets","in":"query","required":false,"schema":{"type":"integer","default":20,"title":"Min Markets"}},{"name":"min_profit_factor","in":"query","required":false,"schema":{"type":"number","default":0,"title":"Min Profit Factor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/health":{"get":{"summary":"Api V1 Health","description":"Deep health: DB, Redis, indexer lag, ISW heartbeat, SSE hourly counter.\nCached 10s. status=\"ok\" -> HTTP 200; \"degraded\" -> 200; \"down\" -> 503.\nPublic endpoint, no auth (UptimeRobot-friendly).","operationId":"api_v1_health_health_head","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"head":{"summary":"Api V1 Health","description":"Deep health: DB, Redis, indexer lag, ISW heartbeat, SSE hourly counter.\nCached 10s. status=\"ok\" -> HTTP 200; \"degraded\" -> 200; \"down\" -> 503.\nPublic endpoint, no auth (UptimeRobot-friendly).","operationId":"api_v1_health_health_head","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/health":{"get":{"summary":"Api V1 Health","description":"Deep health: DB, Redis, indexer lag, ISW heartbeat, SSE hourly counter.\nCached 10s. status=\"ok\" -> HTTP 200; \"degraded\" -> 200; \"down\" -> 503.\nPublic endpoint, no auth (UptimeRobot-friendly).","operationId":"api_v1_health_api_v1_health_head","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"head":{"summary":"Api V1 Health","description":"Deep health: DB, Redis, indexer lag, ISW heartbeat, SSE hourly counter.\nCached 10s. status=\"ok\" -> HTTP 200; \"degraded\" -> 200; \"down\" -> 503.\nPublic endpoint, no auth (UptimeRobot-friendly).","operationId":"api_v1_health_api_v1_health_head","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}}},"components":{"schemas":{"Body_channel_ingest_api_v2_channel_ingest_post":{"properties":{"image":{"type":"string","contentMediaType":"application/octet-stream","title":"Image"},"signal_type":{"type":"string","title":"Signal Type"},"caption_html":{"type":"string","title":"Caption Html"},"market_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Market Id"},"side":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Side"},"topic":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Topic"},"tg_message_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Tg Message Id"},"payload_json":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Payload Json"}},"type":"object","required":["image","signal_type","caption_html"],"title":"Body_channel_ingest_api_v2_channel_ingest_post"},"CheckoutRequest":{"properties":{"gateway":{"type":"string","title":"Gateway"},"tier":{"type":"string","title":"Tier"},"period":{"type":"string","title":"Period"},"user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"},"wallet":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Wallet"}},"type":"object","required":["gateway","tier","period"],"title":"CheckoutRequest"},"ConfirmNowRequest":{"properties":{"user_id":{"type":"string","title":"User Id"},"order_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Order Id"}},"type":"object","required":["user_id"],"title":"ConfirmNowRequest"},"ConfirmWhopRequest":{"properties":{"user_id":{"type":"string","title":"User Id"}},"type":"object","required":["user_id"],"title":"ConfirmWhopRequest"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}