{"openapi":"3.1.0","info":{"title":"OrcaLayer API","version":"2.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":{"anyOf":[{"type":"integer","maximum":500,"exclusiveMinimum":0},{"type":"null"}],"description":"Max positions to return; omit for the full list (cap 500 when set)","title":"Limit"},"description":"Max positions to return; omit for the full list (cap 500 when set)"},{"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}/fees":{"get":{"summary":"Wallet Fees","operationId":"wallet_fees_api_v2_wallet__address__fees_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}/insights":{"get":{"summary":"Wallet Insights","operationId":"wallet_insights_api_v2_wallet__address__insights_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}/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\nskill: 1 = only wallets with the strict skill badge (a subset of Smart Money)","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"}},{"name":"skill","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Skill"}}],"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.\n\n10.10.2026 (Viktor OK; pm-content walk-forward lost the older months of big whales at the 1,000 cap): paged by\nlimit (<= 1000) / offset with has_more, optional since / until (YYYY-MM-DD UTC, inclusive, by last_trade_ts) and\nslug_prefix (league / topic). Order: last_trade_ts DESC, then market_id, side - stable across pages.\nsummary covers the returned page only.","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"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}},{"name":"since","in":"query","required":false,"schema":{"type":"string","default":"","title":"Since"}},{"name":"until","in":"query","required":false,"schema":{"type":"string","default":"","title":"Until"}},{"name":"slug_prefix","in":"query","required":false,"schema":{"type":"string","default":"","title":"Slug Prefix"}}],"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.\n\n10.10.2026 (Viktor OK; asked for a \"check a whale yourself\" script): with slug_prefix (e.g. mlb-, nfl-, lol-) the list is\nevery resolved market whose slug starts with it, optionally inside end_from / end_to (YYYY-MM-DD, by market end date),\nnewest end date first, paged by limit (<= 500) / offset, with has_more. Uses idx_markets_slug_prefix_closed. Without\nslug_prefix the endpoint behaves as before (resolved in the last `days`, <= 100 rows).\n\n10.10.2026 (Viktor OK): both modes list only markets with a final outcome (YES / NO, see _RESOLVED_SQL);\ninclude_pending=1 also lists closed markets without one (outcome PENDING; final_price_yes null when there is no price).","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"}},{"name":"slug_prefix","in":"query","required":false,"schema":{"type":"string","default":"","title":"Slug Prefix"}},{"name":"end_from","in":"query","required":false,"schema":{"type":"string","default":"","title":"End From"}},{"name":"end_to","in":"query","required":false,"schema":{"type":"string","default":"","title":"End To"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}},{"name":"include_pending","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Include Pending"}}],"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 status with Redis cache (45s) + last-known-good fallback.\n\n2026-07-05: under nightly cron pool-exhaustion the bounded fetch times out\nand we serve LKG instead of 500/504 (the false-down this fix targets). ISW\nupdates only 13-19 UTC, so 45s staleness / day-old LKG is safe. Monitor\n(UptimeRobot) hits the 45s cache almost always -> never touches the DB pool.","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 status with Redis cache (45s) + last-known-good fallback.\n\n2026-07-05: under nightly cron pool-exhaustion the bounded fetch times out\nand we serve LKG instead of 500/504 (the false-down this fix targets). ISW\nupdates only 13-19 UTC, so 45s staleness / day-old LKG is safe. Monitor\n(UptimeRobot) hits the 45s cache almost always -> never touches the DB pool.","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}/market-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__market_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)\n\n10.10.2026 (Viktor OK; pm-content: a fair walk-forward needs every trader of a match, because\nmaker_is_whale / taker_is_whale is TODAY's Smart Money list, built over the whole history incl. the\ntested months):\n  wallets   — smart (default, as before) | all (every trade on the market, flags still today's)\n  before_id — page cursor with `before`: rows strictly before (before, before_id) in\n              (timestamp DESC, id DESC) order; a single second can hold > 500 trades, so `before`\n              alone repeats or skips rows. Without it: timestamp <= before, as before.\n  has_more / next_before / next_before_id in the response.","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"}},{"name":"wallets","in":"query","required":false,"schema":{"type":"string","default":"smart","title":"Wallets"}},{"name":"before_id","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Before 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/{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/site-stats":{"get":{"summary":"Api Site Stats","description":"Public homepage stats — single source of truth for hero counts.\nsmart_whales (is_smart=true), markets, trades (reltuples approx). Cached 1h.\nReplaces hardcoded homepage numbers (195K/945M/1M) that drifted from reality.","operationId":"api_site_stats_api_v2_site_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/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":"Full raw trade feed for a wallet, across all history partitions.\n\nsince  — unix ts lower bound (exclusive). 0/omitted = last 30 days; pass since=1 for full archive.\nbefore — unix ts upper bound (exclusive). 0 = no upper bound. Use for date-range / cursor paging.","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"}},{"name":"before","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Before"}}],"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":"Polymarket P&L series (v2 /user-pnl since 15.10.2026: user-pnl-api is retired). 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, $200K+ swing, smart non-farmer whales).\n\nServed from the precomputed whale_flips_cache (rebuilt hourly via\nbuild_whale_flips_cache.sql); NEVER computed live — the live aggregate scans\n~38M rows of wallet_market_position and took ~125s, exceeding the 60s gateway\ntimeout (the 504 that churned a paying dev). comparison_date is the actual\nsnapshot used; when CURRENT_DATE - days has no snapshot it is clamped backward\nto the nearest available date strictly before today.","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/key/verify":{"get":{"summary":"Api Key Verify","description":"Self-service key check — added 31.08.2026.\n\nWhy it exists: a customer with a perfectly valid key could not tell\nwhether the problem was the key, the subscription or the header, and had\nto open a support ticket to find out. This answers all three in one call.\n\nDeliberately NOT premium-gated: it must answer WITHOUT a key too,\notherwise the diagnostic returns the same 401 it is meant to explain.\nNever returns the key itself — prefix only.","operationId":"api_key_verify_api_v2_key_verify_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/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/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/wallets/overview":{"post":{"summary":"Api Wallets Overview Batch","description":"Batch wallet overview — up to 50 wallets per call, served from\nwallet_overview_cache (same as_of contract as the single endpoint).","operationId":"api_wallets_overview_batch_api_v2_wallets_overview_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v2/wallets/positions":{"post":{"summary":"Api Wallets Positions Batch","description":"Batch open positions — up to 20 wallets per call.","operationId":"api_wallets_positions_batch_api_v2_wallets_positions_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v2/wallet/{address}/money-flow":{"get":{"summary":"Wallet Money Flow","operationId":"wallet_money_flow_api_v2_wallet__address__money_flow_get","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}},{"name":"flow","in":"query","required":false,"schema":{"type":"string","default":"all","title":"Flow"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"default":100,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"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}/position/{condition_id}":{"get":{"summary":"Wallet Position In Market","description":"Скільки токенів кожної сторони гаманець тримає ЗАРАЗ (on-chain).","operationId":"wallet_position_in_market_api_v2_wallet__address__position__condition_id__get","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}},{"name":"condition_id","in":"path","required":true,"schema":{"type":"string","title":"Condition Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/weather/city/{slug}":{"get":{"summary":"Api Weather City","operationId":"api_weather_city_api_v2_weather_city__slug__get","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","title":"Slug"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/weather/city/{slug}/stations":{"get":{"summary":"Api Weather Stations","description":"Sensor layer for the station map: resolution station + nearby PWS\n(live from api.weather.com, redis-cached 10 min).","operationId":"api_weather_stations_api_v2_weather_city__slug__stations_get","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","title":"Slug"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/weather/city/{slug}/smart":{"get":{"summary":"Api Weather Smart","description":"Smart money in today's market (kind=highest|lowest): real trades from\ntrades_apr2026_plus (today, city-local) + smart_whales profile join +\nweather-specific W/R from weather_trader_stats (daily precompute off the\nclosed-positions snapshot; unredeemed full losers are under-counted there,\nso W/R skews slightly optimistic -- labeled in the UI).","operationId":"api_weather_smart_api_v2_weather_city__slug__smart_get","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","title":"Slug"}},{"name":"kind","in":"query","required":false,"schema":{"type":"string","default":"highest","title":"Kind"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/weather/cities":{"get":{"summary":"Api Weather Cities","description":"Hub feed: every active city + today's truth + leading bucket + model\nedge on that bucket (default hub sort = |edge|). Physics crossing a\nbucket bound forces EDGE regardless of the model gap (design rule).","operationId":"api_weather_cities_api_v2_weather_cities_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v2/weather/pro/history":{"get":{"tags":["weather-pro"],"summary":"Weather History","description":"Day by day: what the resolution source recorded, which bucket won, what our model picked and how it scored.","operationId":"weather_history_api_v2_weather_pro_history_get","parameters":[{"name":"city","in":"query","required":true,"schema":{"type":"string","title":"City"}},{"name":"kind","in":"query","required":false,"schema":{"type":"string","pattern":"^(highest|lowest)$","default":"highest","title":"Kind"}},{"name":"from","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"YYYY-MM-DD, local date; default: 30 days back","title":"From"},"description":"YYYY-MM-DD, local date; default: 30 days back"},{"name":"to","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"YYYY-MM-DD, local date; default: yesterday","title":"To"},"description":"YYYY-MM-DD, local date; default: yesterday"},{"name":"include_prices","in":"query","required":false,"schema":{"type":"boolean","description":"add every bucket's YES price at local 10:00 and 14:00","default":false,"title":"Include Prices"},"description":"add every bucket's YES price at local 10:00 and 14:00"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/weather/pro/observations":{"get":{"tags":["weather-pro"],"summary":"Weather Observations","description":"Every observation we hold for the city's station(s) on one local day. METAR back to 2023-07-01; since 2026-07-26 also\nthe resolution source's own series (Wunderground / HKO).","operationId":"weather_observations_api_v2_weather_pro_observations_get","parameters":[{"name":"city","in":"query","required":true,"schema":{"type":"string","title":"City"}},{"name":"date","in":"query","required":true,"schema":{"type":"string","description":"YYYY-MM-DD, local date","title":"Date"},"description":"YYYY-MM-DD, local date"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/weather/pro/snapshot":{"get":{"tags":["weather-pro"],"summary":"Weather Snapshot","description":"Every city that has an open market for the date: all buckets with market price, model probability and edge,\nin one call (the same numbers as the free per-city endpoint).","operationId":"weather_snapshot_api_v2_weather_pro_snapshot_get","parameters":[{"name":"kind","in":"query","required":false,"schema":{"type":"string","pattern":"^(highest|lowest)$","default":"highest","title":"Kind"}},{"name":"date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"YYYY-MM-DD, local date of the market; default: each city's today","title":"Date"},"description":"YYYY-MM-DD, local date of the market; default: each city's today"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/weather/pro/prices":{"get":{"tags":["weather-pro"],"summary":"Weather Prices","description":"10-minute YES-price history of one bucket (market_id) or of every bucket of an event (event_slug). Up to 14 days per call.","operationId":"weather_prices_api_v2_weather_pro_prices_get","parameters":[{"name":"event_slug","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Event Slug"}},{"name":"market_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Market Id"}},{"name":"from","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO time or YYYY-MM-DD (UTC); default: 3 days before `to`","title":"From"},"description":"ISO time or YYYY-MM-DD (UTC); default: 3 days before `to`"},{"name":"to","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO time or YYYY-MM-DD (UTC); default: now","title":"To"},"description":"ISO time or YYYY-MM-DD (UTC); default: now"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/weather/pro/traders":{"get":{"tags":["weather-pro"],"summary":"Weather Traders","description":"Weather traders by their resolved weather positions (one row per wallet and market). Farmers and bots are excluded.","operationId":"weather_traders_api_v2_weather_pro_traders_get","parameters":[{"name":"city","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"city slug; omit for all cities combined","title":"City"},"description":"city slug; omit for all cities combined"},{"name":"min_markets","in":"query","required":false,"schema":{"type":"integer","maximum":10000,"minimum":1,"description":"min resolved weather positions","default":20,"title":"Min Markets"},"description":"min resolved weather positions"},{"name":"sort","in":"query","required":false,"schema":{"type":"string","pattern":"^(pnl|win_rate|markets)$","default":"pnl","title":"Sort"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","maximum":5000,"minimum":0,"default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/book/pro/history":{"get":{"tags":["book-pro"],"summary":"Book History","description":"Best bid / ask, spread and the dollars resting within 1¢ and 5¢ of the touch on each side, one row per step.","operationId":"book_history_api_v2_book_pro_history_get","parameters":[{"name":"market","in":"query","required":true,"schema":{"type":"string","description":"condition id, slug or market id","title":"Market"},"description":"condition id, slug or market id"},{"name":"outcome","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Yes / No or the outcome name; default the first outcome","title":"Outcome"},"description":"Yes / No or the outcome name; default the first outcome"},{"name":"from","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO time, YYYY-MM-DD or unix seconds; default 24h before `to`","title":"From"},"description":"ISO time, YYYY-MM-DD or unix seconds; default 24h before `to`"},{"name":"to","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"default now","title":"To"},"description":"default now"},{"name":"step","in":"query","required":false,"schema":{"type":"string","pattern":"^(5m|15m|1h|1d)$","default":"5m","title":"Step"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/book/pro/at":{"get":{"tags":["book-pro"],"summary":"Book At","description":"The full top-10 book on both sides at the last snapshot at or before `ts` (within 15 minutes).","operationId":"book_at_api_v2_book_pro_at_get","parameters":[{"name":"market","in":"query","required":true,"schema":{"type":"string","description":"condition id, slug or market id","title":"Market"},"description":"condition id, slug or market id"},{"name":"outcome","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Yes / No or the outcome name; default the first outcome","title":"Outcome"},"description":"Yes / No or the outcome name; default the first outcome"},{"name":"ts","in":"query","required":true,"schema":{"type":"string","description":"the moment: ISO time or unix seconds","title":"Ts"},"description":"the moment: ISO time or unix seconds"}],"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"}}}}}}},"/api/public/v1/live/trades-indexed":{"get":{"tags":["live-premium"],"summary":"Indexed Trades Stream","description":"SSE stream of indexer-enriched trades. PREMIUM TIER ONLY.\n\nClient example:\n  curl -N -H \"Authorization: Bearer YOUR_KEY\"            \"https://orcalayer.com/api/public/v1/live/trades-indexed?types=mint,merge\"\n\nEvent format:\n  event: trade\n  data: {\"id\":..., \"entry_type\":\"MINT\", \"maker\":\"0x..\", \"taker\":\"0x..\", ...}","operationId":"indexed_trades_stream_api_public_v1_live_trades_indexed_get","parameters":[{"name":"types","in":"query","required":false,"schema":{"type":"string","default":"","title":"Types"}},{"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/v2/esports/hub":{"get":{"summary":"Esports Hub","operationId":"esports_hub_api_v2_esports_hub_get","parameters":[{"name":"game","in":"query","required":false,"schema":{"type":"string","default":"all","title":"Game"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/esports/match/{slug}":{"get":{"summary":"Esports Match","operationId":"esports_match_api_v2_esports_match__slug__get","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","title":"Slug"}},{"name":"sig_limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Sig Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/esports/stats":{"get":{"summary":"Esports Stats","operationId":"esports_stats_api_v2_esports_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v2/esports/match/{slug}/price-path":{"get":{"summary":"Esports Price Path","description":"Per-minute VWAP (YES price) of one market of the match since the match window\nopened, plus the match timeline (status/score/period/consensus/deciding/resolved\nfrom esports_match_events). Drives the price strip above the canvas (C4) and\nthe G1/G2 marks (E4).","operationId":"esports_price_path_api_v2_esports_match__slug__price_path_get","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","title":"Slug"}},{"name":"market","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Market"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/esports/match/{slug}/dots":{"get":{"summary":"Esports Dots History","description":"The last `window` seconds of a match's fills as canvas dots (same schema as the live\n`dots` stream: [t_ms, market_id, price_bp, usd_cents, side_yes, significant, mask, taker, name]). Public;\nused to freeze the cockpit at the end of a finished match (QA 05.09, blocker 1).\n`to` = the match's last fill (or now for a live one).\n\nThe ceiling was 1800 until 15.09.2026, and the cockpit asks for 6h (`Cockpit.tsx`, the\none lazy whole-match pull that looks for the biggest fills when the 4-minute window holds\nnothing of size). So every one of those calls answered 422, the component never set its\nstate, and `live.tick` re-fired the effect every 5 seconds for the length of the match:\n613 refusals in the week 07-13.09, 180 more on 15.09 alone, all on live matches, all with\nour own match page as the referer. Measured before raising it: a 6h window on a live CS2\nmatch is 2,556 fills, and the endpoint answers the largest allowed window in 0.26s / 21KB.\n12 x 1800 = 6h exactly, which is the longest a BO5 plus its pre-match trading runs.","operationId":"esports_dots_history_api_v2_esports_match__slug__dots_get","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","title":"Slug"}},{"name":"window","in":"query","required":false,"schema":{"type":"integer","maximum":21600,"minimum":30,"default":240,"title":"Window"}},{"name":"market","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Market"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/esports/match/{slug}/orders":{"get":{"summary":"Esports Orders History","description":"Rewind (C8, Pro — gated by PROTECTED_REGEX in app_v2): taker orders of the match\nbefore `before` (epoch s), newest first, one row per tx with all fills folded —\nthe same shape the live `orders` stream uses, from the indexed chain.","operationId":"esports_orders_history_api_v2_esports_match__slug__orders_get","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","title":"Slug"}},{"name":"before","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Before"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":100,"title":"Limit"}},{"name":"market","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Market"}},{"name":"min_usd","in":"query","required":false,"schema":{"type":"number","minimum":0,"default":500.0,"title":"Min Usd"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/esports/tournaments":{"get":{"summary":"Esports Tournaments","operationId":"esports_tournaments_api_v2_esports_tournaments_get","parameters":[{"name":"game","in":"query","required":false,"schema":{"type":"string","default":"all","title":"Game"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/esports/tournament/{key}":{"get":{"summary":"Esports Tournament","description":"Artboard 2b: header + live / upcoming / finished (with \"N early · M smart\" on finished\nrows — review fix 2) + tournament leaders (realized P&L summed over the resolved matches,\nledger per match as in the recap; mm/minter out) + most active smart wallets + team cards\n(record, maps, \"market favorite in X of Y\" from the first consensus snapshot's price).","operationId":"esports_tournament_api_v2_esports_tournament__key__get","parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string","title":"Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/esports/match/{slug}/recap":{"get":{"summary":"Esports Recap","operationId":"esports_recap_api_v2_esports_match__slug__recap_get","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","title":"Slug"}},{"name":"sig_limit","in":"query","required":false,"schema":{"type":"integer","maximum":2000,"minimum":1,"default":200,"title":"Sig Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/esports/sitemap":{"get":{"summary":"Esports Sitemap","operationId":"esports_sitemap_api_v2_esports_sitemap_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v2/business/screener":{"get":{"tags":["business"],"summary":"Screener","description":"Рейтинг гаманців. Метрики — нічні агрегати бектесту (як /whale/{addr}/backtest, але на всіх гаманцях одразу).","operationId":"screener_api_v2_business_screener_get","parameters":[{"name":"category","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"SPORTS | POLITICS | CRYPTO | GEOPOLITICS | ECONOMICS | TECH","title":"Category"},"description":"SPORTS | POLITICS | CRYPTO | GEOPOLITICS | ECONOMICS | TECH"},{"name":"min_category_pct","in":"query","required":false,"schema":{"type":"number","maximum":100,"minimum":0,"description":"min share of the wallet's trades in `category`, %","default":50.0,"title":"Min Category Pct"},"description":"min share of the wallet's trades in `category`, %"},{"name":"active_days","in":"query","required":false,"schema":{"type":"integer","maximum":365,"minimum":1,"description":"last trade within N days","default":30,"title":"Active Days"},"description":"last trade within N days"},{"name":"min_resolved","in":"query","required":false,"schema":{"type":"integer","maximum":100000,"minimum":1,"description":"min resolved markets","default":20,"title":"Min Resolved"},"description":"min resolved markets"},{"name":"min_win_rate","in":"query","required":false,"schema":{"anyOf":[{"type":"number","maximum":100,"minimum":0},{"type":"null"}],"description":"%","title":"Min Win Rate"},"description":"%"},{"name":"min_roi","in":"query","required":false,"schema":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"%","title":"Min Roi"},"description":"%"},{"name":"min_pnl","in":"query","required":false,"schema":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"USD, all-time","title":"Min Pnl"},"description":"USD, all-time"},{"name":"smart_only","in":"query","required":false,"schema":{"type":"boolean","default":true,"title":"Smart Only"}},{"name":"exclude_farmers","in":"query","required":false,"schema":{"type":"boolean","default":true,"title":"Exclude Farmers"}},{"name":"exclude_bots","in":"query","required":false,"schema":{"type":"boolean","default":true,"title":"Exclude Bots"}},{"name":"sort","in":"query","required":false,"schema":{"type":"string","description":"pnl | roi | win_rate | profit_factor | resolved | volume","default":"pnl","title":"Sort"},"description":"pnl | roi | win_rate | profit_factor | resolved | volume"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","maximum":10000,"minimum":0,"default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/business/webhooks":{"get":{"tags":["business"],"summary":"Webhook List","operationId":"webhook_list_api_v2_business_webhooks_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"tags":["business"],"summary":"Webhook Create","description":"Створити веб-хук. Секрет для перевірки підпису повертається ОДИН раз.","operationId":"webhook_create_api_v2_business_webhooks_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookIn"}}},"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/business/webhooks/{hook_id}":{"delete":{"tags":["business"],"summary":"Webhook Delete","operationId":"webhook_delete_api_v2_business_webhooks__hook_id__delete","parameters":[{"name":"hook_id","in":"path","required":true,"schema":{"type":"integer","title":"Hook Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/business/webhooks/{hook_id}/test":{"post":{"tags":["business"],"summary":"Webhook Test","description":"Надіслати підписану тестову подію зараз і повернути результат доставки.","operationId":"webhook_test_api_v2_business_webhooks__hook_id__test_post","parameters":[{"name":"hook_id","in":"path","required":true,"schema":{"type":"integer","title":"Hook Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/business/webhooks/{hook_id}/deliveries":{"get":{"tags":["business"],"summary":"Webhook Deliveries","operationId":"webhook_deliveries_api_v2_business_webhooks__hook_id__deliveries_get","parameters":[{"name":"hook_id","in":"path","required":true,"schema":{"type":"integer","title":"Hook Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"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/business/export/wallet/{address}/trades.csv":{"get":{"tags":["business"],"summary":"Export Wallet Trades","description":"Повна історія угод гаманця CSV-потоком (хронологічно). Лише Business.","operationId":"export_wallet_trades_api_v2_business_export_wallet__address__trades_csv_get","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}},{"name":"since","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"unix ts, inclusive; default = 90 days ago","default":0,"title":"Since"},"description":"unix ts, inclusive; default = 90 days ago"},{"name":"until","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"unix ts, exclusive; default = now","default":0,"title":"Until"},"description":"unix ts, exclusive; default = now"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/business/pnl-leaderboard":{"get":{"tags":["business"],"summary":"Pnl Leaderboard","description":"Рейтинг гаманців за реалізованим PnL усередині вікна на дату. Сторінки — зі знімка рангів (data_version).","operationId":"pnl_leaderboard_api_v2_business_pnl_leaderboard_get","parameters":[{"name":"as_of","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"YYYY-MM-DD, last Polymarket day of the window; default = latest ranked day","title":"As Of"},"description":"YYYY-MM-DD, last Polymarket day of the window; default = latest ranked day"},{"name":"window","in":"query","required":false,"schema":{"type":"integer","description":"7 | 30 Polymarket days ending on as_of","default":7,"title":"Window"},"description":"7 | 30 Polymarket days ending on as_of"},{"name":"order","in":"query","required":false,"schema":{"type":"string","description":"desc = biggest realized profit first, asc = biggest realized loss first","default":"desc","title":"Order"},"description":"desc = biggest realized profit first, asc = biggest realized loss first"},{"name":"min_resolved","in":"query","required":false,"schema":{"type":"integer","description":"0 | 1 | 5 | 20 — min markets that resolved while the wallet held a position","default":0,"title":"Min Resolved"},"description":"0 | 1 | 5 | 20 — min markets that resolved while the wallet held a position"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/business/pnl-leaderboard/export.csv":{"get":{"tags":["business"],"summary":"Pnl Leaderboard Export","description":"Уся дата одним CSV (усі ранжовані гаманці), рахується наживо з тих самих таблиць, що й ранги. ≤ 1 на акаунт і ≤ 2 загалом.","operationId":"pnl_leaderboard_export_api_v2_business_pnl_leaderboard_export_csv_get","parameters":[{"name":"as_of","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"YYYY-MM-DD; default = latest ranked day","title":"As Of"},"description":"YYYY-MM-DD; default = latest ranked day"},{"name":"window","in":"query","required":false,"schema":{"type":"integer","description":"7 | 30","default":7,"title":"Window"},"description":"7 | 30"},{"name":"order","in":"query","required":false,"schema":{"type":"string","description":"desc | asc","default":"desc","title":"Order"},"description":"desc | asc"},{"name":"min_resolved","in":"query","required":false,"schema":{"type":"integer","description":"0 | 1 | 5 | 20","default":0,"title":"Min Resolved"},"description":"0 | 1 | 5 | 20"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/business/wallet/{address}/pnl-daily":{"get":{"tags":["business"],"summary":"Wallet Pnl Daily","description":"Щоденний реалізований PnL, обсяг, угоди і лічильники гаманця по PM-днях (дні без змін не пишуться = 0) + позначки дір PM;\nз include_open — відкритий PnL на кінець кожного PM-дня і зараз (ряд PM наживо).","operationId":"wallet_pnl_daily_api_v2_business_wallet__address__pnl_daily_get","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string","title":"Address"}},{"name":"since","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"YYYY-MM-DD, ≥ 2026-06-01; default = 2026-06-01","title":"Since"},"description":"YYYY-MM-DD, ≥ 2026-06-01; default = 2026-06-01"},{"name":"until","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"YYYY-MM-DD; default = today; span ≤ 366 days","title":"Until"},"description":"YYYY-MM-DD; default = today; span ≤ 366 days"},{"name":"include_open","in":"query","required":false,"schema":{"type":"boolean","description":"add open (unrealized) PnL at the end of each day and now, live from Polymarket","default":false,"title":"Include Open"},"description":"add open (unrealized) PnL at the end of each day and now, live from Polymarket"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/worldcup/next-match":{"get":{"summary":"Api Wc Next Match","description":"Next FIFA WC match: earliest open fifwc-XXX-YYY-DATE win-market pair.","operationId":"api_wc_next_match_api_v2_worldcup_next_match_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/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 (_site_user: local peer + proxy token).","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"}},{"name":"min_conc","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Min Conc"}},{"name":"min_roi","in":"query","required":false,"schema":{"type":"number","default":0,"title":"Min Roi"}},{"name":"max_active","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Max Active"}},{"name":"hold_bucket","in":"query","required":false,"schema":{"type":"string","default":"","title":"Hold Bucket"}},{"name":"min_avg_size","in":"query","required":false,"schema":{"type":"number","default":0,"title":"Min Avg Size"}},{"name":"max_avg_size","in":"query","required":false,"schema":{"type":"number","default":0,"title":"Max Avg Size"}},{"name":"min_volume","in":"query","required":false,"schema":{"type":"number","default":0,"title":"Min Volume"}},{"name":"skill","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Skill"}},{"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"}}}}}}},"/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":{}}}}}}},"/health/jobs":{"get":{"summary":"Api V1 Health Jobs","description":"Background jobs: cron heartbeat marks + data checks (jobs_health.py).\nAny failed check -> 503 with its name in \"failed\", so the monitor mail\nsays which job broke. Cached 30s. Public, no auth; counts only.","operationId":"api_v1_health_jobs_health_jobs_head","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"head":{"summary":"Api V1 Health Jobs","description":"Background jobs: cron heartbeat marks + data checks (jobs_health.py).\nAny failed check -> 503 with its name in \"failed\", so the monitor mail\nsays which job broke. Cached 30s. Public, no auth; counts only.","operationId":"api_v1_health_jobs_health_jobs_head","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/health/jobs":{"get":{"summary":"Api V1 Health Jobs","description":"Background jobs: cron heartbeat marks + data checks (jobs_health.py).\nAny failed check -> 503 with its name in \"failed\", so the monitor mail\nsays which job broke. Cached 30s. Public, no auth; counts only.","operationId":"api_v1_health_jobs_api_v1_health_jobs_head","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"head":{"summary":"Api V1 Health Jobs","description":"Background jobs: cron heartbeat marks + data checks (jobs_health.py).\nAny failed check -> 503 with its name in \"failed\", so the monitor mail\nsays which job broke. Cached 30s. Public, no auth; counts only.","operationId":"api_v1_health_jobs_api_v1_health_jobs_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"},"ga_client_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ga Client Id"},"ga_session_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ga Session Id"}},"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"},"WebhookFilters":{"properties":{"min_usd":{"type":"number","minimum":10.0,"title":"Min Usd","description":"min trade size, USD","default":1000},"categories":{"items":{"type":"string"},"type":"array","title":"Categories","description":"market categories; empty = all"},"wallets":{"items":{"type":"string"},"type":"array","title":"Wallets","description":"wallet_trade: wallets to watch (max 50)"}},"type":"object","title":"WebhookFilters"},"WebhookIn":{"properties":{"url":{"type":"string","title":"Url"},"events":{"items":{"type":"string"},"type":"array","title":"Events"},"filters":{"$ref":"#/components/schemas/WebhookFilters"}},"type":"object","required":["url","events"],"title":"WebhookIn"},"WhopEntitlementRequest":{"properties":{"whop_user_id":{"type":"string","title":"Whop User Id"}},"type":"object","required":["whop_user_id"],"title":"WhopEntitlementRequest"}}}}