### Authentication Example Source: https://docs.polyrouter.io/api-reference/introduction All endpoints require an API key in the X-API-Key header. You can get your free API key from the PolyRouter website. ```APIDOC ## Authentication All endpoints require an API key in the `X-API-Key` header. ```bash curl "https://api-v2.polyrouter.io/markets" \ -H "X-API-Key: YOUR_API_KEY" ``` **Base URL:** `https://api-v2.polyrouter.io` ``` -------------------------------- ### Fetch All Markets - Complete Example Source: https://docs.polyrouter.io/api-reference/pagination Provides a comprehensive example of fetching all market results by iterating through pages using cursors. ```javascript async function fetchAllMarkets() { const allMarkets = []; let cursor = null; let hasMore = true; while (hasMore) { const url = cursor ? `https://api-v2.polyrouter.io/markets?cursor=${cursor}&limit=25` : `https://api-v2.polyrouter.io/markets?limit=25`; const response = await fetch(url, { headers: { 'X-API-Key': '5fa709a5-0634-44c3-a991-57166d3c376d' } }); const data = await response.json(); allMarkets.push(...data.markets); hasMore = data.pagination.has_more; cursor = data.pagination.next_cursor; } return allMarkets; } ``` ```python import requests def fetch_all_markets(): all_markets = [] cursor = None has_more = True headers = {'X-API-Key': '5fa709a5-0634-44c3-a991-57166d3c376d'} while has_more: url = 'https://api-v2.polyrouter.io/markets' params = {'limit': 25} if cursor: params['cursor'] = cursor response = requests.get(url, headers=headers, params=params) data = response.json() all_markets.extend(data['markets']) has_more = data['pagination']['has_more'] cursor = data['pagination'].get('next_cursor') return all_markets ``` ```bash # First page curl "https://api-v2.polyrouter.io/markets?limit=25" \ -H "X-API-Key: 5fa709a5-0634-44c3-a991-57166d3c376d" # Next page (use next_cursor from response) curl "https://api-v2.polyrouter.io/markets?limit=25&cursor=eyJ..." \ -H "X-API-Key: 5fa709a5-0634-44c3-a991-57166d3c376d" ``` -------------------------------- ### Get Market Orderbook Source: https://docs.polyrouter.io/api-reference/markets/get-market-orderbook Fetches the real-time orderbook for a specified market. ```APIDOC ## GET /markets/{market_id}/orderbook ### Description Fetch real-time orderbook (bids and asks) for a market. Supports Polymarket, Kalshi, Limitless, and Manifold. ### Method GET ### Endpoint `/markets/{market_id}/orderbook` ### Parameters #### Path Parameters - **market_id** (string) - Required - The unique identifier for the market. ### Request Example (No request body for this GET request) ### Response #### Success Response (200) - **bids** (array) - An array of bid orders, each with price and quantity. - **asks** (array) - An array of ask orders, each with price and quantity. #### Response Example ```json { "bids": [ { "price": 0.75, "quantity": 10 }, { "price": 0.74, "quantity": 5 } ], "asks": [ { "price": 0.76, "quantity": 8 }, { "price": 0.77, "quantity": 12 } ] } ``` ``` -------------------------------- ### GET /profile/meta Source: https://docs.polyrouter.io/api-reference/profile/get-user-profile Retrieves metadata regarding the request performance and platform information. ```APIDOC ## GET /profile/meta ### Description Retrieves metadata about the request processing time and platform status. ### Method GET ### Endpoint /profile/meta ### Parameters #### Headers - **X-API-Key** (string) - Required - API key for authentication ### Response #### Success Response (200) - **request_time** (number) - Time taken to process the request in ms - **platform** (object) - Platform specific details - **data_freshness** (string) - ISO 8601 timestamp of data last update #### Response Example { "request_time": 150, "platform": {}, "data_freshness": "2024-11-01T12:30:00Z" } ``` -------------------------------- ### GET /profile/info Source: https://docs.polyrouter.io/api-reference/profile/get-user-profile Fetch user profile information and optionally trading metrics from Kalshi or Polymarket. ```APIDOC ## GET /profile/info ### Description Fetch user profile information and optionally trading metrics from Kalshi or Polymarket. ### Method GET ### Endpoint /profile/info ### Parameters #### Query Parameters - **platform** (string) - Required - Platform to query (kalshi or polymarket) - **user** (string) - Required - User identifier (nickname for Kalshi, wallet address for Polymarket) - **include_metrics** (string) - Optional - Include trading metrics in response (true/false) ### Request Example GET https://api-v2.polyrouter.io/profile/info?platform=polymarket&user=trader123&include_metrics=true ### Response #### Success Response (200) - **data** (object) - User profile and metrics object - **meta** (object) - Response metadata #### Response Example { "data": { "profile": { "platform": "polymarket", "user_id": "trader123", "display_name": "Top Trader", "metadata": {} } }, "meta": {} } ``` -------------------------------- ### GET /markets Source: https://docs.polyrouter.io/index Retrieve a list of markets from a specific prediction platform. ```APIDOC ## GET /markets ### Description Fetch a list of active markets from a supported platform with optional limit filtering. ### Method GET ### Endpoint https://api-v2.polyrouter.io/markets ### Parameters #### Query Parameters - **platform** (string) - Required - The name of the platform (e.g., polymarket, kalshi) - **limit** (integer) - Optional - Number of results to return ### Request Example curl "https://api-v2.polyrouter.io/markets?platform=polymarket&limit=5" -H "X-API-Key: YOUR_API_KEY" ### Response #### Success Response (200) - **markets** (array) - List of market objects #### Response Example { "markets": [ { "id": "516710", "platform": "polymarket", "title": "US recession in 2025?", "current_prices": { "yes": { "price": 0.065 }, "no": { "price": 0.935 } }, "volume_24h": 14627.93, "status": "open" } ] } ``` -------------------------------- ### GET /markets - Basic Pagination Source: https://docs.polyrouter.io/api-reference/pagination Demonstrates how to fetch the first page of markets with a specified limit and how the response includes pagination details. ```APIDOC ## GET /markets ### Description Fetches a list of markets with support for cursor-based pagination. ### Method GET ### Endpoint /markets ### Query Parameters - **limit** (integer) - Optional - Number of results per page (1-25, default varies by endpoint). - **cursor** (string) - Optional - Opaque token for fetching the next page. ### Request Example ```bash curl "https://api-v2.polyrouter.io/markets?limit=10" \ -H "X-API-Key: YOUR_API_KEY" ``` ### Response #### Success Response (200) - **markets** (array) - List of market objects. - **pagination** (object) - Contains pagination details: - **total** (integer) - Total number of available results. - **limit** (integer) - The limit used for this request. - **has_more** (boolean) - Indicates if there are more pages. - **next_cursor** (string) - Opaque token for fetching the next page. Null if no more pages. #### Response Example ```json { "markets": [...], "pagination": { "total": 150, "limit": 10, "has_more": true, "next_cursor": "eyJwbGF0Zm9ybXMiOnsia2Fsc2hpIjp7..." } } ``` ``` -------------------------------- ### JavaScript - Complete Pagination Example Source: https://docs.polyrouter.io/api-reference/pagination An asynchronous JavaScript function demonstrating a loop to fetch all market data using cursor-based pagination. ```APIDOC ## JavaScript - Complete Pagination Example ### Description This JavaScript code snippet illustrates a complete pagination strategy using a `while` loop to fetch all available market data, handling `has_more` and `next_cursor`. ### Method GET ### Endpoint /markets ### Query Parameters - **limit** (integer) - Optional - Number of results per page (default is 25 in this example). - **cursor** (string) - Optional - Opaque token for fetching the next page. ### Request Example ```javascript async function fetchAllMarkets() { const allMarkets = []; let cursor = null; let hasMore = true; while (hasMore) { const url = cursor ? `https://api-v2.polyrouter.io/markets?cursor=${cursor}&limit=25` : `https://api-v2.polyrouter.io/markets?limit=25`; const response = await fetch(url, { headers: { 'X-API-Key': 'YOUR_API_KEY' } }); const data = await response.json(); allMarkets.push(...data.markets); hasMore = data.pagination.has_more; cursor = data.pagination.next_cursor; } return allMarkets; } ``` ``` -------------------------------- ### Get NFL Game Odds with PolyRouter API Source: https://docs.polyrouter.io/index This code snippet shows how to retrieve NFL game data and odds using the PolyRouter API. It includes examples for listing available games and fetching odds for a specific game using a standardized game ID format. An API key is required for these requests. ```bash # Find today's games curl "https://api-v2.polyrouter.io/list-games?league=nfl&limit=5" \ -H "X-API-Key: 5fa709a5-0634-44c3-a991-57166d3c376d" # Get odds for a specific game curl "https://api-v2.polyrouter.io/games/BUFvKC20251020@NFL" \ -H "X-API-Key: 5fa709a5-0634-44c3-a991-57166d3c376d" ``` -------------------------------- ### cURL - Complete Pagination Example Source: https://docs.polyrouter.io/api-reference/pagination Provides cURL commands for fetching the first page of markets and subsequent pages using the cursor. ```APIDOC ## cURL - Complete Pagination Example ### Description This section provides cURL commands to demonstrate fetching the initial set of market data and how to request subsequent pages using the `cursor` parameter. ### Method GET ### Endpoint /markets ### Query Parameters - **limit** (integer) - Optional - Number of results per page (default is 25 in this example). - **cursor** (string) - Optional - Opaque token for fetching the next page. ### Request Example ```bash # First page curl "https://api-v2.polyrouter.io/markets?limit=25" \ -H "X-API-Key: YOUR_API_KEY" # Next page (use next_cursor from response) curl "https://api-v2.polyrouter.io/markets?limit=25&cursor=eyJ..." \ -H "X-API-Key: YOUR_API_KEY" ``` ``` -------------------------------- ### GET /markets Source: https://docs.polyrouter.io/api-reference/changelog Retrieve real-time market data across supported platforms with pagination support. ```APIDOC ## GET /markets ### Description Fetch real-time market information across integrated platforms. Supports filtering and pagination. ### Method GET ### Endpoint /markets ### Parameters #### Query Parameters - **limit** (integer) - Optional - Number of results to return (max 250) - **platform** (string) - Optional - Filter by specific platform (e.g., kalshi, polymarket) ### Request Example GET /markets?limit=50 ### Response #### Success Response (200) - **data** (array) - List of market objects - **next_cursor** (string) - Cursor for pagination #### Response Example { "data": [{"id": "123", "name": "Will it rain?", "price": 0.5}], "next_cursor": "abc-123" } ``` -------------------------------- ### Python - Complete Pagination Example Source: https://docs.polyrouter.io/api-reference/pagination A Python function demonstrating how to iterate through all pages of market data using the `requests` library and cursor-based pagination. ```APIDOC ## Python - Complete Pagination Example ### Description This Python code snippet shows a practical implementation for fetching all market data by repeatedly requesting pages until `has_more` is false, utilizing the `cursor` for subsequent requests. ### Method GET ### Endpoint /markets ### Query Parameters - **limit** (integer) - Optional - Number of results per page (default is 25 in this example). - **cursor** (string) - Optional - Opaque token for fetching the next page. ### Request Example ```python import requests def fetch_all_markets(): all_markets = [] cursor = None has_more = True headers = {'X-API-Key': 'YOUR_API_KEY'} while has_more: url = 'https://api-v2.polyrouter.io/markets' params = {'limit': 25} if cursor: params['cursor'] = cursor response = requests.get(url, headers=headers, params=params) data = response.json() all_markets.extend(data['markets']) has_more = data['pagination']['has_more'] cursor = data['pagination'].get('next_cursor') return all_markets ``` ``` -------------------------------- ### GET /markets - Fetching Next Page Source: https://docs.polyrouter.io/api-reference/pagination Shows how to use the `next_cursor` from a previous response to retrieve the subsequent page of results. ```APIDOC ## GET /markets - Fetching Next Page ### Description Retrieves the next page of market results by providing the `next_cursor` obtained from a previous request. ### Method GET ### Endpoint /markets ### Query Parameters - **limit** (integer) - Optional - Number of results per page (1-25, default varies by endpoint). - **cursor** (string) - Required - Opaque token for fetching the next page, obtained from the `next_cursor` field of the previous response. ### Request Example ```bash curl "https://api-v2.polyrouter.io/markets?limit=10&cursor=eyJwbGF0Zm9ybXMiOnsia2Fsc2hpIjp7..." \ -H "X-API-Key: YOUR_API_KEY" ``` ### Response #### Success Response (200) - **markets** (array) - List of market objects for the next page. - **pagination** (object) - Contains pagination details for the next page. #### Response Example ```json { "markets": [...], "pagination": { "total": 150, "limit": 10, "has_more": true, "next_cursor": "eyJwbGF0Zm9ybXMiOnsia2Fsc2hpIjp7..." } } ``` ``` -------------------------------- ### GET /games/{id} Source: https://docs.polyrouter.io/api-reference/sports/get-game-by-id Fetch a single game by its unique ID, including aggregated market data from supported platforms. ```APIDOC ## GET /games/{id} ### Description Fetch a single game by its ID with market data from all platforms. ### Method GET ### Endpoint https://api-v2.polyrouter.io/games/{id} ### Parameters #### Path Parameters - **id** (string) - Required - Game ID (format: {Away}v{Home}{YYYYMMDD}@{LEAGUE}) #### Query Parameters - **platform** (string) - Optional - Filter by platform (polymarket, kalshi, prophetx, novig, sxbet) - **market_type** (string) - Optional - Filter by market type (moneyline, spread, total, prop) - **odds_format** (string) - Optional - Odds format for market odds (american, decimal, probability) ### Request Example GET /games/KCvSF20250209@NFL?platform=polymarket&odds_format=american ### Response #### Success Response (200) - **data** (object) - The sports event details - **meta** (object) - Metadata regarding the request #### Response Example { "data": { "id": "KCvSF20250209@NFL", "title": "Chiefs vs 49ers", "sport": "Football", "status": "not_started" }, "meta": {} } ``` -------------------------------- ### Markets API - Platforms Source: https://docs.polyrouter.io/api-reference/introduction Get information about supported prediction market platforms. ```APIDOC ## GET /api-reference/platforms/list-platforms ### Description Retrieves information about supported prediction market platforms. ### Method GET ### Endpoint `/api-reference/platforms/list-platforms` ``` -------------------------------- ### GET /markets Source: https://docs.polyrouter.io/api-reference/markets/list-markets Fetch a list of prediction markets from integrated platforms with support for filtering and pagination. ```APIDOC ## GET /markets ### Description Fetch markets from prediction market platforms with pagination. Supports filtering by platform, status, and keyword search. ### Method GET ### Endpoint https://api-v2.polyrouter.io/markets ### Parameters #### Query Parameters - **limit** (string) - Optional - Number of items to return (max 100) - **cursor** (string) - Optional - Pagination cursor from previous response - **platform** (string) - Optional - Filter by specific platform (polymarket, kalshi, limitless, manifold, context) - **status** (string) - Optional - Filter by market status (open, closed, resolved, paused, unopened) - **query** (string) - Optional - Search query - when provided, switches to search mode - **include_raw** (string) - Optional - Include raw platform response data in metadata._raw ### Request Example GET /markets?limit=50&platform=kalshi ### Response #### Success Response (200) - **pagination** (object) - Pagination metadata including total, limit, has_more, and next_cursor - **markets** (array) - List of market objects - **meta** (object) - Additional metadata #### Response Example { "pagination": { "total": 50, "limit": 50, "has_more": true, "next_cursor": "WzMsW1swLDEsM11dXQ" }, "markets": [ { "id": "KXELONMARS-99", "platform": "kalshi", "platform_id": "KXELONMARS-99", "event_id": "KXELONMARS-99", "event_name": "Will Elon Musk visit Mars?" } ], "meta": {} } ``` -------------------------------- ### GET /profile/metrics Source: https://docs.polyrouter.io/api-reference/profile/get-user-profile Retrieves trading performance metrics including volume, PnL, ROI, and market activity. ```APIDOC ## GET /profile/metrics ### Description Retrieves the current trading performance metrics for the authenticated user. ### Method GET ### Endpoint /profile/metrics ### Parameters #### Headers - **X-API-Key** (string) - Required - API key for authentication ### Response #### Success Response (200) - **volume** (number) - Total trading volume - **pnl** (number) - Profit and loss - **roi** (number) - Return on investment - **num_markets_traded** (number) - Count of unique markets traded - **portfolio_value** (number) - Current total portfolio value - **open_interest** (number) - Current open interest - **metadata** (object) - Additional contextual data #### Response Example { "volume": 50000, "pnl": 2500, "roi": 0.15, "num_markets_traded": 42, "portfolio_value": 10000, "open_interest": 3500, "metadata": {} } ``` -------------------------------- ### GET /websites/polyrouter_io Source: https://docs.polyrouter.io/api-reference/markets/list-markets Retrieves detailed information about a specific market, including its title, description, status, pricing, and trading data. ```APIDOC ## GET /websites/polyrouter_io ### Description Retrieves detailed information about a specific market, including its title, description, status, pricing, and trading data. ### Method GET ### Endpoint /websites/polyrouter_io ### Parameters #### Query Parameters - **example** (string) - Optional - Example identifier for the market. ### Response #### Success Response (200) - **series_id** (string) - The unique identifier for the series. - **slug** (string) - The slug of the market. - **market_slug** (string) - The market slug. - **title** (string) - The title of the market. - **description** (string) - The description of the market. - **category** (string) - The category of the market. - **subcategory** (string) - The subcategory of the market. - **tags** (array[string]) - Tags associated with the market. - **status** (string) - The current status of the market (open, paused, resolved, cancelled). - **market_type** (string) - The type of market (binary, categorical, scalar). - **outcomes** (array[object]) - An array of possible outcomes for the market. - **id** (string) - The ID of the outcome. - **name** (string) - The name of the outcome. - **current_prices** (object) - Current pricing details for the market. - **price** (number) - The current price. - **bid** (number) - The current bid price. - **ask** (number) - The current ask price. - **volume_24h** (number) - Trading volume in the last 24 hours. - **volume_7d** (number) - Trading volume in the last 7 days. - **volume_total** (number) - Total trading volume. - **liquidity** (number) - The liquidity of the market. - **liquidity_score** (number) - The liquidity score. - **open_interest** (number) - The open interest in the market. - **unique_traders** (number) - The number of unique traders. - **fee_rate** (number) - The fee rate. - **trading_fee** (number) - The trading fee. - **withdrawal_fee** (number) - The withdrawal fee. - **source_url** (string) - The URL of the market source. - **image_url** (string) - The URL of the market image. - **created_at** (string) - The timestamp when the market was created. - **trading_start_at** (string) - The timestamp when trading started. - **trading_end_at** (string) - The timestamp when trading ends. - **resolution_date** (string) - The date of resolution. - **resolved_at** (string) - The timestamp when the market was resolved. - **resolution_criteria** (string) - The criteria for market resolution. - **resolution_source** (string) - The source for market resolution. - **price_24h_changes** (object) - Price changes in the last 24 hours. - **price_7d_changes** (object) - Price changes in the last 7 days. - **last_trades** (object) - Information about the last trades. - **price** (number) - The price of the last trade. - **timestamp** (string) - The timestamp of the last trade. - **size** (number) - The size of the last trade. - **metadata** (object) - Additional metadata about the market. - **last_synced_at** (string) - The timestamp when the data was last synced. #### Response Example ```json { "example": "elon-musk-mars", "series_id": "some-series-id", "slug": "kxelonmars-99", "market_slug": "kxelonmars-99", "title": "Will Elon Musk visit Mars before Aug 1, 2099?", "description": "A market to bet on whether Elon Musk will visit Mars before August 1, 2099.", "category": "Science", "subcategory": null, "tags": ["Elon Musk", "Mars", "Space Exploration"], "status": "open", "market_type": "binary", "outcomes": [ { "id": "yes", "name": "Yes" }, { "id": "no", "name": "No" } ], "current_prices": { "yes": { "price": 0.65, "bid": 0.64, "ask": 0.66 } }, "volume_24h": 10000, "volume_7d": 50000, "volume_total": 500000, "liquidity": 100000, "liquidity_score": 0.8, "open_interest": 75000, "unique_traders": 1500, "fee_rate": 0.01, "trading_fee": 0.001, "withdrawal_fee": 0.0005, "source_url": "https://kalshi.com/markets/kxelonmars-99", "image_url": "https://example.com/images/elon-musk-mars.jpg", "created_at": "2024-01-01T10:00:00.000Z", "trading_start_at": "2024-01-01T10:00:00.000Z", "trading_end_at": "2099-08-01T00:00:00.000Z", "resolution_date": "2099-08-01", "resolved_at": null, "resolution_criteria": "Elon Musk lands on Mars.", "resolution_source": "https://www.spacex.com/", "price_24h_changes": { "yes": 0.05 }, "price_7d_changes": { "yes": -0.02 }, "last_trades": { "yes": { "price": 0.65, "timestamp": "2024-01-01T11:00:00.000Z", "size": 100 } }, "metadata": { "conditionId": "cond-123", "ammType": "CFMM", "marketType": "Binary", "formatType": "Standard", "competitive": 0.9 }, "last_synced_at": "2024-01-01T12:00:00.000Z" } ``` ``` -------------------------------- ### GET /events Source: https://docs.polyrouter.io/api-reference/series/list-series Retrieve a list of prediction market events aggregated from multiple platforms. ```APIDOC ## GET /events ### Description Retrieves a list of events across supported platforms including metadata about the query performance and data freshness. ### Method GET ### Endpoint /events ### Parameters #### Query Parameters - **platform** (string) - Optional - Filter events by specific platform (e.g., polymarket, kalshi) ### Response #### Success Response (200) - **events** (array) - List of Event objects - **meta** (object) - Metadata regarding the request execution #### Response Example { "events": [ { "id": "4690", "platform": "polymarket", "title": "US Presidential Election 2024", "last_synced_at": "2025-01-01T00:00:00.000Z" } ], "meta": { "platforms_queried": ["polymarket", "kalshi"], "request_time": 150, "cache_hit": false, "data_freshness": "2025-01-01T00:00:00.000Z" } } ``` -------------------------------- ### GET /user/profile Source: https://docs.polyrouter.io/api-reference/profile/get-user-profile Retrieves the profile information for the authenticated user, including optional trading metrics. ```APIDOC ## GET /user/profile ### Description Fetches the user profile details. Optionally includes trading metrics from connected platforms such as Kalshi or Polymarket. ### Method GET ### Endpoint /user/profile ### Parameters #### Query Parameters - **include_metrics** (boolean) - Optional - If true, returns trading metrics from connected platforms. ### Request Example GET /user/profile?include_metrics=true ### Response #### Success Response (200) - **id** (string) - Unique user identifier - **username** (string) - User display name - **metrics** (object) - Optional trading data object #### Response Example { "id": "user_123", "username": "trader_pro", "metrics": { "platform": "polymarket", "volume": 5000.00 } } ``` -------------------------------- ### GET /games/{game_id} Source: https://docs.polyrouter.io/api-reference/changelog Retrieve specific game details, markets, and odds for major sports leagues. ```APIDOC ## GET /games/{game_id} ### Description Get detailed market information and odds for a specific game identified by its unique ID. ### Method GET ### Endpoint /games/{game_id} ### Parameters #### Path Parameters - **game_id** (string) - Required - The unique game identifier (e.g., PHIvWAS20251028@NBA) ### Request Example GET /games/PHIvWAS20251028@NBA ### Response #### Success Response (200) - **game_id** (string) - The requested ID - **odds** (object) - Current betting odds #### Response Example { "game_id": "PHIvWAS20251028@NBA", "odds": {"moneyline": 1.9} } ``` -------------------------------- ### GET /markets/{id} Source: https://docs.polyrouter.io/api-reference/markets/get-market-by-id Retrieves detailed information about a specific market using its unique identifier. ```APIDOC ## GET /markets/{id} ### Description Fetch a single market by its ID to retrieve specific details such as name, status, and associated metadata. ### Method GET ### Endpoint /markets/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the market. ### Request Example GET /markets/12345 ### Response #### Success Response (200) - **id** (string) - The market ID - **name** (string) - The name of the market - **status** (string) - The current operational status #### Response Example { "id": "12345", "name": "Example Market", "status": "active" } ``` -------------------------------- ### GET /market-data Source: https://docs.polyrouter.io/api-reference/events/get-event-by-id Retrieves the current market data including best bid, best ask, and spread for tokens. ```APIDOC ## GET /market-data ### Description Retrieves the latest market data for tokens, including best bid, best ask, and calculated spread. ### Method GET ### Endpoint /market-data ### Parameters #### Query Parameters - **formatType** (string) - Optional - The format type for the response. ### Request Example GET /market-data?formatType=json ### Response #### Success Response (200) - **bestBid** (number) - The highest current bid price. - **bestAsk** (number) - The lowest current ask price. - **spread** (number) - The difference between the best ask and best bid. - **score** (number) - The current market score. - **competitive** (number) - Competitive status indicator. - **clobTokenIds** (array) - List of token identifiers. #### Response Example { "bestBid": 0.64, "bestAsk": 0.66, "spread": 0.02, "score": 0, "competitive": 0, "clobTokenIds": ["token1", "token2"] } ``` -------------------------------- ### GET /series Source: https://docs.polyrouter.io/api-reference/series/list-series Fetches a list of series from supported prediction market platforms with support for pagination, filtering, and search. ```APIDOC ## GET /series ### Description Fetch series from prediction market platforms with pagination. Only Polymarket and Kalshi support series. ### Method GET ### Endpoint https://api-v2.polyrouter.io/series ### Parameters #### Query Parameters - **limit** (string) - Optional - Number of items to return (max 100) - **cursor** (string) - Optional - Pagination cursor from previous response - **platform** (string) - Optional - Filter by specific platform (polymarket or kalshi) - **query** (string) - Optional - Search query - when provided, switches to search mode - **include_raw** (string) - Optional - Include raw platform response data ('true' or 'false') - **include_nested** (string) - Optional - Include nested events in series ('true' or 'false') ### Request Example GET /series?limit=10&platform=polymarket ### Response #### Success Response (200) - **pagination** (object) - Pagination metadata - **series** (array) - List of series objects - **meta** (object) - Response metadata #### Response Example { "pagination": { "total": 50, "limit": 50, "has_more": true, "next_cursor": "WzMsW1swLDEsM11dXQ" }, "series": [ { "id": "1", "platform": "polymarket", "title": "NFL 2024 Season" } ], "meta": {} } ``` -------------------------------- ### GET /league-info Source: https://docs.polyrouter.io/api-reference/sports/get-league-information Fetches detailed information about supported sports leagues, including available endpoints and team counts. ```APIDOC ## GET /league-info ### Description Fetch information about supported sports leagues, including available endpoints and team counts. You can query a specific league or retrieve a list of all supported leagues. ### Method GET ### Endpoint https://api-v2.polyrouter.io/league-info ### Parameters #### Query Parameters - **league** (string) - Optional - Specific league to query (e.g., nfl, nba, nhl, mlb). - **include_teams** (string) - Optional - Include team information in response (set to 'true'). ### Request Example GET /league-info?league=nfl&include_teams=true ### Response #### Success Response (200) - **data** (object) - League information object if a specific league is requested. - **leagues** (array) - List of league objects if no specific league is requested. - **meta** (object) - Metadata including request_time. #### Response Example { "data": { "id": "nfl", "name": "National Football League", "abbreviation": "NFL", "sport": "Football", "season": { "year": 2024, "start_date": "2024-09-05", "end_date": "2025-02-09" } }, "meta": { "request_time": 50 } } ``` -------------------------------- ### Fetch Markets - Basic Request Source: https://docs.polyrouter.io/api-reference/pagination Demonstrates how to make the initial request to fetch markets with a specified limit. ```bash curl "https://api-v2.polyrouter.io/markets?limit=10" \ -H "X-API-Key: 5fa709a5-0634-44c3-a991-57166d3c376d" ``` -------------------------------- ### Sports API - Awards Source: https://docs.polyrouter.io/api-reference/introduction Get odds for awards such as MVP or championships. ```APIDOC ## GET /api-reference/sports/list-awards ### Description Retrieves odds for various sports awards like MVP or championships. ### Method GET ### Endpoint `/api-reference/sports/list-awards` ### Parameters #### Query Parameters - **league** (string) - Optional - Filter awards by league. ``` -------------------------------- ### GET /games/{game_id} Source: https://docs.polyrouter.io/index Retrieve detailed odds for a specific sports game. ```APIDOC ## GET /games/{game_id} ### Description Get specific odds and details for a game using its unique identifier. ### Method GET ### Endpoint https://api-v2.polyrouter.io/games/{game_id} ### Parameters #### Path Parameters - **game_id** (string) - Required - The unique game ID (format: {AwayTeam}v{HomeTeam}{YYYYMMDD}@{LEAGUE}) ### Request Example curl "https://api-v2.polyrouter.io/games/BUFvKC20251020@NFL" -H "X-API-Key: YOUR_API_KEY" ### Response #### Success Response (200) - **game** (object) - Game details and current odds #### Response Example { "game_id": "BUFvKC20251020@NFL", "status": "upcoming", "odds": { ... } } ``` -------------------------------- ### Fetch Markets - Next Page Request Source: https://docs.polyrouter.io/api-reference/pagination Shows how to retrieve the next page of market results by using the `next_cursor` from the previous response. ```bash curl "https://api-v2.polyrouter.io/markets?limit=10&cursor=eyJwbGF0Zm9ybXMiOnsia2Fsc2hpIjp7..." \ -H "X-API-Key: 5fa709a5-0634-44c3-a991-57166d3c376d" ``` -------------------------------- ### Fetch Markets with PolyRouter API Source: https://docs.polyrouter.io/index This snippet demonstrates how to fetch market data from the PolyRouter API. It shows how to specify the platform and limit the number of results. The output includes market details such as title, current prices, and volume. Requires an API key for authentication. ```bash curl "https://api-v2.polyrouter.io/markets?platform=polymarket&limit=5" \ -H "X-API-Key: 5fa709a5-0634-44c3-a991-57166d3c376d" ``` ```javascript const response = await fetch( 'https://api-v2.polyrouter.io/markets?platform=polymarket&limit=5', { headers: { 'X-API-Key': '5fa709a5-0634-44c3-a991-57166d3c376d' } } ); const data = await response.json(); data.markets.forEach(market => { console.log(`${market.title}: ${(market.current_prices.yes.price * 100).toFixed(1)}%`); }); ``` -------------------------------- ### Markets API - Trades Source: https://docs.polyrouter.io/api-reference/introduction Get historical trade data for a specific market. ```APIDOC ## GET /api-reference/trades/get-trades-for-a-market ### Description Retrieves historical trade data for a specific market. ### Method GET ### Endpoint `/api-reference/trades/get-trades-for-a-market` ### Parameters #### Query Parameters - **market_id** (string) - Required - The ID of the market. - **limit** (integer) - Optional - Number of results to return. - **offset** (integer) - Optional - Offset for pagination. ``` -------------------------------- ### Authenticate API Request with cURL Source: https://docs.polyrouter.io/api-reference/introduction Demonstrates how to authenticate an API request to fetch market data using cURL. It requires an API key provided in the 'X-API-Key' header. The example fetches data from the '/markets' endpoint. ```bash curl "https://api-v2.polyrouter.io/markets" \ -H "X-API-Key: 5fa709a5-0634-44c3-a991-57166d3c376d" ``` -------------------------------- ### Get Award by ID Source: https://docs.polyrouter.io/api-reference/sports/get-award-by-id Fetch a single award with live market data from all platforms. ```APIDOC ## Get Award by ID ### Description Fetch a single award with live market data from all platforms. ### Method GET ### Endpoint `/awards/{id}` ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the award. ``` -------------------------------- ### Documentation Index Source: https://docs.polyrouter.io/api-reference/sports/get-award-by-id Fetch the complete documentation index to discover all available pages. ```APIDOC ## Documentation Index ### Description Fetch the complete documentation index to discover all available pages before exploring further. ### Endpoint `https://docs.polyrouter.io/llms.txt` ### Method GET ``` -------------------------------- ### GET /markets/history Source: https://docs.polyrouter.io/api-reference/markets/get-price-history-for-markets Retrieves historical price data for specified markets in OHLC format. ```APIDOC ## GET /markets/history ### Description Fetch historical price data (OHLC candlesticks) for one or more markets to analyze price trends over time. ### Method GET ### Endpoint /markets/history ### Parameters #### Query Parameters - **market_ids** (string) - Required - Comma-separated list of market identifiers. - **interval** (string) - Required - Timeframe for candlesticks (e.g., 1m, 5m, 1h, 1d). - **start_time** (integer) - Optional - Unix timestamp for the start of the range. - **end_time** (integer) - Optional - Unix timestamp for the end of the range. ### Request Example GET /markets/history?market_ids=BTC-USD,ETH-USD&interval=1h ### Response #### Success Response (200) - **data** (array) - List of OHLC objects containing timestamp, open, high, low, and close values. #### Response Example { "data": [ { "timestamp": 1672531200, "open": 16500.0, "high": 16600.0, "low": 16450.0, "close": 16550.0 } ] } ``` -------------------------------- ### GET /profile/trades Source: https://docs.polyrouter.io/api-reference/changelog Retrieve historical trade data for user profiles with cursor-based pagination. ```APIDOC ## GET /profile/trades ### Description Retrieve the trade history for a user account across supported platforms. ### Method GET ### Endpoint /profile/trades ### Parameters #### Query Parameters - **cursor** (string) - Optional - Pagination cursor - **limit** (integer) - Optional - Number of records to return ### Request Example GET /profile/trades?limit=20 ### Response #### Success Response (200) - **trades** (array) - List of trade objects - **total** (integer) - Total trade count #### Response Example { "trades": [{"id": "t1", "market_id": "m1", "amount": 100}], "total": 1 } ``` -------------------------------- ### API Authentication Source: https://docs.polyrouter.io/api-reference/markets/get-market-orderbook Details on how to authenticate requests using the X-API-Key header. ```APIDOC ## Authentication ### Description All requests to the PolyRouter API require authentication via an API key passed in the request header. ### Method N/A (Global Security) ### Endpoint N/A ### Parameters #### Header Parameters - **X-API-Key** (string) - Required - The unique API key provided for your account. ### Request Example GET /api/resource Headers: X-API-Key: your_api_key_here ### Response #### Success Response (200) - **status** (string) - Success confirmation #### Error Response (401) - **error** (string) - Unauthorized access due to missing or invalid API key ``` -------------------------------- ### GET /trades Source: https://docs.polyrouter.io/api-reference/trades/get-trades-for-a-market Fetch historical trades for a specific market with optional pagination and filtering parameters. ```APIDOC ## GET /trades ### Description Fetch historical trades for a specific market with pagination support. This endpoint allows you to retrieve detailed trade information including price, size, and side. ### Method GET ### Endpoint https://api-v2.polyrouter.io/trades ### Parameters #### Query Parameters - **market_id** (string) - Required - Market ID to fetch trades for. - **limit** (string) - Optional - Number of trades to return (max 1000). - **cursor** (string) - Optional - Pagination cursor from previous response. - **takerOnly** (string) - Optional - Filter to taker-only trades (Polymarket only). ### Request Example GET /trades?market_id=524153&limit=100 ### Response #### Success Response (200) - **trades** (array) - List of trade objects. - **pagination** (object) - Pagination metadata. - **meta** (object) - Request metadata including request_time, market_id, platform, and data_freshness. #### Response Example { "trades": [ { "trade_id": "0x123abc...", "market_id": "524153", "platform": "polymarket", "side": "buy", "price": 0.65, "size": 100, "timestamp": 1704067200 } ], "pagination": {}, "meta": { "request_time": 150, "market_id": "524153", "platform": "polymarket", "data_freshness": "2025-01-01T00:00:00.000Z" } } ``` -------------------------------- ### Authentication Source: https://docs.polyrouter.io/api-reference/sports/get-game-by-id Details on how to authenticate API requests using an API key. ```APIDOC ## Authentication API requests must be authenticated using an API key provided in the request header. ### Security Scheme - **Type**: API Key - **Location**: Header - **Name**: X-API-Key **Example Header:** `X-API-Key: YOUR_API_KEY_HERE` ```