Skip to main content
Use this page to show scores, stats and events while matches are being played.
Fastest way: ask your AI. Set up your coding tool once with Build with AI, then paste:
Prompt

How live data works

There are no webhooks, WebSockets or push messages. You poll: ask for live matches, then call the live endpoints for the matches you show. The JavaScript examples run on your server and read your key from the THESTATSAPI_API_KEY environment variable. The match IDs below were live when this page was written; use one that is live when you try it.

1. Find live matches

Response (one match, trimmed):
Response
live is null unless status is live. Just after kickoff, every field inside live can be null until the first clock update arrives. On a busy evening there can be dozens of live matches, so add per_page=100, or filter with competition_id or team_id to watch only the matches you care about.

2. Poll live stats

Response (trimmed):
Response
Which stats appear depends on the match. Check that a key exists before you read it.

3. Poll the live timeline

Filter with event_type (e.g. goal, penalty_scored, yellow_card, substitution), period or team_id.
Penalty goals are penalty_scored events, not goal. To get every goal, ask for both: event_type=goal,penalty_scored. Penalty shoot-out kicks are also penalty_scored, with "period": "penalties", so leave those out when you count match goals.
Response (trimmed):
Response
Stoppage time is kept separate: 45+3’ comes back as "minute": 45, "extra_time": 3.

4. Live player stats

/live-player-stats returns one entry per player with rating, minutes, passing, shooting (including xG), duels and defending. Touches, fouls and cards are under general. Add player_ids=pl_...,pl_... to get only some players.
One entry (trimmed):
Response

How often to poll

  • Every 30 seconds is enough. Live stats responses can be cached for up to 30 seconds, so polling faster doesn’t get you fresher data.
  • Only poll matches that are live and on screen. Every call counts against your rate limits and quota.
  • On 429, wait the number of seconds in the Retry-After header before trying again.
  • Refresh the live match list every minute or two to pick up kickoffs and full-time whistles.

Before kickoff and after full time

The 409 for a match that isn’t live looks like this:
When you get it after a match, switch to the post-match endpoints: match stats, player stats and timeline.
Lineups come before kickoff: Get match lineups returns a predicted XI, then the official team sheet once it’s announced (about an hour before kickoff). Check type and confirmed to know which you have.

API reference