Competitions
Get a competition
Returns one competition with its current_season_id and flags for which data it has (team stats, player stats, odds, xG). Use current_season_id to fetch this season’s matches, standings and stats.
Example: GET /football/competitions/comp_3039
GET
/
football
/
competitions
/
{competition_id}
Get a competition
curl --request GET \
--url https://api.thestatsapi.com/api/football/competitions/{competition_id} \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.thestatsapi.com/api/football/competitions/{competition_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.thestatsapi.com/api/football/competitions/{competition_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"data": {
"id": "comp_3039",
"name": "Premier League",
"country": "England",
"country_code": "GB",
"subdivision_code": "GB-ENG",
"confederation": null,
"type": "league",
"has_team_stats": true,
"has_player_stats": true,
"odds_available": true,
"live_odds_available": false,
"xg_available": true,
"current_season_id": "sn_8406098",
"total_teams": 20
}
}Read
current_season_id from here instead of hard-coding a season. See Finding IDs.Authorizations
Your API key, sent as Authorization: Bearer YOUR_API_KEY. Get one at https://www.thestatsapi.com/api-keys
Path Parameters
⌘I
Get a competition
curl --request GET \
--url https://api.thestatsapi.com/api/football/competitions/{competition_id} \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.thestatsapi.com/api/football/competitions/{competition_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.thestatsapi.com/api/football/competitions/{competition_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"data": {
"id": "comp_3039",
"name": "Premier League",
"country": "England",
"country_code": "GB",
"subdivision_code": "GB-ENG",
"confederation": null,
"type": "league",
"has_team_stats": true,
"has_player_stats": true,
"odds_available": true,
"live_odds_available": false,
"xg_available": true,
"current_season_id": "sn_8406098",
"total_teams": 20
}
}