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
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
3. Poll the live timeline
Filter withevent_type (e.g. goal, penalty_scored, yellow_card, substitution), period or team_id.
Response
"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.
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 theRetry-Afterheader 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:
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.