### Player Endpoint Examples (Bash) Source: https://docs.sportsapipro.com/api-reference/cricket-v2/player Examples of GET requests for various player data endpoints. Use these to retrieve player details, statistics, and other relevant information. ```bash GET /api/players/:id # Player details (role, style, nationality) ``` ```bash GET /api/players/:id/image # Player photo URL ``` ```bash GET /api/players/:id/statistics # Career statistics ``` ```bash GET /api/players/:id/statistics/seasons # Seasons with stats ``` ```bash GET /api/players/:id/statistics/match-type?type=overall ``` ```bash GET /api/players/:id/characteristics ``` ```bash GET /api/players/:id/national-team-statistics # International career stats ``` ```bash GET /api/players/:id/attribute-overviews ``` ```bash GET /api/players/:id/last-year-summary ``` ```bash GET /api/players/:id/unique-tournaments ``` ```bash GET /api/players/:id/events/last/:page ``` ```bash GET /api/players/:id/events/next/:page ``` ```bash GET /api/players/:id/media ``` ```bash GET /api/players/:id/media/videos ``` ```bash GET /api/players/:id/tournament/:tid/season/:sid/statistics?type=overall ``` ```bash GET /api/players/:id/tournament/:tid/season/:sid/ratings?type=overall ``` ```bash GET /api/players/:id/tournament/:tid/season/:sid/summary ``` -------------------------------- ### Example GET Request for Game Suggestions Source: https://docs.sportsapipro.com/api-reference/games/suggestions Demonstrates how to fetch game suggestions using a cURL command. Ensure you replace 'YOUR_API_KEY' with your actual API key. ```bash curl -X GET "https://v1.football.sportsapipro.com/games/suggestions?games=4609055&feedBy=1&matchupId=63-110-9" \ -H "x-api-key: YOUR_API_KEY" ``` -------------------------------- ### Get Starting Lineups / Depth Chart Source: https://docs.sportsapipro.com/llms-full.txt Provides the starting lineup or depth chart information for a game. ```APIDOC ## GET /api/match/:matchId/lineups ### Description Retrieves the starting lineup or depth chart for a given match. ### Method GET ### Endpoint `/api/match/:matchId/lineups` ### Parameters #### Path Parameters - **matchId** (string) - Required - The unique identifier for the match. ``` -------------------------------- ### Example API Request (cURL) Source: https://docs.sportsapipro.com/api-reference/motorsport-v2/overview Example of how to make a GET request to the live API endpoint using cURL. ```curl curl -X GET "https://v2.motorsport.sportsapipro.com/api/live" \ -H "x-api-key: YOUR_API_KEY" ``` -------------------------------- ### Fetch Match Lineups Source: https://docs.sportsapipro.com/api-reference/aussie-rules-v2/match Get the starting lineup and interchange bench for both teams in a specific match. ```bash GET /api/match/:matchId/lineups ``` -------------------------------- ### Example API Requests (cURL, JavaScript, Python) Source: https://docs.sportsapipro.com/llms-full.txt Demonstrates how to make API requests using cURL, JavaScript, and Python, including setting the API key and constructing request URLs for searching teams and getting schedules. ```bash # Search for a team curl -X GET "https://v2.basketball.sportsapipro.com/api/search?q=lakers" \ -H "x-api-key: YOUR_API_KEY" ``` ```bash # Get today's schedule curl -X GET "https://v2.basketball.sportsapipro.com/api/schedule/2025-03-15" \ -H "x-api-key: YOUR_API_KEY" ``` ```javascript const results = await fetch( 'https://v2.basketball.sportsapipro.com/api/search?q=lakers', { headers: { 'x-api-key': 'YOUR_API_KEY' } } ).then(r => r.json()); ``` ```python import requests headers = {'x-api-key': 'YOUR_API_KEY'} results = requests.get( 'https://v2.basketball.sportsapipro.com/api/search?q=lakers', headers=headers ).json() ``` -------------------------------- ### Quick Start: Fetch Live Football Matches Source: https://docs.sportsapipro.com/llms-full.txt Provides a quick start guide for fetching live football match data using JavaScript and Python. The response is grouped by league, and the code iterates through leagues and events to display match scores and status. ```javascript const response = await fetch('https://v3.football.sportsapipro.com/api/v1/football/live', { headers: { 'x-api-key': 'YOUR_API_KEY' } }); const data = await response.json(); // Response is grouped by league data.leagues.forEach(({ league, events }) => { console.log(`--- ${league.name} ---`); events.forEach(e => { console.log(`${e.homeTeam.name} ${e.homeScore.current} - ${e.awayScore.current} ${e.awayTeam.name} [${e.status}]`); }); }); ``` ```python import requests response = requests.get( 'https://v3.football.sportsapipro.com/api/v1/football/live', headers={'x-api-key': 'YOUR_API_KEY'} ) data = response.json() for league_group in data['leagues']: print(f"--- {league_group['league']['name']} ---") for event in league_group['events']: print(f"{event['homeTeam']['name']} {event['homeScore']['current']} - {event['awayScore']['current']} {event['awayTeam']['name']}") ``` -------------------------------- ### Get Match Lineups Source: https://docs.sportsapipro.com/llms-full.txt Retrieves the starting XI and substitutes for a given match. ```APIDOC ## GET /api/match/:matchId/lineups ### Description Starting XI + substitutes per team. ### Method GET ### Endpoint /api/match/:matchId/lineups ``` -------------------------------- ### Quick Start: Live Football Scores Source: https://docs.sportsapipro.com/llms-full.txt Examples for fetching live football scores using cURL, JavaScript, and Python. ```APIDOC ## Quick Start ### Live Football Scores **cURL** ```bash curl -H "x-api-key: YOUR_API_KEY" \ https://v1.football.sportsapipro.com/games/current ``` **JavaScript** ```javascript const res = await fetch('https://v1.football.sportsapipro.com/games/current', { headers: { 'x-api-key': 'YOUR_API_KEY' } }); const { data } = await res.json(); // data.games[] — array of live football games ``` **Python** ```python import requests response = requests.get( 'https://v1.football.sportsapipro.com/games/current', headers={'x-api-key': 'YOUR_API_KEY'} ) data = response.json() ``` ``` -------------------------------- ### Starting XV & Bench Source: https://docs.sportsapipro.com/api-reference/rugby-v2/match Fetch the starting lineup and bench players for a given match. ```APIDOC ## Starting XV & Bench ### Description Fetch the starting lineup and bench players for a given match. ### Method GET ### Endpoint /api/match/:matchId/lineups ``` -------------------------------- ### Live Endpoint Example Source: https://docs.sportsapipro.com/api-reference/table-tennis-v2/overview An example request to fetch live match data from the API. ```APIDOC ## Example Requests ```bash cURL theme={null} curl -H "x-api-key: YOUR_API_KEY" \ https://v2.table-tennis.sportsapipro.com/api/live ``` ```javascript JavaScript theme={null} const response = await fetch( 'https://v2.table-tennis.sportsapipro.com/api/live', { headers: { 'x-api-key': 'YOUR_API_KEY' } } ); const data = await response.json(); ``` ```python Python theme={null} import requests response = requests.get( 'https://v2.table-tennis.sportsapipro.com/api/live', headers={'x-api-key': 'YOUR_API_KEY'} ) data = response.json() ``` ``` -------------------------------- ### Fetch Live Basketball Games (Python) Source: https://docs.sportsapipro.com/llms-full.txt This Python example shows how to retrieve live game data using the requests library. Ensure you have the library installed and replace YOUR_API_KEY with your valid key. ```python import requests response = requests.get( 'https://v1.basketball.sportsapipro.com/games/current', headers={'x-api-key': 'YOUR_API_KEY'} ) data = response.json() ``` -------------------------------- ### Complete Workflow Example Source: https://docs.sportsapipro.com/api-reference/standings/get This example demonstrates a complete workflow: fetching all EPL teams from the standings, then retrieving fixtures and results for the top-ranked team. It covers API calls for standings, fixtures, and results. ```JavaScript const BASE_URL = "https://v1.football.sportsapipro.com"; const API_KEY = "YOUR_API_KEY"; const EPL_COMPETITION_ID = 7; // Step 1: Get all EPL teams from standings async function getEPLTeams() { const response = await fetch( `${BASE_URL}/standings?competitions=${EPL_COMPETITION_ID}`, { headers: { "x-api-key": API_KEY } } ); const data = await response.json(); return data.standings[0].rows.map(row => ({ id: row.competitor.id, name: row.competitor.name, nameForURL: row.competitor.nameForURL, position: row.position, points: row.points, played: row.gamePlayed })); } // Step 2: Get fixtures for a specific team async function getTeamFixtures(competitorId) { const response = await fetch( `${BASE_URL}/games/fixtures?competitors=${competitorId}&showOdds=true`, { headers: { "x-api-key": API_KEY } } ); return response.json(); } // Step 3: Get results for a specific team async function getTeamResults(competitorId) { const response = await fetch( `${BASE_URL}/games/results?competitors=${competitorId}&showOdds=true`, { headers: { "x-api-key": API_KEY } } ); return response.json(); } // Example: Get all EPL teams and then fetch fixtures for the top team async function main() { const teams = await getEPLTeams(); console.log("EPL Teams:", teams); // Get fixtures for the team in 1st place const topTeam = teams.find(t => t.position === 1); console.log(`\nFetching fixtures for ${topTeam.name}...`); const fixtures = await getTeamFixtures(topTeam.id); console.log(`Found ${fixtures.games?.length || 0} upcoming fixtures`); // Get results for the same team const results = await getTeamResults(topTeam.id); console.log(`Found ${results.games?.length || 0} past results`); } main(); ``` ```Python import requests BASE_URL = "https://v1.football.sportsapipro.com" API_KEY = "YOUR_API_KEY" EPL_COMPETITION_ID = 7 def get_epl_teams(): """Step 1: Get all EPL teams from standings""" response = requests.get( f"{BASE_URL}/standings", params={"competitions": EPL_COMPETITION_ID}, headers={"x-api-key": API_KEY} ) data = response.json() return [ { "id": row["competitor"]["id"], "name": row["competitor"]["name"], "nameForURL": row["competitor"]["nameForURL"], "position": row["position"], "points": row["points"], "played": row["gamePlayed"] } for row in data["standings"][0]["rows"] ] def get_team_fixtures(competitor_id: int): """Step 2: Get fixtures for a specific team""" response = requests.get( f"{BASE_URL}/games/fixtures", params={"competitors": competitor_id, "showOdds": "true"}, headers={"x-api-key": API_KEY} ) return response.json() def get_team_results(competitor_id: int): """Step 3: Get results for a specific team""" response = requests.get( f"{BASE_URL}/games/results", params={"competitors": competitor_id, "showOdds": "true"}, headers={"x-api-key": API_KEY} ) return response.json() # Example: Get all EPL teams and fetch data for the top team def main(): teams = get_epl_teams() print(f"Found {len(teams)} EPL teams:") for team in teams[:5]: # Print top 5 print(f" {team['position']}. {team['name']} (ID: {team['id']}) - {team['points']} pts") # Get fixtures for the team in 1st place top_team = next(t for t in teams if t["position"] == 1) print(f"\nFetching fixtures for {top_team['name']}...") fixtures = get_team_fixtures(top_team["id"]) games = fixtures.get("games", []) print(f"Found {len(games)} upcoming fixtures") # Get results for the same team results = get_team_results(top_team["id"]) past_games = results.get("games", []) print(f"Found {len(past_games)} past results") if __name__ == "__main__": main() ``` -------------------------------- ### API Authentication Example Source: https://docs.sportsapipro.com/api-reference/handball-v2/overview Include your API key in the x-api-key header for authentication. This example shows how to make a request to the live endpoint. ```bash curl -H "x-api-key: YOUR_API_KEY" \ https://v2.handball.sportsapipro.com/api/live ``` -------------------------------- ### Match Lineups Source: https://docs.sportsapipro.com/llms-full.txt Get the starting lineup for a specific match. ```APIDOC ## GET /api/match/:matchId/lineups ### Description Starting lineup. ### Method GET ### Endpoint /api/match/:matchId/lineups ### Parameters #### Path Parameters - **matchId** (string) - Required - The ID of the match. ``` -------------------------------- ### Example Request Source: https://docs.sportsapipro.com/api-reference/beach-volley-v2/overview Example requests for fetching live data using cURL, JavaScript, and Python. ```APIDOC ## Example Requests ```bash cURL theme={null} curl -H "x-api-key: YOUR_API_KEY" \ https://v2.beach-volley.sportsapipro.com/api/live ``` ```javascript JavaScript theme={null} const response = await fetch( 'https://v2.beach-volley.sportsapipro.com/api/live', { headers: { 'x-api-key': 'YOUR_API_KEY' } } ); const data = await response.json(); ``` ```python Python theme={null} import requests response = requests.get( 'https://v2.beach-volley.sportsapipro.com/api/live', headers={'x-api-key': 'YOUR_API_KEY'} ) data = response.json() ``` ``` -------------------------------- ### GET /api/schedule/:date Source: https://docs.sportsapipro.com/api-reference/beach-volley-v2/global Retrieve the schedule of beach volleyball matches for a specific date. Ensure the date is in `YYYY-MM-DD` format. Example: `GET /api/schedule/2026-03-13`. ```http GET /api/schedule/:date ``` -------------------------------- ### Fetch Media and Broadcast Data - Bash Examples Source: https://docs.sportsapipro.com/api-reference/waterpolo-v2/match Examples for retrieving video highlights, general media, fan predictions, and TV broadcast information using bash commands. ```bash GET /api/match/:matchId/highlights ``` ```bash GET /api/match/:matchId/media ``` ```bash GET /api/match/:matchId/votes ``` ```bash GET /api/match/:matchId/channels ``` -------------------------------- ### Example Requests: Head-to-Head and Statistics Source: https://docs.sportsapipro.com/api-reference/tennis-v2/player Demonstrates how to make requests for head-to-head data and player statistics, emphasizing the use of Player Entity IDs and API keys. ```bash # Use Player Entity IDs for both players (NOT Team IDs) curl -X GET "https://v2.tennis.sportsapipro.com/api/players/3111/h2h/119248" \ -H "x-api-key: YOUR_API_KEY" ``` ```javascript // Step 1: Discover Player Entity ID from Team ID const teamRes = await fetch( 'https://v2.tennis.sportsapipro.com/api/teams/275923', { headers: { 'x-api-key': 'YOUR_API_KEY' } } ); const team = await teamRes.json(); const playerEntityId = team.player.id; // e.g., 3111 // Step 2: Use Player Entity ID for career endpoints const response = await fetch( `https://v2.tennis.sportsapipro.com/api/players/${playerEntityId}/statistics`, { headers: { 'x-api-key': 'YOUR_API_KEY' } } ); const stats = await response.json(); ``` -------------------------------- ### Get Predicted Lineups Source: https://docs.sportsapipro.com/api-reference/hockey-v2/match Retrieves the predicted starting lineup for a match. ```APIDOC ## GET /api/match/{matchId}/predicted-lineups ### Description Expected starting lineup. ### Method GET ### Endpoint /api/match/{matchId}/predicted-lineups ### Parameters #### Path Parameters - **matchId** (string) - Required - The unique identifier for the match. ``` -------------------------------- ### Fetch Core Match Data - Bash Examples Source: https://docs.sportsapipro.com/api-reference/waterpolo-v2/match Examples for retrieving core match details, scores, lineups, statistics, and incidents using bash commands. ```bash GET /api/match/:matchId ``` ```bash GET /api/match/:matchId/scores ``` ```bash GET /api/match/:matchId/lineups ``` ```bash GET /api/match/:matchId/statistics ``` ```bash GET /api/match/:matchId/incidents ``` -------------------------------- ### Example API Requests Source: https://docs.sportsapipro.com/api-reference/football-v2/global Demonstrates how to make API requests using cURL, JavaScript, and Python, including authentication with an API key. ```bash # Search for a team curl -X GET "https://v2.football.sportsapipro.com/api/search?q=arsenal" \ -H "x-api-key: YOUR_API_KEY" ``` ```bash # Get today's schedule curl -X GET "https://v2.football.sportsapipro.com/api/schedule/2025-03-15" \ -H "x-api-key: YOUR_API_KEY" ``` ```javascript // Search for a team const results = await fetch( 'https://v2.football.sportsapipro.com/api/search?q=arsenal', { headers: { 'x-api-key': 'YOUR_API_KEY' } } ).then(r => r.json()); ``` ```python import requests headers = {'x-api-key': 'YOUR_API_KEY'} # Search for a team results = requests.get( 'https://v2.football.sportsapipro.com/api/search?q=arsenal', headers=headers ).json() ``` -------------------------------- ### Get Pre-Match Odds Source: https://docs.sportsapipro.com/llms-full.txt Fetches betting odds available before the game starts. ```APIDOC ## GET /api/match/:matchId/odds/pre-match ### Description Retrieves betting odds that were available before the game commenced. ### Method GET ### Endpoint `/api/match/:matchId/odds/pre-match` ### Parameters #### Path Parameters - **matchId** (string) - Required - The unique identifier for the match. ``` -------------------------------- ### Example API Requests Source: https://docs.sportsapipro.com/api-reference/tennis-v2/match Demonstrates how to make requests to the API using cURL and JavaScript, including authentication with an API key. ```bash curl -X GET "https://v2.tennis.sportsapipro.com/api/match/15625024/statistics" \ -H "x-api-key: YOUR_API_KEY" ``` ```javascript const response = await fetch( 'https://v2.tennis.sportsapipro.com/api/match/15625024/point-by-point', { headers: { 'x-api-key': 'YOUR_API_KEY' } } ); const pointByPoint = await response.json(); ``` -------------------------------- ### GET /api/search?q=mol Source: https://docs.sportsapipro.com/api-reference/beach-volley-v2/global Search for beach volleyball teams, players, and tournaments by a query parameter. The `q` parameter specifies the search term. Example: `GET /api/search?q=mol`. ```http GET /api/search?q=mol ``` -------------------------------- ### Fetch Context and History Data - Bash Examples Source: https://docs.sportsapipro.com/api-reference/waterpolo-v2/match Examples for retrieving head-to-head history, scoring progression, pre-game form, and team streaks using bash commands. ```bash GET /api/match/:matchId/h2h ``` ```bash GET /api/match/:matchId/graph ``` ```bash GET /api/match/:matchId/pregame-form ``` ```bash GET /api/match/:matchId/streaks ``` -------------------------------- ### Live Cycling Stage Data Example Source: https://docs.sportsapipro.com/api-reference/cycling-v2/global An example of the JSON response structure for the `/api/live` endpoint, detailing event information such as stage name, status, tournament, and start timestamp. ```json { "events": [ { "id": 12345678, "homeTeam": { "id": 0, "name": "Stage 15" }, "awayTeam": { "id": 0, "name": "" }, "homeScore": { "current": 0, "display": 0 }, "status": { "code": 6, "description": "In Progress", "type": "inprogress" }, "tournament": { "name": "Tour de France", "id": 450 }, "season": { "name": "Stage 15: Rodez → Carcassonne" }, "startTimestamp": 1737331200 } ] } ``` -------------------------------- ### Get Lineups Source: https://docs.sportsapipro.com/api-reference/hockey-v2/match Fetches the starting lineup and bench players for both teams in a given match. ```APIDOC ## GET /api/match/{matchId}/lineups ### Description Starting lineup and bench for both teams. ### Method GET ### Endpoint /api/match/{matchId}/lineups ### Parameters #### Path Parameters - **matchId** (string) - Required - The unique identifier for the match. ``` -------------------------------- ### Example Live Scores Response Source: https://docs.sportsapipro.com/api-reference/football-v2/global An example of the simplified flat format response for live scores, including event ID, team names, scores, status, tournament, and start timestamp. ```json { "success": true, "count": 54, "events": [ { "id": 15269945, "homeTeam": "Estudiantes de Río Cuarto", "awayTeam": "Barracas Central", "homeScore": 1, "awayScore": 2, "status": "2nd half", "tournament": "Liga Profesional de Fútbol, Apertura", "slug": "estudiantes-de-rio-cuarto-barracas-central", "startTimestamp": 1775954700 } ], "timezone": { "name": "UTC", "source": "default", "utcOffset": "+00:00" } } ``` -------------------------------- ### Authenticate and Fetch Live Data Source: https://docs.sportsapipro.com/api-reference/bandy-v2/overview Include your API key in the 'x-api-key' header for all requests. This example shows how to fetch live data. ```bash curl -H "x-api-key: YOUR_API_KEY" \ https://v2.bandy.sportsapipro.com/api/live ``` -------------------------------- ### Get Stage Lineups Source: https://docs.sportsapipro.com/api-reference/cycling-v2/match Retrieve the start list of riders participating in a specific cycling stage. ```APIDOC ## GET /api/match/:matchId/lineups ### Description Fetches the start list, including all participating riders and their teams, for a specific cycling stage. ### Method GET ### Endpoint /api/match/:matchId/lineups ### Parameters #### Path Parameters - **matchId** (string) - Required - The unique identifier for the match (stage). ``` -------------------------------- ### Authentication Example Source: https://docs.sportsapipro.com/api-reference/american-football-v2/overview This example demonstrates how to authenticate your requests by including your API key in the 'x-api-key' header. ```APIDOC ## Authentication Include your API key in the `x-api-key` header: ```bash theme={null} curl -H "x-api-key: YOUR_API_KEY" \ https://v2.american-football.sportsapipro.com/api/live ``` ``` -------------------------------- ### Get Season Info Source: https://docs.sportsapipro.com/api-reference/football-v2/tournament Retrieves season-specific information such as start and end dates, the number of teams, and the current round. ```bash GET /api/tournament/{tournamentId}/season/{seasonId}/info ``` -------------------------------- ### Example API Requests Source: https://docs.sportsapipro.com/llms-full.txt Demonstrates how to make API requests to retrieve coach career data and venue details using cURL, JavaScript, and Python. ```bash # Get coach career curl -X GET "https://v2.basketball.sportsapipro.com/api/managers/12345/career" \ -H "x-api-key: YOUR_API_KEY" ``` ```bash # Get arena details curl -X GET "https://v2.basketball.sportsapipro.com/api/venue/1000" \ -H "x-api-key: YOUR_API_KEY" ``` ```javascript const career = await fetch( 'https://v2.basketball.sportsapipro.com/api/managers/12345/career', { headers: { 'x-api-key': 'YOUR_API_KEY' } } ).then(r => r.json()); ``` ```python import requests headers = {'x-api-key': 'YOUR_API_KEY'} career = requests.get( 'https://v2.basketball.sportsapipro.com/api/managers/12345/career', headers=headers ).json() ``` -------------------------------- ### Get Stage Details Source: https://docs.sportsapipro.com/api-reference/cycling-v2/match Retrieve details for a specific cycling stage, such as distance, profile information, and start time. ```APIDOC ## GET /api/match/:matchId ### Description Fetches the details of a specific cycling stage, including its distance, profile, and start time. ### Method GET ### Endpoint /api/match/:matchId ### Parameters #### Path Parameters - **matchId** (string) - Required - The unique identifier for the match (stage). ``` -------------------------------- ### V1 Image Examples Source: https://docs.sportsapipro.com/llms-full.txt Examples demonstrating how to use V1 image URLs in HTML and React, showing how to embed team logos. ```APIDOC ## V1 Examples ```html HTML theme={null} Manchester United ``` ```javascript React theme={null} function TeamLogo({ teamId, imageVersion, name }) { return ( {name} e.target.style.display = 'none'} /> ); } ``` ``` -------------------------------- ### Fetch Live Matches with API Key Source: https://docs.sportsapipro.com/api-reference/beach-volley-v2/overview Include your API key in the `x-api-key` header to authenticate requests. This example shows how to fetch live match data. ```bash curl -H "x-api-key: YOUR_API_KEY" \ https://v2.beach-volley.sportsapipro.com/api/live ``` -------------------------------- ### Get Lineups Source: https://docs.sportsapipro.com/api-reference/basketball-v2/match Retrieves the starting five and bench players for both teams in a match, including their jersey numbers and positions. ```APIDOC ## Get Lineups ### Description Returns starting five and bench players for both teams, including jersey numbers and positions (G, F, C). ### Method GET ### Endpoint /api/match/{matchId}/lineups ### Parameters #### Path Parameters - **matchId** (number) - Required - Numeric match ID. Discover via `/api/live`, `/api/schedule/{date}`, or `/api/search`. ``` -------------------------------- ### Authenticate and Fetch Live Data (cURL) Source: https://docs.sportsapipro.com/api-reference/basketball-v2/overview Example of how to authenticate using the x-api-key header and fetch live data. Ensure you replace 'YOUR_API_KEY' with your actual API key. ```bash curl -X GET "https://v2.basketball.sportsapipro.com/api/live" \ -H "x-api-key: YOUR_API_KEY" ``` -------------------------------- ### Waterpolo Live Match Response Example Source: https://docs.sportsapipro.com/api-reference/waterpolo-v2/global This is an example JSON response for the `/api/live` endpoint, illustrating the structure of live match data, including team information, scores per period, status, tournament details, and start timestamp. ```json { "events": [ { "id": 12345678, "homeTeam": { "id": 7101, "name": "Hungary" }, "awayTeam": { "id": 7102, "name": "Serbia" }, "homeScore": { "current": 9, "display": 9, "period1": 3, "period2": 2, "period3": 2, "period4": 2 }, "awayScore": { "current": 7, "display": 7, "period1": 2, "period2": 1, "period3": 3, "period4": 1 }, "status": { "code": 14, "description": "4th Quarter", "type": "inprogress" }, "tournament": { "name": "LEN Champions League", "id": 910 }, "startTimestamp": 1737331200 } ] } ``` -------------------------------- ### Filter by Competition Source: https://docs.sportsapipro.com/llms-full.txt Retrieve live game data filtered by a specific competition ID. For example, to get only NBA games. ```APIDOC ## Filter by Competition Get only NBA games: ```bash theme={null} curl -X GET "https://v1.basketball.sportsapipro.com/games/current?competitions=132" \ -H "x-api-key: YOUR_API_KEY" ``` ``` -------------------------------- ### Windsurf AI Tool Setup Source: https://docs.sportsapipro.com/llms-full.txt Instructions for adding SportsAPI Pro MCP server to Windsurf. ```APIDOC ## Windsurf 1. Open **Settings** → **MCP Servers** 2. Add a new server with the URL: ``` https://docs.sportsapipro.com/mcp ``` 3. Save and restart Windsurf. ``` -------------------------------- ### WebSocket Subscription Examples Source: https://docs.sportsapipro.com/llms-full.txt Examples demonstrating how to subscribe to different channels using the WebSocket API in JavaScript, Python, and cURL. ```APIDOC ## WebSocket Subscription Examples ### Description Examples demonstrating how to subscribe to different channels using the WebSocket API in JavaScript, Python, and cURL. ### JavaScript (Browser) ```javascript const ws = new WebSocket('wss://v2.football.sportsapipro.com/ws?x-api-key=YOUR_API_KEY'); ws.onopen = () => { // Subscribe to all live football scores ws.send(JSON.stringify({ action: 'subscribe', channel: 'live-scores' })); // Subscribe to a specific match's incidents (goals, cards, subs) ws.send(JSON.stringify({ action: 'subscribe', channel: 'match:14109842:incidents' })); }; ws.onmessage = (event) => { const msg = JSON.parse(event.data); console.log(`[${msg.type}] ${msg.channel}:`, msg.data); }; ``` ### Python ```python import websockets, asyncio, json async def connect(): uri = "wss://v2.football.sportsapipro.com/ws?x-api-key=YOUR_API_KEY" async with websockets.connect(uri) as ws: await ws.send(json.dumps({"action": "subscribe", "channel": "live-scores"})) async for message in ws: data = json.loads(message) print(f"[{data['type']}] {data.get('channel', '')}") asyncio.run(connect()) ``` ### cURL (wscat) ```bash wscat -c "wss://v2.football.sportsapipro.com/ws?x-api-key=YOUR_API_KEY" > {"action":"subscribe","channel":"live-scores"} > {"action":"subscribe","channel":"match:14109842:incidents"} > {"action":"ping","channel":"live-scores"} ``` ``` -------------------------------- ### Heat Map Endpoint Example Source: https://docs.sportsapipro.com/api-reference/images Illustrates the GET request format for retrieving heat map images using a token. ```http GET /images/heatmaps/{token} ``` -------------------------------- ### Fetch Player Performance Data - Bash Examples Source: https://docs.sportsapipro.com/api-reference/waterpolo-v2/match Examples for retrieving player statistics, best performers, and awards for a given match using bash commands. ```bash GET /api/match/:matchId/player-statistics ``` ```bash GET /api/match/:matchId/player/:pid/statistics ``` ```bash GET /api/match/:matchId/best-players ``` ```bash GET /api/match/:matchId/award ``` -------------------------------- ### Get ATP Rankings (JavaScript) Source: https://docs.sportsapipro.com/api-reference/tennis-v2/overview This JavaScript snippet demonstrates how to fetch ATP rankings. It includes an example of the expected response structure. ```javascript const response = await fetch( 'https://v2.tennis.sportsapipro.com/api/rankings', { headers: { 'x-api-key': 'YOUR_API_KEY' } } ); const data = await response.json(); // { success: true, data: { rankings: [{ rowName: "Jannik Sinner", ... }, ...] } } ``` -------------------------------- ### Fetch Live Matches with API Key Source: https://docs.sportsapipro.com/api-reference/hockey-v2/overview Demonstrates how to fetch live match data using the V2 API. Ensure you replace 'YOUR_API_KEY' with your actual API key. ```bash curl -X GET "https://v2.hockey.sportsapipro.com/api/live" \ -H "x-api-key: YOUR_API_KEY" ``` -------------------------------- ### GET /api/search?q=sandviken Source: https://docs.sportsapipro.com/api-reference/bandy-v2/global Search for bandy teams, players, and tournaments by providing a query parameter 'q'. Example searches for 'sandviken'. ```http GET /api/search?q=sandviken ``` -------------------------------- ### Example Request - Live Fights Source: https://docs.sportsapipro.com/api-reference/mma-v2/overview An example of how to fetch live fight data using cURL, including the required API key. ```APIDOC ## Example Requests ```bash cURL curl -X GET "https://v2.mma.sportsapipro.com/api/live" \ -H "x-api-key: YOUR_API_KEY" ``` ```javascript JavaScript const response = await fetch( 'https://v2.mma.storiesapipro.com/api/live', { headers: { 'x-api-key': 'YOUR_API_KEY' } } ); const data = await response.json(); ``` ```python Python import requests response = requests.get( 'https://v2.mma.sportsapipro.com/api/live', headers={'x-api-key': 'YOUR_API_KEY'} ) data = response.json() ``` ``` -------------------------------- ### Get Recent Matches Source: https://docs.sportsapipro.com/api-reference/tennis-v2/team Retrieve a paginated list of a player's most recent matches. Start with page 0 for the latest results. ```bash GET /api/teams/{id}/events/last/{page} ``` -------------------------------- ### Get Player Profile (cURL) Source: https://docs.sportsapipro.com/llms-full.txt Example of how to retrieve detailed player information using cURL, specifying the player ID in the query parameters. ```bash # Get Rafael Nadal's profile (ID: 874) curl -X GET "https://v1.tennis.sportsapipro.com/athletes?athletes=874" \ -H "x-api-key: YOUR_API_KEY" ``` -------------------------------- ### Claude Desktop AI Tool Setup Source: https://docs.sportsapipro.com/llms-full.txt Configuration for integrating SportsAPI Pro documentation with Claude Desktop. ```APIDOC ## Claude Desktop Add to your `claude_desktop_config.json` (located in `~/Library/Application Support/Claude/` on macOS or `%APPDATA%\Claude\` on Windows): ```json theme={null} { "mcpServers": { "sportsapi-pro-docs": { "url": "https://docs.sportsapipro.com/mcp" } } } ``` Restart Claude Desktop after saving. ``` -------------------------------- ### Fetch Live Data using Python Source: https://docs.sportsapipro.com/api-reference/bandy-v2/overview This Python example shows how to use the 'requests' library to fetch live data from the API, including passing the API key in the headers. ```python import requests response = requests.get( 'https://v2.bandy.sportsapipro.com/api/live', headers={'x-api-key': 'YOUR_API_KEY'} ) data = response.json() ``` -------------------------------- ### Get Predicted Lineups for a Match Source: https://docs.sportsapipro.com/api-reference/basketball-v2/match Retrieve the expected starting lineups before official announcements. This is useful for fantasy sports or early betting strategies. ```bash GET /api/match/{matchId}/predicted-lineups ``` -------------------------------- ### Get Pre-Match Odds Snapshot Source: https://docs.sportsapipro.com/api-reference/basketball-v2/match Retrieve a snapshot of pre-match odds for a specific match. This endpoint is ideal for capturing odds before the game starts. ```bash GET /api/match/{matchId}/odds/pre-match ``` -------------------------------- ### Complete Football Data Workflow Example Source: https://docs.sportsapipro.com/llms-full.txt Demonstrates fetching EPL teams, their upcoming fixtures, and past results. Requires API key and competition ID. Handles API requests and data parsing. ```javascript const BASE_URL = "https://v1.football.sportsapipro.com"; const API_KEY = "YOUR_API_KEY"; const EPL_COMPETITION_ID = 7; // Step 1: Get all EPL teams from standings async function getEPLTeams() { const response = await fetch( `${BASE_URL}/standings?competitions=${EPL_COMPETITION_ID}`, { headers: { "x-api-key": API_KEY } } ); const data = await response.json(); return data.standings[0].rows.map(row => ({ id: row.competitor.id, name: row.competitor.name, nameForURL: row.competitor.nameForURL, position: row.position, points: row.points, played: row.gamePlayed })); } // Step 2: Get fixtures for a specific team async function getTeamFixtures(competitorId) { const response = await fetch( `${BASE_URL}/games/fixtures?competitors=${competitorId}&showOdds=true`, { headers: { "x-api-key": API_KEY } } ); return response.json(); } // Step 3: Get results for a specific team async function getTeamResults(competitorId) { const response = await fetch( `${BASE_URL}/games/results?competitors=${competitorId}&showOdds=true`, { headers: { "x-api-key": API_KEY } } ); return response.json(); } // Example: Get all EPL teams and then fetch fixtures for the top team async function main() { const teams = await getEPLTeams(); console.log("EPL Teams:", teams); // Get fixtures for the team in 1st place const topTeam = teams.find(t => t.position === 1); console.log(`\nFetching fixtures for ${topTeam.name}...`); const fixtures = await getTeamFixtures(topTeam.id); console.log(`Found ${fixtures.games?.length || 0} upcoming fixtures`); // Get results for the same team const results = await getTeamResults(topTeam.id); console.log(`Found ${results.games?.length || 0} past results`); } main(); ``` ```python import requests BASE_URL = "https://v1.football.sportsapipro.com" API_KEY = "YOUR_API_KEY" EPL_COMPETITION_ID = 7 def get_epl_teams(): """Step 1: Get all EPL teams from standings""" response = requests.get( f"{BASE_URL}/standings", params={"competitions": EPL_COMPETITION_ID}, headers={"x-api-key": API_KEY} ) data = response.json() return [ { "id": row["competitor"]["id"], "name": row["competitor"]["name"], "nameForURL": row["competitor"]["nameForURL"], "position": row["position"], "points": row["points"], "played": row["gamePlayed"] } for row in data["standings"][0]["rows"] ] def get_team_fixtures(competitor_id: int): """Step 2: Get fixtures for a specific team""" response = requests.get( f"{BASE_URL}/games/fixtures", params={"competitors": competitor_id, "showOdds": "true"}, headers={"x-api-key": API_KEY} ) return response.json() def get_team_results(competitor_id: int): """Step 3: Get results for a specific team""" response = requests.get( f"{BASE_URL}/games/results", params={"competitors": competitor_id, "showOdds": "true"}, headers={"x-api-key": API_KEY} ) return response.json() # Example: Get all EPL teams and fetch data for the top team def main(): teams = get_epl_teams() print(f"Found {len(teams)} EPL teams:") for team in teams[:5]: # Print top 5 print(f" {team['position']}. {team['name']} (ID: {team['id']}) - {team['points']} pts") # Get fixtures for the team in 1st place top_team = next(t for t in teams if t["position"] == 1) print(f"\nFetching fixtures for {top_team['name']}...") fixtures = get_team_fixtures(top_team["id"]) games = fixtures.get("games", []) print(f"Found {len(games)} upcoming fixtures") # Get results for the same team results = get_team_results(top_team["id"]) past_games = results.get("games", []) print(f"Found {len(past_games)} past results") if __name__ == "__main__": main() ``` -------------------------------- ### Authentication Example Source: https://docs.sportsapipro.com/llms-full.txt This example shows how to authenticate your requests to the V2 Basketball API using an API key. ```APIDOC ## Authentication Same `x-api-key` header as V1 — your existing API key works for both versions: ```bash curl -X GET "https://v2.basketball.sportsapipro.com/api/live" \ -H "x-api-key: YOUR_API_KEY" ``` ``` -------------------------------- ### Discover Seasons and Get Standings (JavaScript) Source: https://docs.sportsapipro.com/llms-full.txt Example using JavaScript's fetch API to discover seasons and then retrieve standings for a specific season. ```javascript // Step 1: Discover seasons const seasons = await fetch( 'https://v2.football.sportsapipro.com/api/tournaments/17/seasons', { headers: { 'x-api-key': 'YOUR_API_KEY' } } ).then(r => r.json()); // Step 2: Get standings with a valid season ID const seasonId = seasons.seasons[0].id; // e.g., 61627 const standings = await fetch( `https://v2.football.sportsapipro.com/api/tournament/17/season/${seasonId}/standings`, { headers: { 'x-api-key': 'YOUR_API_KEY' } } ).then(r => r.json()); ``` -------------------------------- ### Example Requests: Fantasy Player Fixtures and Player of the Season Source: https://docs.sportsapipro.com/api-reference/football-v2/fantasy Demonstrates the two-step process for fetching fantasy player fixtures, including discovering the fantasy ID first. Also shows a direct request for Player of the Season data. ```bash # Step 1: Discover fantasy ID from player ID curl -X GET "https://v2.football.sportsapipro.com/api/players/839956/fantasy/competitions" \ -H "x-api-key: YOUR_API_KEY" # Step 2: Use the fantasyId from the response curl -X GET "https://v2.football.sportsapipro.com/api/fantasy/player/49002/fixtures" \ -H "x-api-key: YOUR_API_KEY" # Player of the Season — no discovery needed curl -X GET "https://v2.football.sportsapipro.com/api/player-of-the-season/highest-ratings" \ -H "x-api-key: YOUR_API_KEY" ``` ```javascript // Step 1: Get fantasy ID const fantasyComps = await fetch( 'https://v2.football.sportsapipro.com/api/players/839956/fantasy/competitions', { headers: { 'x-api-key': 'YOUR_API_KEY' } } ).then(r => r.json()); const fantasyId = fantasyComps.fantasyId; // extract from response // Step 2: Get fantasy fixtures const fixtures = await fetch( `https://v2.football.sportsapipro.com/api/fantasy/player/${fantasyId}/fixtures`, { headers: { 'x-api-key': 'YOUR_API_KEY' } } ).then(r => r.json()); ``` ```python import requests headers = {'x-api-key': 'YOUR_API_KEY'} # Step 1: Get fantasy ID fantasy_comps = requests.get( 'https://v2.football.sportsapipro.com/api/players/839956/fantasy/competitions', headers=headers ).json() fantasy_id = fantasy_comps['fantasyId'] # extract from response # Step 2: Get fantasy fixtures fixtures = requests.get( f'https://v2.football.sportsapipro.com/api/fantasy/player/{fantasy_id}/fixtures', headers=headers ).json() ``` -------------------------------- ### Discover Seasons and Get Standings (cURL) Source: https://docs.sportsapipro.com/llms-full.txt Example using cURL to first discover available seasons for a tournament and then retrieve standings for a specific season. ```bash # Step 1: Discover seasons curl -X GET "https://v2.football.sportsapipro.com/api/tournaments/17/seasons" \ -H "x-api-key: YOUR_API_KEY" # Step 2: Use a valid seasonId from the response curl -X GET "https://v2.football.sportsapipro.com/api/tournament/17/season/61627/standings" \ -H "x-api-key: YOUR_API_KEY" ```