### Get Player Profiles by ID, Search, or All (JavaScript) Source: https://api-sports.io/documentation/football/v3/index Demonstrates how to fetch player profile data using the API. It includes examples for retrieving a specific player by ID, searching players by last name, and fetching all players with pagination. Requires a GET request to the specified API endpoint. ```JavaScript get("https://v3.football.api-sports.io/players/profiles?player=276"); get("https://v3.football.api-sports.io/players/profiles?search=ney"); get("https://v3.football.api-sports.io/players/profiles"); get("https://v3.football.api-sports.io/players/profiles?page=2"); get("https://v3.football.api-sports.io/players/profiles?page=3"); ``` -------------------------------- ### Get Fixtures with Mixed Parameters (JavaScript) Source: https://api-sports.io/documentation/football/v3/index Demonstrates combining multiple query parameters to refine fixture requests. This example shows how to filter fixtures by date, league, and season simultaneously. This flexibility allows for highly specific data retrieval. ```javascript get("https://v3.football.api-sports.io/fixtures?date=2020-01-30&league=61&season=2019"); ``` ```javascript get("https://v3.football.api-sports.io/fixtures?league=61&next=10"); ``` ```javascript get("https://v3.football.api-sports.io/fixtures?venue=358&next=10"); ``` ```javascript get("https://v3.football.api-sports.io/fixtures?league=61&last=10&status=ft"); ``` ```javascript get("https://v3.football.api-sports.io/fixtures?team=85&last=10&timezone=Europe/london"); ``` ```javascript get("https://v3.football.api-sports.io/fixtures?team=85&season=2019&from=2019-07-01&to=2020-10-31"); ``` ```javascript get("https://v3.football.api-sports.io/fixtures?league=61&season=2019&from=2019-07-01&to=2020-10-31&timezone=Europe/london"); ``` ```javascript get("https://v3.football.api-sports.io/fixtures?league=61&season=2019&round=Regular Season - 1"); ``` -------------------------------- ### Call Leagues Endpoint using cURL Source: https://api-sports.io/documentation/football/v3/index This example demonstrates how to call the 'leagues' endpoint using the cURL command-line tool. It specifies the GET request method, the target URL, and includes the API key in the request headers. This is a straightforward way to test API endpoints directly from the terminal. ```bash curl --request GET \ --url https://v3.football.api-sports.io/leagues \ --header 'x-apisports-key: XxXxXxXxXxXxXxXxXxXxXxXx' ``` -------------------------------- ### Fetch Leagues using OCaml Cohttp Source: https://api-sports.io/documentation/football/v3/index Demonstrates fetching league data from the API Sports Football v3 API using the OCaml Cohttp library. This example makes a GET request and prints the response body. It requires the 'cohttp-lwt-unix' library and an 'x-apisports-key'. ```ocaml open Lwt open Cohttp open Cohttp_lwt_unix let reqBody = let uri = Uri.of_string "https://v3.football.api-sports.io/leagues" in let headers = Header.init () |> fun h -> Header.add h "x-apisports-key" "XxXxXxXxXxXxXxXxXxXxXxXx" in Client.call ~headers `GET uri >|= fun (_resp, body) -> body |> Cohttp_lwt.Body.to_string let () = let respBody = Lwt_main.run reqBody in print_endline (respBody) ``` -------------------------------- ### Get Teams Request Samples (JavaScript) Source: https://api-sports.io/documentation/football/v3/index This JavaScript code demonstrates various ways to fetch team information using the API-SPORTS Football v3 API's /teams endpoint. It shows examples of retrieving teams by ID, name, league, country, code, venue, or through a general search. Each example uses a 'get' function, implying an asynchronous request. ```javascript // Get one team from one team {id} get("https://v3.football.api-sports.io/teams?id=33"); // Get one team from one team {name} get("https://v3.football.api-sports.io/teams?name=manchester united"); // Get all teams from one {league} & {season} get("https://v3.football.api-sports.io/teams?league=39&season=2019"); // Get teams from one team {country} get("https://v3.football.api-sports.io/teams?country=england"); // Get teams from one team {code} get("https://v3.football.api-sports.io/teams?code=FRA"); // Get teams from one venue {id} get("https://v3.football.api-sports.io/teams?venue=789"); // Allows you to search for a team in relation to a team {name} or {country} get("https://v3.football.api-sports.io/teams?search=manches"); get("https://v3.football.api-sports.io/teams?search=England"); ``` -------------------------------- ### GET /lineups Source: https://api-sports.io/documentation/football/v3/index Fetches the lineups for a specified football fixture. Lineups become available 20-40 minutes before the match starts, depending on league coverage. Data is updated every 15 minutes. ```APIDOC ## GET /lineups ### Description Retrieves the lineups for a specific football fixture. Lineups are generally available 20 to 40 minutes before the fixture starts, contingent on league coverage. This data is updated every 15 minutes. ### Method GET ### Endpoint /lineups ### Parameters #### Query Parameters - **fixture** (integer) - Required - The ID of the fixture. - **team** (integer) - Optional - The ID of the team. - **player** (integer) - Optional - The ID of the player. - **type** (string) - Optional - The type of lineup information (e.g., 'start', 'substitute'). #### Header Parameters - **x-apisports-key** (string) - Required - Your API key for authentication. ### Response #### Success Response (200) - **response** (array) - An array of lineup events, each containing: - **time** (object) - Time of the event (elapsed, extra). - **team** (object) - Team details (id, name, logo). - **player** (object) - Player details (id, name). - **assist** (object) - Assist details (id, name). - **type** (string) - Type of event (e.g., 'subst', 'Card'). - **detail** (string) - Detailed description of the event (e.g., 'Substitution 1', 'Yellow Card'). - **comments** (string) - Any additional comments. #### Response Example ```json { "response": [ { "time": { "elapsed": 15, "extra": null }, "team": { "id": 463, "name": "Aldosivi", "logo": "https://media.api-sports.io/football/teams/463.png" }, "player": { "id": 6093, "name": "G. Verón" }, "assist": { "id": 6396, "name": "N. Bazzana" }, "type": "subst", "detail": "Substitution 1", "comments": null } ] } ``` ``` -------------------------------- ### Call Leagues Endpoint in C using libcurl Source: https://api-sports.io/documentation/football/v3/index This C code snippet demonstrates how to make a GET request to the 'leagues' endpoint of the API-Sports Football v3 API using the libcurl library. It initializes a curl handle, sets the request method, URL, and headers (including the API key), performs the request, and cleans up the handle. Ensure libcurl is installed and linked. ```c CURL *curl; CURLcode res; c_url = curl_easy_init(); if(curl) { curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET"); curl_easy_setopt(curl, CURLOPT_URL, "https://v3.football.api-sports.io/leagues"); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https"); struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "x-apisports-key: XxXxXxXxXxXxXxXxXxXxXxXx"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); res = curl_easy_perform(curl); } c_url_easy_cleanup(curl); ``` -------------------------------- ### Retrieve Player Teams and Seasons (API Request Example) Source: https://api-sports.io/documentation/football/v3/index This example demonstrates how to make an API request to retrieve a player's teams and the seasons they played in. It requires a player ID as a query parameter and an API key in the header. ```http GET /v3/football/players/seasons?player=895 HTTP/1.1 Host: v3.api-sports.io x-apisports-key: YOUR_API_KEY ``` -------------------------------- ### Get Odds by Fixture, League, Date, or Mixed Parameters (JavaScript) Source: https://api-sports.io/documentation/football/v3/index Demonstrates how to fetch pre-match odds using the API-SPORTS v3 Football API. It shows examples for retrieving odds by fixture ID, league and season, a specific date, or a combination of parameters including bookmaker, bet, and pagination. ```javascript // Get all available odds from one {fixture} get("https://v3.football.api-sports.io/odds?fixture=164327"); // Get all available odds from one {league} & {season} get("https://v3.football.api-sports.io/odds?league=39&season=2019"); // Get all available odds from one {date} get("https://v3.football.api-sports.io/odds?date=2020-05-15"); // It’s possible to make requests by mixing the available parameters get("https://v3.football.api-sports.io/odds?bookmaker=1&bet=4&league=39&season=2019"); get("https://v3.football.api-sports.io/odds?bet=4&fixture=164327"); get("https://v3.football.api-sports.io/odds?bookmaker=1&league=39&season=2019"); get("https://v3.football.api-sports.io/odds?date=2020-05-15&page=2&bet=4"); ``` -------------------------------- ### Get Bookmaker Data - Curl Source: https://api-sports.io/documentation/football/v3/index Command-line examples for retrieving bookmaker information. This includes fetching all bookmakers, a specific bookmaker by ID, or searching for bookmakers by name. All requests require an API key. ```bash # Get all available bookmakers curl --request GET \ --url 'https://v3.football.api-sports.io/odds/bookmakers' # Get bookmaker from one {id} curl --request GET \ --url 'https://v3.football.api-sports.io/odds/bookmakers?id=1' # Allows you to search for a bookmaker in relation to a bookmakers {name} curl --request GET \ --url 'https://v3.football.api-sports.io/odds/bookmakers?search=Betfair' ``` -------------------------------- ### Retrieve Player Transfers (PHP) Source: https://api-sports.io/documentation/football/v3/index Example of how to get all transfers for a specific player using the API-SPORTS v3 endpoint in PHP. The player's ID is passed as a query parameter. ```php // Get all transfers from one {player} get("https://v3.football.api-sports.io/transfers?player=35845"); ``` -------------------------------- ### Fetch Leagues using PHP cURL, Request2, and Http Source: https://api-sports.io/documentation/football/v3/index Demonstrates fetching league data from the API Sports Football v3 API using various PHP HTTP client libraries. Includes examples for cURL, HTTP_Request2, and the http library. All examples require an 'x-apisports-key'. ```php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://v3.football.api-sports.io/leagues', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => array( 'x-apisports-key: XxXxXxXxXxXxXxXxXxXxXxXx', ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` ```php setUrl('https://v3.football.api-sports.io/leagues'); $request->setMethod(HTTP_Request2::METHOD_GET); $request->setConfig(array( 'follow_redirects' => TRUE )); $request->setHeader(array( 'x-apisports-key' => 'XxXxXxXxXxXxXxXxXxXxXxXx', )); try { $response = $request->send(); if ($response->getStatus() == 200) { echo $response->getBody(); } else { echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' . $response->getReasonPhrase(); } } catch(HTTP_Request2_Exception $e) { echo 'Error: ' . $e->getMessage(); } ``` ```php $client = new http\Client; $request = new http\Client\Request; $request->setRequestUrl('https://v3.football.api-sports.io/leagues'); $request->setRequestMethod('GET'); $request->setHeaders(array( 'x-apisports-key' => 'XxXxXxXxXxXxXxXxXxXxXxXx' )); $client->enqueue($request)->send(); $response = $client->getResponse(); echo $response->getBody(); ``` -------------------------------- ### Get All Available Bets (Node.js) Source: https://api-sports.io/documentation/football/v3/index This Node.js snippet shows how to fetch all available bets using the 'axios' library. It sends a GET request to the API-SPORTS Football v3 odds/bets endpoint. ```javascript const axios = require('axios'); const apiKey = 'YOUR_API_KEY'; const url = 'https://v3.football.api-sports.io/odds/bets'; axios.get(url, { headers: { 'x-apisports-key': apiKey } }) .then(response => { console.log(response.data); }) .catch(error => { console.error('Error:', error); }); ``` -------------------------------- ### Get Player Trophies (JSON Example) Source: https://api-sports.io/documentation/football/v3/index This JSON object represents a successful response (200 OK) from the API when retrieving transfer data for a specific player. It includes player details, update timestamp, and a list of past transfers with associated team information. ```json { "get": "transfers", "parameters": { "player": "35845" }, "errors": [], "results": 1, "paging": { "current": 1, "total": 1 }, "response": [ { "player": { "id": 35845, "name": "Hernán Darío Burbano" }, "update": "2020-02-06T00:08:15+00:00", "transfers": [ { "date": "2019-07-15", "type": "Free", "teams": { "in": { "id": 2283, "name": "Atlas", "logo": "https://media.api-sports.io/football/teams/2283.png" }, "out": { "id": 2283, "name": "Atlas", "logo": "https://media.api-sports.io/football/teams/2283.png" } } }, { "date": "2019-01-01", "type": "N/A", "teams": { "in": { "id": 1937, "name": "Atletico Atlas", "logo": "https://media.api-sports.io/football/teams/1937.png" }, "out": { "id": 1139, "name": "Santa Fe", "logo": "https://media.api-sports.io/football/teams/1139.png" } } }, { "date": "2018-07-01", "type": "N/A", "teams": { "in": { "id": 1139, "name": "Santa Fe", "logo": "https://media.api-sports.io/football/teams/1139.png" }, "out": { "id": 2289, "name": "Leon", "logo": "https://media.api-sports.io/football/teams/2289.png" } } }, { "date": "2015-06-11", "type": "N/A", "teams": { "in": { "id": 2289, "name": "Leon", "logo": "https://media.api-sports.io/football/teams/2289.png" }, "out": { "id": 2279, "name": "Tigres UANL", "logo": "https://media.api-sports.io/football/teams/2279.png" } } }, { "date": "2014-01-01", "type": "N/A", "teams": { "in": { "id": 2279, "name": "Tigres UANL", "logo": "https://media.api-sports.io/football/teams/2279.png" }, "out": { "id": 2289, "name": "Leon", "logo": "https://media.api-sports.io/football/teams/2289.png" } } }, { "date": "2012-01-01", "type": "N/A", "teams": { "in": { "id": 2289, "name": "Leon", "logo": "https://media.api-sports.io/football/teams/2289.png" }, "out": { "id": 1127, "name": "Deportivo Cali", "logo": "https://media.api-sports.io/football/teams/1127.png" } } }, { "date": "2011-01-01", "type": "N/A", "teams": { "in": { "id": 1127, "name": "Deportivo Cali", "logo": "https://media.api-sports.io/football/teams/1127.png" }, "out": { "id": 1126, "name": "Deportivo Pasto", "logo": "https://media.api-sports.io/football/teams/1126.png" } } }, { "date": "2020-01-01", "type": null, "teams": { "in": { "id": 1470, "name": "Cucuta", "logo": "https://media.api-sports.io/football/teams/1470.png" }, "out": { "id": 463, "name": "Aldosivi", "logo": "https://media.api-sports.io/football/teams/463.png" } } } ] } ] } ``` -------------------------------- ### Get Top Assists - PHP Request Sample Source: https://api-sports.io/documentation/football/v3/index This PHP code snippet demonstrates how to make a GET request to the /players/topassists endpoint to retrieve the top assisting players. It includes setting the league, season, and API key as parameters and headers. ```php $client = new http\Client; $request = new http\Client\Request; $request->setRequestUrl('https://v3.football.api-sports.io/players/topassists'); $request->setRequestMethod('GET'); $request->setQuery(new http\QueryString(array( 'season' => '2020', 'league' => '61' ))); $request->setHeaders(array( 'x-apisports-key' => 'XxXxXxXxXxXxXxXxXxXxXxXx' )); $client->enqueue($request)->send(); $response = $client->getResponse(); echo $response->getBody(); ``` -------------------------------- ### Get All Available Bets (Python) Source: https://api-sports.io/documentation/football/v3/index This Python snippet shows how to retrieve all available bets using the 'requests' library. It sends a GET request to the API-SPORTS Football v3 odds/bets endpoint. ```python import requests url = "https://v3.football.api-sports.io/odds/bets" headers = { 'x-apisports-key': "YOUR_API_KEY" } response = requests.get(url, headers=headers) print(response.json()) ``` -------------------------------- ### GET /fixtures/lineups Source: https://api-sports.io/documentation/football/v3/index Fetches the lineups for a specified football fixture. Requires a fixture ID as a parameter. ```APIDOC ## GET /fixtures/lineups ### Description Retrieves the starting lineups, substitutes, and coach information for a specific football match. ### Method GET ### Endpoint /v3/football/fixtures/lineups ### Parameters #### Query Parameters - **fixture** (integer) - Required - The ID of the fixture for which to retrieve lineups. ### Request Example ```json { "parameters": { "fixture": "592872" } } ``` ### Response #### Success Response (200) - **response** (array) - An array containing lineup information for each team. - **team** (object) - Information about the team. - **id** (integer) - The team's unique identifier. - **name** (string) - The name of the team. - **logo** (string) - The URL of the team's logo. - **colors** (object) - Color details for the team's kits. - **formation** (string) - The team's formation (e.g., "4-3-3"). - **startXI** (array) - An array of players in the starting eleven. - **player** (object) - Details of a player. - **id** (integer) - The player's unique identifier. - **name** (string) - The player's name. - **number** (integer) - The player's jersey number. - **pos** (string) - The player's position (e.g., "G", "D", "M", "F"). - **grid** (string) - The player's position on the field grid. - **substitutes** (array) - An array of substitute players. - **player** (object) - Details of a substitute player (same structure as startXI player). - **coach** (object) - Information about the coach. - **id** (integer) - The coach's unique identifier. - **name** (string) - The coach's name. - **photo** (string) - The URL of the coach's photo. #### Error Responses - **204** - No content found for the given fixture. - **499** - Client Closed Request. - **500** - Internal Server Error. #### Response Example ```json { "get": "fixtures/lineups", "parameters": { "fixture": "592872" }, "errors": [], "results": 2, "paging": { "current": 1, "total": 1 }, "response": [ { "team": { "id": 50, "name": "Manchester City", "logo": "https://media.api-sports.io/football/teams/50.png", "colors": { "player": { "primary": "5badff", "number": "ffffff", "border": "99ff99" }, "goalkeeper": { "primary": "99ff99", "number": "000000", "border": "99ff99" } } }, "formation": "4-3-3", "startXI": [ { "player": { "id": 617, "name": "Ederson", "number": 31, "pos": "G", "grid": "1:1" } } // ... more players ], "substitutes": [ { "player": { "id": 50828, "name": "Zack Steffen", "number": 13, "pos": "G", "grid": null } } // ... more substitutes ], "coach": { "id": 4, "name": "Guardiola", "photo": "https://media.api-sports.io/football/coachs/4.png" } } // ... lineup for the other team ] } ``` ``` -------------------------------- ### Get Fixture Statistics - API-SPORTS Football v3 Source: https://api-sports.io/documentation/football/v3/index This snippet demonstrates how to retrieve statistics for a specific football fixture using the API-SPORTS v3 API. It shows examples of fetching general statistics, including half-time data, and filtering by team or statistic type. The API requires a fixture ID and optionally accepts parameters like 'half', 'type', and 'team'. ```javascript get("https://v3.football.api-sports.io/fixtures/statistics?fixture=215662"); get("https://v3.football.api-sports.io/fixtures/statistics?fixture=215662&half=true"); get("https://v3.football.api-sports.io/fixtures/statistics?fixture=215662&type=Total Shots"); get("https://v3.football.api-sports.io/fixtures/statistics?fixture=215662&team=463"); ``` -------------------------------- ### Fetch League Data - cURL Source: https://api-sports.io/documentation/football/v3/index Demonstrates how to fetch league data using cURL, a command-line tool for transferring data. This example retrieves leagues for a specific country. ```bash curl -X GET "https://v3.football.api-sports.io/leagues?country=england" \ -H "x-apisports-key: YOUR_API_KEY" ``` -------------------------------- ### Get All Available Bets (PHP) Source: https://api-sports.io/documentation/football/v3/index This PHP snippet demonstrates fetching all available bets using cURL. It sends a GET request to the API-SPORTS Football v3 odds/bets endpoint. ```php ``` -------------------------------- ### Get Player Statistics for a Fixture and Team (PHP) Source: https://api-sports.io/documentation/football/v3/index This PHP snippet demonstrates fetching player statistics for a specific fixture and team. It requires both fixture and team IDs, sent via a GET request with the necessary API key in the header. ```php $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => "https://v3.football.api-sports.io/fixtures/players?fixture=169080&team=2284", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => [ "x-apisports-key: YOUR_API_KEY" ], ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #: " . $err; } else { echo $response; } ``` -------------------------------- ### Get All Available Bets (Ruby) Source: https://api-sports.io/documentation/football/v3/index This Ruby snippet shows how to fetch all available bets using the 'httparty' gem. It sends a GET request to the API-SPORTS Football v3 odds/bets endpoint. ```ruby require 'httparty' api_key = 'YOUR_API_KEY' url = 'https://v3.football.api-sports.io/odds/bets' response = HTTParty.get(url, headers: { 'x-apisports-key' => api_key }) puts response.parsed_response ``` -------------------------------- ### Get Venues by ID, Name, City, or Country using JavaScript Source: https://api-sports.io/documentation/football/v3/index This snippet demonstrates how to retrieve venue information from the API-SPORTS Football v3 API. It shows examples of fetching a single venue by its ID or name, and retrieving all venues based on city or country. The 'search' parameter allows for broader queries. ```javascript // Get one venue from venue {id} get("https://v3.football.api-sports.io/venues?id=556"); // Get one venue from venue {name} get("https://v3.football.api-sports.io/venues?name=Old Trafford"); // Get all venues from {city} get("https://v3.football.api-sports.io/venues?city=manchester"); // Get venues from {country} get("https://v3.football.api-sports.io/venues?country=england"); // Allows you to search for a venues in relation to a venue {name}, {city} or {country} get("https://v3.football.api-sports.io/venues?search=trafford"); get("https://v3.football.api-sports.io/venues?search=manches"); get("https://v3.football.api-sports.io/venues?search=England"); ``` -------------------------------- ### Get League Seasons Request Sample (PHP) Source: https://api-sports.io/documentation/football/v3/index This PHP code snippet demonstrates how to make a GET request to the /leagues/seasons endpoint of the API-SPORTS Football v3 API. It includes setting the request URL, method, and API key in the headers. The response body is then echoed. ```php $client = new http\Client; $request = new http\Client\Request; $request->setRequestUrl('https://v3.football.api-sports.io/leagues/seasons'); $request->setRequestMethod('GET'); $request->setHeaders(array( 'x-apisports-key' => 'XxXxXxXxXxXxXxXxXxXxXxXx' )); $client->enqueue($request)->send(); $response = $client->getResponse(); echo $response->getBody(); ``` -------------------------------- ### Get Player Statistics for a Fixture and Team (Python) Source: https://api-sports.io/documentation/football/v3/index This Python snippet demonstrates fetching player statistics for a specific fixture and team. It uses the 'requests' library to send a GET request with both fixture and team IDs as query parameters. ```python import requests url = "https://v3.football.api-sports.io/fixtures/players?fixture=169080&team=2284" headers = { 'x-apisports-key': "YOUR_API_KEY" } response = requests.get(url, headers=headers) print(response.json()) ``` -------------------------------- ### Get All Player Statistics for a Fixture (Curl) Source: https://api-sports.io/documentation/football/v3/index This Curl command demonstrates how to fetch all player statistics for a given fixture ID. It sends a GET request to the API-SPORTS v3 endpoint with the required API key. ```bash curl -X GET "https://v3.football.api-sports.io/fixtures/players?fixture=169080" \ -H "x-apisports-key: YOUR_API_KEY" ``` -------------------------------- ### GET /leagues Source: https://api-sports.io/documentation/football/v3/index Retrieves a list of available football leagues. This endpoint requires an API key for authentication. ```APIDOC ## GET /leagues ### Description Retrieves a list of available football leagues. This endpoint requires an API key for authentication. ### Method GET ### Endpoint https://v3.football.api-sports.io/leagues ### Parameters #### Headers - **x-apisports-key** (string) - Required - Your API key for authentication. ### Request Example ``` GET https://v3.football.api-sports.io/leagues Headers: x-apisports-key: XxXxXxXxXxXxXxXxXxXxXxXx ``` ### Response #### Success Response (200) - **response** (object) - Contains the list of leagues and related data. #### Response Example ```json { "get": "leagues", "parameters": {}, "errors": [], "results": 100, "paging": { "current": 1, "total": 1 }, "response": [ { "league": { "id": 1, "name": "Friendlies", "type": "Cup", "logo": "https://media.api-sports.io/football/leagues/1.png" }, "country": { "id": null, "name": null, "flag": null }, "seasons": [ { "year": 2023, "start": "2023-01-01", "end": "2023-12-31", "current": true, "has_leagues_data": true } ] } // ... more leagues ] } ``` ``` -------------------------------- ### Get All Player Statistics for a Fixture (Node.js) Source: https://api-sports.io/documentation/football/v3/index This Node.js snippet shows how to fetch all player statistics for a given fixture ID using the 'axios' library. It sends a GET request to the API-SPORTS v3 endpoint. ```javascript const axios = require('axios'); const getPlayers = async () => { try { const response = await axios.get('https://v3.football.api-sports.io/fixtures/players?fixture=169080', { headers: { 'x-apisports-key': 'YOUR_API_KEY' } }); console.log(response.data); } catch (error) { console.error(error); } }; getPlayers(); ``` -------------------------------- ### Get Player Statistics for a Fixture and Team (Node.js) Source: https://api-sports.io/documentation/football/v3/index This Node.js snippet demonstrates fetching player statistics for a specific fixture and team using 'axios'. It requires both fixture and team IDs, sent via a GET request with the API key in the header. ```javascript const axios = require('axios'); const getPlayers = async () => { try { const response = await axios.get('https://v3.football.api-sports.io/fixtures/players?fixture=169080&team=2284', { headers: { 'x-apisports-key': 'YOUR_API_KEY' } }); console.log(response.data); } catch (error) { console.error(error); } }; getPlayers(); ``` -------------------------------- ### GET /players/profiles Source: https://api-sports.io/documentation/football/v3/index Retrieves player profiles. This endpoint can be used to get a specific player's profile by ID, search for players by last name, or retrieve a paginated list of all available players. ```APIDOC ## GET /players/profiles ### Description Retrieves player profiles. This endpoint can be used to get a specific player's profile by ID, search for players by last name, or retrieve a paginated list of all available players. ### Method GET ### Endpoint https://v3.football.api-sports.io/players/profiles ### Parameters #### Query Parameters - **player** (integer) - Optional - The id of the player. - **search** (string) - Optional - >= 3 characters. The lastname of the player. - **page** (integer) - Optional - Default: 1. Use for the pagination. #### Header Parameters - **x-apisports-key** (string) - Required - Your Api-Key. ### Request Example ```json { "example": "GET https://v3.football.api-sports.io/players/profiles?player=276" } ``` ### Response #### Success Response (200) - **get** (string) - The endpoint called. - **parameters** (object) - The parameters used for the request. - **errors** (array) - An array of errors, if any. - **results** (integer) - The number of results returned. - **paging** (object) - Pagination information. - **current** (integer) - The current page number. - **total** (integer) - The total number of pages. - **response** (array) - An array of player profile objects. - **player** (object) - Player details. - **id** (integer) - Player ID. - **name** (string) - Player's full name. - **firstname** (string) - Player's first name. - **lastname** (string) - Player's last name. - **age** (integer) - Player's age. - **birth** (object) - Player's birth information. - **date** (string) - Birth date (YYYY-MM-DD). - **place** (string) - Birth place. - **country** (string) - Birth country. - **nationality** (string) - Player's nationality. - **height** (string) - Player's height. - **weight** (string) - Player's weight. - **number** (integer) - Player's jersey number. - **position** (string) - Player's position. - **photo** (string) - URL to the player's photo. #### Response Example ```json { "get": "players/profiles", "parameters": { "player": "276" }, "errors": [], "results": 1, "paging": { "current": 1, "total": 1 }, "response": [ { "player": { "id": 276, "name": "Neymar", "firstname": "Neymar", "lastname": "da Silva Santos Júnior", "age": 32, "birth": { "date": "1992-02-05", "place": "Mogi das Cruzes", "country": "Brazil" }, "nationality": "Brazil", "height": "175 cm", "weight": "68 kg", "number": 10, "position": "Attacker", "photo": "https://media.api-sports.io/football/players/276.png" } } ] } ``` ``` -------------------------------- ### Get All Available Bets (JavaScript) Source: https://api-sports.io/documentation/football/v3/index This code snippet demonstrates how to fetch all available bets from the API-SPORTS Football v3 API using JavaScript. It makes a GET request to the odds/bets endpoint without any specific filters. ```javascript get("https://v3.football.api-sports.io/odds/bets"); ``` -------------------------------- ### GET /players Source: https://api-sports.io/documentation/football/v3/index Returns the list of all available players. This endpoint uses pagination with 250 results per page. It is updated several times a week. ```APIDOC ## GET /players ### Description Returns the list of all available players. This endpoint uses pagination with 250 results per page. It is updated several times a week. ### Method GET ### Endpoint https://v3.football.api-sports.io/players ### Parameters #### Query Parameters - **page** (integer) - Optional - The page number for pagination. Defaults to the first page if not provided. #### Header Parameters - **x-apisports-key** (string) - Required - Your API Key. ### Request Example ```json { "example": "// Get the first page of players\nget(\"https://v3.football.api-sports.io/players\");\n\n// Get the second page of players\nget(\"https://v3.football.api-sports.io/players?page=2\");" } ``` ### Response #### Success Response (200) (Response structure for this endpoint is not fully detailed in the provided text, but typically includes pagination info and a list of player objects.) #### Response Example (Example response structure for this endpoint is not provided in the input text.) ``` -------------------------------- ### GET /odds/v3/list Source: https://api-sports.io/documentation/football/v3/index Retrieves a list of available odds markets and their associated values for football matches. ```APIDOC ## GET /odds/v3/list ### Description Retrieves a list of available odds markets and their associated values for football matches. ### Method GET ### Endpoint /odds/v3/list ### Parameters #### Query Parameters - **token** (string) - Required - Your API token. - **sport** (string) - Required - The sport identifier (e.g., "football"). - **region** (string) - Optional - The region for the odds (e.g., "england"). - **league** (string) - Optional - The league for the odds (e.g., "premier-league"). - **bookmaker** (string) - Optional - The bookmaker identifier. ### Request Example ```http GET /odds/v3/list?token=YOUR_API_TOKEN&sport=football®ion=england&league=premier-league ``` ### Response #### Success Response (200) - **odds_markets** (array) - A list of odds markets. - **id** (integer) - The unique identifier for the odds market. - **name** (string) - The name of the odds market (e.g., "Over/Under 2.5 Goals"). - **values** (array) - A list of possible outcomes and their odds for this market. - **value** (string or integer) - The specific outcome value (e.g., "Over 2.5", 1). - **odd** (string) - The betting odd for the outcome. #### Response Example ```json { "odds_markets": [ { "id": 23, "name": "Over/Under 2.5 Goals", "values": [ { "value": "Home/Over 2.5", "odd": "5.50" }, { "value": "Away/Over 2.5", "odd": "5.50" }, { "value": "Home/Under 2.5", "odd": "4.50" }, { "value": "Away/Under 2.5", "odd": "5.25" } ] }, { "id": 24, "name": "Results/Both Teams Score", "values": [ { "value": "Away/No", "odd": "4.40" }, { "value": "Draw/No", "odd": "6.25" }, { "value": "Home/No", "odd": "3.75" }, { "value": "Away/Yes", "odd": "6.50" }, { "value": "Draw/Yes", "odd": "4.50" }, { "value": "Home/Yes", "odd": "5.50" } ] } ] } ``` ``` -------------------------------- ### Retrieve Leagues with Mixed Parameters - JavaScript Source: https://api-sports.io/documentation/football/v3/index Demonstrates combining multiple parameters to refine league queries. Examples include filtering by season, country, and type, or by team and season, or by ID, current status, and type. ```javascript get("https://v3.football.api-sports.io/leagues?season=2019&country=england&type=league"); get("https://v3.football.api-sports.io/leagues?team=85&season=2019"); get("https://v3.football.api-sports.io/leagues?id=61¤t=true&type=league"); ``` -------------------------------- ### Get Player Statistics for a Fixture and Team (Curl) Source: https://api-sports.io/documentation/football/v3/index This Curl command shows how to retrieve player statistics for a specific fixture and team. It requires both fixture and team IDs, sent via a GET request with the API key in the header. ```bash curl -X GET "https://v3.football.api-sports.io/fixtures/players?fixture=169080&team=2284" \ -H "x-apisports-key: YOUR_API_KEY" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.