### Authentication Example Source: https://docs.polyrouter.io/api-reference/introduction All endpoints require an API key in the X-API-Key header. This example shows how to authenticate when fetching markets. ```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: 5fa709a5-0634-44c3-a991-57166d3c376d" ``` **Base URL:** `https://api-v2.polyrouter.io` ``` -------------------------------- ### Data Model Example Source: https://docs.polyrouter.io/api-reference/markets/get-market-orderbook An example of a data model used in requests or responses. ```APIDOC ## Data Model Example ### Description This section illustrates a sample data model, including required fields and their types. ### Parameters #### Request Body - **price** (number) - Required - The price of the item. - **size** (number) - Required - The size of the item. ### Request Example ```json { "price": 500, "size": 1000 } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier for the created resource. - **price** (number) - The price of the item. - **size** (number) - The size of the item. #### Response Example ```json { "id": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "price": 500, "size": 1000 } ``` ``` -------------------------------- ### GET /platforms Source: https://docs.polyrouter.io/api-reference/changelog Retrieve information about supported platforms and their operational status. ```APIDOC ## GET /platforms ### Description Provides information about the prediction market platforms integrated with the API, including their current operational status. ### Method GET ### Endpoint `/platforms` ### Response #### Success Response (200) - **platforms** (array) - An array of platform objects. - **name** (string) - The name of the platform (e.g., 'Polymarket', 'Kalshi'). - **status** (string) - The operational status ('online', 'offline', 'maintenance'). - **url** (string) - The base URL for the platform. #### Response Example ```json { "platforms": [ { "name": "Polymarket", "status": "online", "url": "https://polymarket.com" }, { "name": "Kalshi", "status": "online", "url": "https://kalshi.com" } ] } ``` ``` -------------------------------- ### GET /list-futures Source: https://docs.polyrouter.io/api-reference/changelog List available futures markets. ```APIDOC ## GET /list-futures ### Description Lists all available futures markets. ### Method GET ### Endpoint `/list-futures` ### Response #### Success Response (200) - **futures** (array) - An array of future market objects. - **future_id** (string) - The unique identifier for the future market. - **title** (string) - The title of the future market. - **maturity_date** (string) - The maturity date of the future. #### Response Example ```json { "futures": [ { "future_id": "future_oil_dec2025", "title": "Crude Oil Futures - December 2025", "maturity_date": "2025-12-31" } ] } ``` ``` -------------------------------- ### GET /api/platforms/list-platforms Source: https://docs.polyrouter.io/api-reference/introduction Lists available prediction market platforms. ```APIDOC ## GET /api/platforms/list-platforms ### Description Retrieves a list of all supported prediction market platforms integrated with PolyRouter. ### Method GET ### Endpoint /api/platforms/list-platforms ### Parameters None ### Request Example ```json {} ``` ### Response #### Success Response (200) - **platforms** (array) - An array of platform objects. - **platform_id** (string) - The unique identifier for the platform. - **name** (string) - The name of the platform. - **url** (string) - The URL of the platform. #### Response Example ```json { "platforms": [ { "platform_id": "manifold_markets", "name": "Manifold Markets", "url": "https://manifold.markets/" } ] } ``` ``` -------------------------------- ### GET /profile/info Source: https://docs.polyrouter.io/api-reference/changelog Retrieve user profile information and trading metrics from Kalshi and Polymarket. ```APIDOC ## GET /profile/info ### Description Retrieves user profile data and trading metrics from Kalshi and Polymarket. ### Method GET ### Endpoint `/profile/info` ### Query Parameters - **platform** (string) - Required - The platform to retrieve profile information from (e.g., 'kalshi', 'polymarket'). - **user_id** (string) - Required - The unique identifier for the user. ### Response #### Success Response (200) - **profile** (object) - User profile information. - **username** (string) - The user's username. - **trading_volume** (number) - The total trading volume of the user. - **win_rate** (number) - The user's win rate. #### Response Example ```json { "profile": { "username": "trader123", "trading_volume": 50000.75, "win_rate": 0.65 } } ``` ``` -------------------------------- ### GET /games/{game_id} Source: https://docs.polyrouter.io/api-reference/changelog Retrieve detailed information, markets, and odds for a specific game. ```APIDOC ## GET /games/{game_id} ### Description Retrieves detailed information, including markets and odds, for a specific game identified by its unique `game_id`. ### Method GET ### Endpoint `/games/{game_id}` ### Path Parameters - **game_id** (string) - Required - The unique identifier for the game (e.g., 'PHIvWAS20251028@NBA'). ### Response #### Success Response (200) - **game_details** (object) - Details about the game. - **game_id** (string) - The unique identifier for the game. - **home_team** (string) - The home team. - **away_team** (string) - The away team. - **date** (string) - The date of the game (YYYY-MM-DD). - **league** (string) - The league the game belongs to. - **markets** (array) - An array of market objects for the game. - **market_id** (string) - The ID of the market. - **type** (string) - The type of market (e.g., 'moneyline', 'spread', 'total'). - **odds** (object) - Odds for different outcomes. #### Response Example ```json { "game_details": { "game_id": "PHIvWAS20251028@NBA", "home_team": "Washington Wizards", "away_team": "Philadelphia 76ers", "date": "2025-10-28", "league": "nba", "markets": [ { "market_id": "market_nba_moneyline_was", "type": "moneyline", "odds": { "home_win": 2.10, "away_win": 1.75 } } ] } } ``` ``` -------------------------------- ### GET /markets Source: https://docs.polyrouter.io/api-reference/markets/list-markets Retrieve a paginated list of available prediction markets from supported platforms. ```APIDOC ## GET /markets ### Description Fetch a list of markets from prediction market platforms. Supports pagination to handle large datasets. ### Method GET ### Endpoint /markets ### Parameters #### Query Parameters - **page** (integer) - Optional - The page number to retrieve. - **limit** (integer) - Optional - The number of results per page. ### Request Example GET /markets?page=1&limit=10 ### Response #### Success Response (200) - **markets** (array) - A list of market objects. - **total** (integer) - Total number of markets available. #### Response Example { "markets": [ { "id": "market_123", "title": "Will it rain tomorrow?", "platform": "poly_market" } ], "total": 1 } ``` -------------------------------- ### GET /games/{id} Source: https://docs.polyrouter.io/api-reference/sports/get-game-by-id Fetches details for a specific game by its ID, including market data from all supported platforms. ```APIDOC ## GET /games/{id} ### Description Fetch a single game by its ID with market data from all platforms. ### Method GET ### Endpoint /games/{id} ### Parameters #### Path Parameters - **id** (string) - Required - Game ID (format: {Away}v{Home}{YYYYMMDD}@{LEAGUE}) #### Query Parameters - **platform** (SportsPlatform) - Optional - Filter by platform - **market_type** (SportsMarketType) - Optional - Filter by market type - **odds_format** (OddsFormat) - Optional - Odds format for market odds (american, decimal, probability) ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) - **data** (SportsEvent) - The game details. - **meta** (SportsMeta) - Metadata about the response. #### Response Example ```json { "example": "response body" } ``` #### Error Responses - **401**: Unauthorized - **404**: Game not found ``` -------------------------------- ### GET /markets Source: https://docs.polyrouter.io/api-reference/events/list-events Retrieves a list of aggregated prediction markets from supported platforms. ```APIDOC ## GET /markets ### Description Retrieves a collection of prediction markets aggregated from platforms like Polymarket and Kalshi. ### Method GET ### Endpoint /markets ### Parameters #### Query Parameters - **platform** (string) - Optional - Filter markets by platform name (e.g., polymarket, kalshi). - **status** (string) - Optional - Filter markets by status (open, paused, resolved, cancelled). ### Request Example GET /markets?platform=kalshi&status=open ### Response #### Success Response (200) - **markets** (array) - List of market objects. - **meta** (object) - Metadata regarding the request, including platforms queried and data freshness. #### Response Example { "markets": [ { "id": "KXELONMARS-99", "platform": "kalshi", "title": "Will Elon Musk visit Mars before Aug 1, 2099?", "status": "open", "market_type": "binary", "last_synced_at": "2025-01-01T00:00:00.000Z" } ], "meta": { "platforms_queried": ["kalshi"], "request_time": 150, "cache_hit": false, "data_freshness": "2025-01-01T00:00:00.000Z" } } ``` -------------------------------- ### GET /trades Source: https://docs.polyrouter.io/api-reference/changelog Fetch historical trade data for Kalshi and Polymarket markets. ```APIDOC ## GET /trades ### Description Fetches historical trade data for markets on Kalshi and Polymarket. ### Method GET ### Endpoint `/trades` ### Query Parameters - **market_id** (string) - Optional - Filter trades by a specific market ID. - **platform** (string) - Optional - Filter trades by platform ('kalshi' or 'polymarket'). - **start_date** (string) - Optional - Start date for historical data (YYYY-MM-DD). - **end_date** (string) - Optional - End date for historical data (YYYY-MM-DD). - **limit** (integer) - Optional - The number of trades to return per page. (Max: 25) - **page** (string) - Optional - Cursor for pagination. ### Response #### Success Response (200) - **trades** (array) - An array of historical trade objects. - **trade_id** (string) - Unique identifier for the trade. - **market_id** (string) - The ID of the market traded. - **platform** (string) - The platform where the trade occurred. - **type** (string) - The type of trade (buy/sell). - **price** (number) - The price at which the trade was executed. - **timestamp** (string) - The timestamp of the trade. #### Response Example ```json { "trades": [ { "trade_id": "trade_456", "market_id": "market_789", "platform": "kalshi", "type": "sell", "price": 0.45, "timestamp": "2023-10-26T15:30:00Z" } ] } ``` ``` -------------------------------- ### GET /markets Source: https://docs.polyrouter.io/api-reference/pagination Retrieves a list of markets with support for cursor-based pagination to handle large datasets. ```APIDOC ## GET /markets ### Description Fetches a paginated list of markets available on the platform. Use the cursor parameter to navigate through subsequent pages. ### Method GET ### Endpoint https://api-v2.polyrouter.io/markets ### Parameters #### Query Parameters - **limit** (integer) - Optional - Number of results per page (1-25). - **cursor** (string) - Optional - Opaque token for fetching the next page of results. ### Request Example 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 metadata: total, limit, has_more, and next_cursor. #### Response Example { "markets": [...], "pagination": { "total": 150, "limit": 10, "has_more": true, "next_cursor": "eyJwbGF0Zm9ybXMiOnsia2Fsc2hpIjp7..." } } ``` -------------------------------- ### GET /league-info Source: https://docs.polyrouter.io/api-reference/changelog Retrieve league and team information, including operational status and game support. ```APIDOC ## GET /league-info ### Description Retrieves information about supported sports leagues and teams, including their operational status and whether they have game data available. ### Method GET ### Endpoint `/league-info` ### Query Parameters - **league** (string) - Optional - Filter by a specific league (e.g., 'nfl', 'nba', 'nhl', 'mlb'). ### Response #### Success Response (200) - **leagues** (array) - An array of league objects. - **id** (string) - The unique identifier for the league. - **name** (string) - The name of the league. - **has_games** (boolean) - Indicates if game data is available for this league. - **teams** (array) - An array of team objects within the league. - **id** (string) - The unique identifier for the team. - **name** (string) - The name of the team. #### Response Example ```json { "leagues": [ { "id": "nfl", "name": "National Football League", "has_games": true, "teams": [ { "id": "team_49ers", "name": "San Francisco 49ers" } ] }, { "id": "nba", "name": "National Basketball Association", "has_games": true, "teams": [ { "id": "team_lakers", "name": "Los Angeles Lakers" } ] } ] } ``` ``` -------------------------------- ### GET /list-games Source: https://docs.polyrouter.io/api-reference/changelog List available games across supported sports leagues with filtering options. ```APIDOC ## GET /list-games ### Description Provides a directory of available games across supported sports leagues. You can filter games by league. ### Method GET ### Endpoint `/list-games` ### Query Parameters - **league** (string) - Optional - Filter by league(s) (e.g., 'nba', 'nhl', 'mlb', 'nfl'). Multiple leagues can be specified with '|' delimiter (e.g., 'nba|nhl'). - **date** (string) - Optional - Filter games by a specific date (YYYY-MM-DD). ### Response #### Success Response (200) - **games** (array) - An array of game objects. - **game_id** (string) - The unique identifier for the game (e.g., 'PHIvWAS20251028@NBA'). - **home_team** (string) - The home team. - **away_team** (string) - The away team. - **date** (string) - The date of the game (YYYY-MM-DD). - **league** (string) - The league the game belongs to. #### Response Example ```json { "games": [ { "game_id": "PHIvWAS20251028@NBA", "home_team": "Washington Wizards", "away_team": "Philadelphia 76ers", "date": "2025-10-28", "league": "nba" } ] } ``` ``` -------------------------------- ### GET /markets/{id} Source: https://docs.polyrouter.io/api-reference/markets/get-market-by-id Retrieve detailed information for a specific market using its unique identifier. ```APIDOC ## GET /markets/{id} ### Description Fetches the details of a specific market by providing its unique ID. ### 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 status of the market #### Response Example { "id": "12345", "name": "Example Market", "status": "active" } ``` -------------------------------- ### GET /v1/market-data Source: https://docs.polyrouter.io/api-reference/sports/list-games Retrieves aggregated market data from supported sports betting platforms. ```APIDOC ## GET /v1/market-data ### Description Fetches current market data and status across multiple sports betting platforms. ### Method GET ### Endpoint /v1/market-data ### Parameters #### Query Parameters - **platforms** (array) - Optional - List of platforms to query (e.g., polymarket, kalshi, prophetx, novig, sxbet) ### Request Example GET /v1/market-data?platforms=polymarket,kalshi ### Response #### Success Response (200) - **platforms_queried** (array) - List of platforms successfully queried - **request_time** (number) - Time taken for the request in milliseconds - **data_freshness** (string) - ISO 8601 timestamp of the data - **platform_errors** (object) - Dictionary of errors per platform if any occurred #### Response Example { "platforms_queried": ["polymarket", "kalshi"], "request_time": 250, "data_freshness": "2025-01-01T00:00:00.000Z", "platform_errors": {} } ``` -------------------------------- ### GET /markets Source: https://docs.polyrouter.io/api-reference/markets/list-markets Fetch a list of prediction markets from various platforms with support for filtering, searching, 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 /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 - **markets** (array) - List of market objects - **meta** (object) - Response metadata #### Response Example { "pagination": { "total": 50, "limit": 50, "has_more": true, "next_cursor": "WzMsW1swLDEsM11dXQ" }, "markets": [ { "id": "KXELONMARS-99", "platform": "kalshi", "event_name": "Will Elon Musk visit Mars?" } ], "meta": {} } ``` -------------------------------- ### GET /api/sports/league-info Source: https://docs.polyrouter.io/api-reference/introduction Fetches league metadata and team mappings for the Sports API. ```APIDOC ## GET /api/sports/league-info ### Description Retrieves league information, including team mappings and metadata. ### Method GET ### Endpoint /api/sports/league-info ### Parameters #### Query Parameters - **sport** (string) - Required - The sport to filter by (e.g., "nfl", "mlb"). - **league** (string) - Optional - The specific league to filter by. ### Request Example ```json { "sport": "nfl" } ``` ### Response #### Success Response (200) - **data** (array) - An array of league objects. - **league_id** (string) - The unique identifier for the league. - **name** (string) - The name of the league. - **teams** (array) - An array of team objects. - **team_id** (string) - The unique identifier for the team. - **name** (string) - The name of the team. - **alias** (string) - An alias for the team. #### Response Example ```json { "data": [ { "league_id": "nfl", "name": "National Football League", "teams": [ { "team_id": "nfl-kc", "name": "Kansas City Chiefs", "alias": "Chiefs" } ] } ] } ``` ``` -------------------------------- ### Get Game by ID Source: https://docs.polyrouter.io/api-reference/sports/get-game-by-id Fetch a single game by its ID, including market data from all platforms. ```APIDOC ## GET /games/{game_id} ### Description Fetch a single game by its ID with market data from all platforms. ### Method GET ### Endpoint /games/{game_id} ### Parameters #### Path Parameters - **game_id** (string) - Required - The unique identifier of the game. ### Response #### Success Response (200) - **game_data** (object) - Contains detailed information about the game, including market data. #### Response Example { "game_data": { "id": "example_game_id", "title": "Example Game", "platforms": [ { "platform": "Steam", "price": "19.99", "currency": "USD" }, { "platform": "Epic Games Store", "price": "19.99", "currency": "USD" } ] } } ``` -------------------------------- ### GET /market-data Source: https://docs.polyrouter.io/api-reference/events/list-events Retrieves comprehensive market metadata including bid/ask spreads, AMM types, and scoring metrics. ```APIDOC ## GET /market-data ### Description Fetches the current market metadata, including best bid/ask prices, spread, and AMM configuration details. ### Method GET ### Endpoint /market-data ### Parameters #### Query Parameters - **marketId** (string) - Required - The unique identifier for the market. ### Request Example GET /market-data?marketId=123 ### Response #### Success Response (200) - **conditionId** (string) - The condition ID associated with the market. - **bestBid** (number) - The current best bid price. - **bestAsk** (number) - The current best ask price. - **spread** (number) - The difference between the best ask and best bid. #### Response Example { "conditionId": "cond_001", "bestBid": 0.64, "bestAsk": 0.66, "spread": 0.02 } ``` -------------------------------- ### Get NFL Game Odds Source: https://docs.polyrouter.io/index Retrieves odds for NFL games. It includes an example for listing today's games and another for fetching odds of a specific game using a game ID. Game IDs follow a specific format: {AwayTeam}v{HomeTeam}{YYYYMMDD}@{LEAGUE}. ```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" ``` -------------------------------- ### GET /profile/trades Source: https://docs.polyrouter.io/api-reference/changelog Get user trade history with pagination support. ```APIDOC ## GET /profile/trades ### Description Retrieves the trade history for a specific user, with support for pagination. ### Method GET ### Endpoint `/profile/trades` ### Query Parameters - **platform** (string) - Required - The platform to retrieve trade history from (e.g., 'kalshi', 'polymarket'). - **user_id** (string) - Required - The unique identifier for the user. - **limit** (integer) - Optional - The number of trades to return per page. (Max: 25) - **page** (string) - Optional - Cursor for pagination. ### Response #### Success Response (200) - **trades** (array) - An array of trade objects. - **trade_id** (string) - Unique identifier for the trade. - **market_id** (string) - The ID of the market traded. - **type** (string) - The type of trade (buy/sell). - **price** (number) - The price at which the trade was executed. - **timestamp** (string) - The timestamp of the trade. #### Response Example ```json { "trades": [ { "trade_id": "trade_789", "market_id": "market_123", "type": "buy", "price": 0.70, "timestamp": "2023-10-27T10:00:00Z" } ] } ``` ``` -------------------------------- ### Perform Cursor-Based Pagination Requests Source: https://docs.polyrouter.io/api-reference/pagination Demonstrates how to fetch paginated resources using the PolyRouter API. Includes examples for initial requests and subsequent page navigation using the 'next_cursor' token. ```bash curl "https://api-v2.polyrouter.io/markets?limit=10" \ -H "X-API-Key: 5fa709a5-0634-44c3-a991-57166d3c376d" # Next page request curl "https://api-v2.polyrouter.io/markets?limit=10&cursor=eyJwbGF0Zm9ybXMiOnsia2Fsc2hpIjp7..." \ -H "X-API-Key: 5fa709a5-0634-44c3-a991-57166d3c376d" ``` ```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 ``` -------------------------------- ### Documentation Index Source: https://docs.polyrouter.io/api-reference/series/get-series-by-id Fetch the complete documentation index. ```APIDOC ## GET /.well-known/polyrouter/llms.txt ### Description Retrieves the complete documentation index for the LLMs API. This index can be used to discover all available documentation pages. ### Method GET ### Endpoint /.well-known/polyrouter/llms.txt ### Response #### Success Response (200) - **documentation_index** (string) - A string containing the documentation index, typically a list of available documentation paths. #### Response Example ``` /llms.txt /series/{id} ``` ``` -------------------------------- ### Get NFL Odds Source: https://docs.polyrouter.io/index Retrieve odds for NFL games, including listing available games and getting specific game odds. ```APIDOC ## NFL Odds API ### Description This section covers endpoints for retrieving odds related to NFL games. You can list available games and fetch detailed odds for a specific game. ### Method GET ### Endpoints - `/list-games` - `/games/{game_id}` ### Query Parameters for `/list-games` - **league** (string) - Required - The sports league to query (e.g., 'nfl'). - **limit** (integer) - Optional - The maximum number of games to return. ### Path Parameters for `/games/{game_id}` - **game_id** (string) - Required - The unique identifier for the game. Format: `{AwayTeam}v{HomeTeam}{YYYYMMDD}@{LEAGUE}` (e.g., `BUFvKC20251020@NFL`). ### Request Examples #### List Today's NFL Games ```bash curl "https://api-v2.polyrouter.io/list-games?league=nfl&limit=5" \ -H "X-API-Key: YOUR_API_KEY" ``` #### Get Odds for a Specific NFL Game ```bash curl "https://api-v2.polyrouter.io/games/BUFvKC20251020@NFL" \ -H "X-API-Key: YOUR_API_KEY" ``` ### Response Example (for `/games/{game_id}`) ```json { "game_id": "BUFvKC20251020@NFL", "away_team": "Buffalo Bills", "home_team": "Kansas City Chiefs", "start_time": "2025-10-20T13:00:00Z", "odds": { "spread": { "away": {"line": -3.5, "price": -110}, "home": {"line": 3.5, "price": -110} }, "total": { "over": {"line": 49.5, "price": -110}, "under": {"line": 49.5, "price": -110} } } } ``` ### Notes - Game IDs follow the format `{AwayTeam}v{HomeTeam}{YYYYMMDD}@{LEAGUE}`. Use `/list-games` to discover available games. ``` -------------------------------- ### Documentation Index Source: https://docs.polyrouter.io/api-reference/events/list-events Fetch the complete documentation index for the LLM API. This file can be used to discover all available pages. ```APIDOC ## Documentation Index ### Description Fetch the complete documentation index at the provided URL. This file serves as a guide to discover all available API pages. ### Endpoint GET https://docs.polyrouter.io/llms.txt ### Response Example ``` { "documentation_index_url": "https://docs.polyrouter.io/llms.txt" } ``` ``` -------------------------------- ### Get League Information Source: https://docs.polyrouter.io/api-reference/sports/get-league-information Fetches information about supported sports leagues. You can optionally specify a league to get details for a specific one, or omit it to retrieve information for all leagues. ```APIDOC ## GET /league-info ### Description Fetch information about supported sports leagues, including available endpoints and team counts. ### Method GET ### Endpoint /league-info ### Parameters #### Query Parameters - **league** (string) - Optional - Specific league to query (e.g., nfl, nba, nhl, mlb). Returns all leagues if not specified. - **include_teams** (string) - Optional - Include team information in the response. Example: 'true'. ### Response #### Success Response (200) - **data** (object) - Contains league information. - **meta** (object) - Metadata about the request, including request_time. #### Response Example ```json { "data": { "id": "nfl", "name": "National Football League", "abbreviation": "NFL", "sport": "Football", "season": { "year": 2024, "start_date": "2024-09-05", "end_date": "2025-02-09" }, "endpoints": { "awards": true, "futures": true, "games": true, "list_games": true } }, "meta": { "request_time": 50 } } ``` #### Error Response (401) - **error** (object) - Contains error details including code, message, and timestamp. #### Error Response (404) - **error** (object) - Contains error details including code, message, and timestamp. ``` -------------------------------- ### Fetch Markets Data Source: https://docs.polyrouter.io/index Fetches a list of markets from a specified platform with a limit on the number of results. Requires an API key for authentication. The output includes market details such as title, current prices, and volume. ```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)}%`); }); ``` -------------------------------- ### GET /api/events/list-events Source: https://docs.polyrouter.io/api-reference/introduction Fetches prediction market events. ```APIDOC ## GET /api/events/list-events ### Description Retrieves a list of prediction market events, which group related markets. ### Method GET ### Endpoint /api/events/list-events ### Parameters #### Query Parameters - **category** (string) - Optional - Filter events by category (e.g., "politics", "sports"). - **limit** (integer) - Optional - Maximum number of events to return. ### Request Example ```json { "category": "sports", "limit": 5 } ``` ### Response #### Success Response (200) - **events** (array) - An array of event objects. - **event_id** (string) - The unique identifier for the event. - **name** (string) - The name of the event. - **category** (string) - The category the event belongs to. #### Response Example ```json { "events": [ { "event_id": "world-cup-2026", "name": "2026 FIFA World Cup", "category": "sports" } ] } ``` ``` -------------------------------- ### GET /api/markets/list-markets Source: https://docs.polyrouter.io/api-reference/introduction Browse and filter prediction markets. ```APIDOC ## GET /api/markets/list-markets ### Description Allows users to browse and filter prediction markets based on various criteria. ### Method GET ### Endpoint /api/markets/list-markets ### Parameters #### Query Parameters - **query** (string) - Optional - Search term for market names or descriptions. - **status** (string) - Optional - Filter by market status (e.g., "open", "resolved"). - **limit** (integer) - Optional - Maximum number of markets to return. - **offset** (integer) - Optional - Number of markets to skip. ### Request Example ```json { "query": "US Election", "status": "open", "limit": 10 } ``` ### Response #### Success Response (200) - **markets** (array) - An array of market objects. - **market_id** (string) - The unique identifier for the market. - **name** (string) - The name of the market. - **status** (string) - The current status of the market. - **last_price** (number) - The last traded price. #### Response Example ```json { "markets": [ { "market_id": "election-2024-president", "name": "Who will win the 2024 US Presidential Election?", "status": "open", "last_price": 0.65 } ] } ``` ``` -------------------------------- ### Fetch Markets Source: https://docs.polyrouter.io/index Retrieve a list of markets from a specified platform with optional limits. ```APIDOC ## GET /markets ### Description Fetches a list of prediction markets from a specified platform. You can filter by platform and set a limit for the number of results. ### Method GET ### Endpoint /markets ### Query Parameters - **platform** (string) - Required - The prediction market platform to query (e.g., 'polymarket', 'kalshi'). - **limit** (integer) - Optional - The maximum number of markets to return. ### Request Example ```bash curl "https://api-v2.polyrouter.io/markets?platform=polymarket&limit=5" \ -H "X-API-Key: YOUR_API_KEY" ``` ### Response #### Success Response (200) - **markets** (array) - An array of market objects. - **id** (string) - Unique identifier for the market. - **platform** (string) - The platform the market belongs to. - **title** (string) - The title or question of the market. - **current_prices** (object) - Current pricing information. - **yes** (object) - Price for the 'yes' outcome. - **price** (float) - The current price (0.0 to 1.0). - **no** (object) - Price for the 'no' outcome. - **price** (float) - The current price (0.0 to 1.0). - **volume_24h** (float) - Trading volume in the last 24 hours. - **status** (string) - The current status of the market (e.g., 'open', 'resolved'). #### Response Example ```json { "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 Series by ID Source: https://docs.polyrouter.io/api-reference/series/get-series-by-id Fetch a single series by its ID. ```APIDOC ## GET /series/{id} ### Description Fetch a single series by its unique identifier. ### Method GET ### Endpoint /series/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the series to retrieve. ### Response #### Success Response (200) - **series_data** (object) - Contains the details of the requested series. #### Response Example ```json { "series_data": { "id": "example-series-id", "name": "Example Series", "description": "This is an example series." } } ``` ``` -------------------------------- ### API Key Authentication Source: https://docs.polyrouter.io/api-reference/profile/get-user-profile Explains how to authenticate API requests using an API key. ```APIDOC ## API Key Authentication ### Description To access the API, you must include your API key in the request headers. ### Security Scheme - **Type**: API Key - **Location**: Header - **Name**: X-API-Key - **Description**: Provide your unique API key for authentication. ``` -------------------------------- ### Authenticate API Request with cURL Source: https://docs.polyrouter.io/api-reference/introduction Demonstrates how to authenticate an API request to the PolyRouter markets endpoint using cURL. It shows the necessary header for API key inclusion. This is a common pattern for accessing protected API resources. ```bash curl "https://api-v2.polyrouter.io/markets" \ -H "X-API-Key: 5fa709a5-0634-44c3-a991-57166d3c376d" ``` -------------------------------- ### GET /price-history Source: https://docs.polyrouter.io/api-reference/changelog Retrieve historical price data for markets. ```APIDOC ## GET /price-history ### Description Retrieves historical price data for specified markets. ### Method GET ### Endpoint `/price-history` ### Query Parameters - **market_id** (string) - Required - The ID of the market for which to retrieve price history. - **start_date** (string) - Optional - Start date for historical data (YYYY-MM-DD). - **end_date** (string) - Optional - End date for historical data (YYYY-MM-DD). - **interval** (string) - Optional - The time interval for the price data (e.g., 'daily', 'hourly'). ### Response #### Success Response (200) - **price_history** (array) - An array of historical price data points. - **timestamp** (string) - The timestamp of the price data. - **price** (number) - The price at that timestamp. #### Response Example ```json { "price_history": [ { "timestamp": "2023-10-27T09:00:00Z", "price": 0.72 }, { "timestamp": "2023-10-27T10:00:00Z", "price": 0.75 } ] } ``` ``` -------------------------------- ### List Events Source: https://docs.polyrouter.io/api-reference/events/list-events Fetch events from prediction market platforms with pagination. Currently, only Polymarket and Kalshi are supported. ```APIDOC ## List Events ### Description Fetches a list of events from supported prediction market platforms (Polymarket, Kalshi) with pagination support. ### Method GET ### Endpoint /events ### Query Parameters - **platform** (string) - Optional - The prediction market platform to filter events by (e.g., "polymarket", "kalshi"). - **limit** (integer) - Optional - The maximum number of events to return per page. Defaults to 20. - **offset** (integer) - Optional - The number of events to skip before returning results. Defaults to 0. ### Response #### Success Response (200) - **events** (array) - A list of event objects. - **event_id** (string) - Unique identifier for the event. - **title** (string) - The title or question of the event. - **platform** (string) - The platform where the event is listed. - **starts_at** (string) - ISO 8601 timestamp indicating when the event starts. - **ends_at** (string) - ISO 8601 timestamp indicating when the event ends. #### Response Example ```json { "events": [ { "event_id": "evt_12345", "title": "Will the S&P 500 close above 5000 by year-end?", "platform": "polymarket", "starts_at": "2023-01-01T00:00:00Z", "ends_at": "2023-12-31T23:59:59Z" } ], "has_more": true } ``` ```