How IDs work
IDs are strings with a prefix that tells you what they point to. You look them up by name with the requests below, then pass them to other endpoints.Just need one ID? Use the ID finder in your dashboard (you need to be logged in).
THESTATSAPI_API_KEY environment variable.
Find a competition
Search by name. The best match comes first. Addsort=name if you want A to Z instead.
Response
country_code=GB-ENG&type=leaguelists English leagues.GBreturns every UK nation;GB-ENG,GB-SCT,GB-WLSandGB-NIRreturn one. Other countries use codes such asDEorES.country=Spainmatches the country name.
Find the current season and past seasons
Fetch the competition to getcurrent_season_id.
Response
is_current: true.
Response
season_id with a different competition_id, you get a 400 error: “season_id does not belong to competition_id”.
Find a team (men’s or women’s)
Search by name. A club’s men’s and women’s teams often share a name, so checkis_mens_team.
Response
is_mens_team=true (men) or is_mens_team=false (women). On a team, is_mens_team is null when it isn’t known.
/football/teams?competition_id=comp_3039&season_id=sn_8406098 returns the 20 Premier League teams.
Find a player
Search needs at least 3 characters. It ignores case and accents, soodegaard finds “Ødegaard”.
Response
/football/players?team_id=tm_9145lists a team’s current players. Addposition=F(orG,D,M) to narrow it./football/teams/tm_9145/playersreturns the squad with extra profile fields./football/players?player_ids=pl_45126714,pl_29627593fetches several players in one call.
Find a match
Match IDs come from/football/matches. Filter by team, competition, season, date or status. For example, a team’s next fixture: