Skip to main content
Use this page to make your first requests: find the IDs you need, get a team’s next fixture and pull a league table. It takes about five minutes.
Fastest way: ask your AI. Set up your tool with Build with AI, then paste: “Read https://api.thestatsapi.com/llms.txt, then write a server-side script that prints Arsenal’s next fixture and the current Premier League table from TheStatsAPI. Read my key from the THESTATSAPI_API_KEY env var.”
To run the examples yourself: the JavaScript uses the built-in fetch in Node 18 or later (save it as a .mjs file so top-level await works), and the Python uses the requests package.
1

Get your API key

Create an account, then make a key on the API keys page. Copy it straight away: it’s only shown once.Save it as an environment variable so it stays out of your code:
2

Make your first request

Search competitions to find the Premier League’s ID.
Response (trimmed):
The best match comes first, so comp_3039 is the Premier League. Lists always return data plus a meta object for pagination.
3

Find a team ID

Search teams the same way. Add is_mens_team=true to leave out women’s teams.
Response (trimmed):
tm_9145 is Arsenal’s first team. You can also look up IDs in the ID finder in your dashboard. More in Finding IDs.
4

Get the team's next fixture

/football/matches returns the newest kickoff first. Add sort=utc_date to get the soonest first, so the first scheduled match is the next one.
Example response (trimmed):
utc_date is always UTC. For a team’s latest result, use status=finished and leave out sort. More in Fixtures and results.
5

Get the league table

Standings belong to a season. First get the competition’s current_season_id, then ask for that season’s table.
Example standings response (trimmed; your numbers will differ):
More in League tables.

Common mistakes

Next steps

Build with AI

Let Claude Code, Codex, Cursor or Lovable write the rest for you.

Finding IDs

Look up competitions, seasons, teams, players and matches.

Live matches

Show live scores and stats by polling during a match.

API reference

Every endpoint, parameter and response field.