{"name":"Kalshi Sports Market Data API","version":"2.0.0","description":"Real-time sports prediction market data from Kalshi. Gzip-compressed, Redis-cached, low-latency.","openapi_spec":"/api/openapi.json","base_url":"http://localhost:4000","performance":{"compression":"gzip (all responses)","caching":"Redis-backed, 3-5s TTL on read endpoints. X-Cache header indicates HIT/MISS.","timing":"X-Response-Time header on every response. meta.took_ms in JSON body.","tip":"Use /api/prices for minimum latency. Use /api/prices/summary for game-level view. Use WebSocket for zero-poll real-time."},"rest_endpoints":{"GET /health":"Service health check","GET /api/docs":"This documentation","GET /api/sports":"List sports with market/event counts","GET /api/live?sport=NBA":"🔴 Live games only — active events with current lines, mid, spread","GET /api/movers?sport=NBA&period=1h&limit=20&direction=up":"📈 Biggest price movers in period (15m, 1h, 6h, 24h)","GET /api/stats":"📊 Aggregated volume, OI, counts by sport + global totals","GET /api/status":"🔧 System health — poller status, Redis connectivity, data freshness","GET /api/prices?sport=NBA&side=YES":"⚡ Ultra-slim flat price feed — minimal payload, lowest latency","GET /api/prices/summary?sport=NBA":"⚡ One row per game with both team lines","GET /api/search?q=celtics":"🔍 Fuzzy search events, markets, and contracts by name/ticker","GET /api/events?sport=NBA&status=open&sort=-starts_at&starts_after=2024-01-01":"List events with sort + date range filters","GET /api/events/:id":"Single event with all markets (accepts UUID or Kalshi event ticker)","GET /api/markets?sport=NBA&status=open&sort=-updated_at&min_volume=1000":"List markets with sort + volume filter","GET /api/markets/:id":"Single market detail with contracts","GET /api/markets/:id/price-history?period=24h":"Combined YES+NO price history for a market","GET /api/contracts/:id":"Single contract detail","GET /api/contracts/:id/price-history?period=24h":"Price history (periods: 1h, 6h, 24h, 7d, 30d)"},"response_headers":{"X-Response-Time":"Server-side processing time (e.g. '2.3ms')","X-Cache":"HIT = served from Redis cache, MISS = fresh from DB","X-Cache-TTL":"Cache time-to-live for this endpoint","Content-Encoding":"gzip (automatic if client accepts)","ETag":"Content hash for conditional caching (use If-None-Match header)","X-RateLimit-Limit":"Max requests per minute (default: 120)","X-RateLimit-Remaining":"Remaining requests in current window","X-RateLimit-Reset":"Unix timestamp when rate limit resets"},"response_envelope":{"description":"All list endpoints return { data, meta }. Single-resource endpoints return flat object with meta.","meta_fields":{"took_ms":"Server processing time in milliseconds","cached":"true if served from cache","count":"Number of items in data array","total":"Total matching items (for pagination)"}},"websocket":{"url":"ws://localhost:4000/ws/v1","description":"Developer-first WebSocket API. Subscribe to channels for real-time snapshots + streaming quotes.","channels":["sport:<SPORT> — NBA, MLB, NFL, NHL (all markets for a sport)","event:<EVENT_ID> — all markets for a specific game","market:<MARKET_ID> — single market updates","all — everything"],"actions":{"subscribe":{"action":"subscribe","channel":"sport:NBA"},"unsubscribe":{"action":"unsubscribe","channel":"sport:NBA"},"snapshot":{"action":"snapshot","channel":"event:<ID>"},"ping":{"action":"ping"}},"message_types":{"snapshot":"Full snapshot of subscribed channel data (sent on subscribe)","quote":"Real-time price update for a market","info":"Subscription confirmations and channel list","pong":"Response to ping","error":"Error messages"}},"data_model":{"sport":"Top-level grouping (NBA, MLB, NFL, NHL)","event":"A game/matchup (e.g. 'Brooklyn at Toronto'). Has home_team, away_team, starts_at.","market":"A prediction market within an event (e.g. 'Winner?'). Each team gets its own market.","contract":"YES/NO sides of a market. Has bid/ask/last_price in dollars (0-1 range)."},"notes":["Prices are in dollar terms (0.00 to 1.00). A YES price of 0.60 means 60% implied probability.","Each game typically has 2 markets (one per team) with 2 contracts each (YES/NO).","Data refreshes every 15 seconds from Kalshi's public API.","WebSocket quotes stream in real-time as data updates.","/api/prices includes computed mid and spread for each contract."],"meta":{"took_ms":6.6}}