Competitions
List competitions
Returns football competitions (leagues, cups and international tournaments), 20 per page. Use it to find a competition_id by name or country. With search, the best match comes first.
Examples
- Find the Premier League:
GET /football/competitions?search=Premier - English leagues:
GET /football/competitions?country_code=GB-ENG&type=league
GET
/
football
/
competitions
List competitions
curl --request GET \
--url https://api.thestatsapi.com/api/football/competitions \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.thestatsapi.com/api/football/competitions', 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"
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
}
],
"meta": {
"page": 1,
"per_page": 20,
"total": 100,
"total_pages": 5
}
}Use it to find a
competition_id, then pass it to matches, teams and standings. More ways to look up IDs: Finding IDs.Authorizations
Your API key, sent as Authorization: Bearer YOUR_API_KEY. Get one at https://www.thestatsapi.com/api-keys
Query Parameters
⌘I
List competitions
curl --request GET \
--url https://api.thestatsapi.com/api/football/competitions \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.thestatsapi.com/api/football/competitions', 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"
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
}
],
"meta": {
"page": 1,
"per_page": 20,
"total": 100,
"total_pages": 5
}
}