Football Stats API for Betting Analytics
10 years of football match data for betting models: team stats, player metrics, and match history. 80 competitions, clean JSON, from $50/month.
Prediction models are only as good as the data feeding them. If you are building betting analytics tools, ELO ratings, or expected goals models, you need historical match data that is deep, consistent, and structured for programmatic consumption. TheStatsAPI provides 10 years of football statistics across 80 competitions, with access to up to 1,196 competitions available on request - the kind of dataset that makes the difference between a model that works and one that guesses.
Why Data Quality Matters for Betting Models
Garbage in, garbage out. It is the oldest rule in data science and it applies directly to football prediction models.
If your match data has missing fixtures, inconsistent team IDs across seasons, or gaps in player statistics, your model inherits those flaws. Every missing data point introduces noise. Every inconsistency creates a feature your model learns incorrectly.
TheStatsAPI provides verified, structured data with consistent identifiers across seasons and competitions. Teams, players, and competitions maintain stable IDs whether you are querying the 2005-2006 season or yesterday's results. That consistency is the foundation reliable models require.
Available Data for Analytics
TheStatsAPI gives you multiple layers of data to build on:
- Match results - final scores, dates, home/away designation, competition context, and season identifiers for every fixture across 80 competitions (with up to 1,196 available on request)
- Team stats per match - shots, shots on target, possession, fouls, corners, and other match-level team metrics. This is the raw material for expected goals models and team strength ratings
- Player-level statistics - goals, assists, appearances, minutes, cards, and shooting data for 84,000+ players. Essential for player-based prediction features
- 10 years of history - enough depth to train models on long-term trends, not just recent form. Most competing APIs cap history at 5-10 seasons unless you pay enterprise rates
Endpoint Walkthrough
Two endpoints handle the bulk of data collection for betting analytics.
Bulk Match Retrieval by Season
GET https://api.thestatsapi.com/api/football/matches?competition_id=comp_3039&season_id=sn_6125938
Returns all matches for a given competition and season. Use this to backfill your database with historical results. Paginate through all results for a competition to build a comprehensive dataset.
This is how you populate your training data. Fetch all matches for a competition across all seasons and you have decades of structured results ready for analysis.
Per-Match Statistics
GET https://api.thestatsapi.com/api/football/matches/{id}/stats
Returns detailed team-level statistics for a specific match - shots, possession, corners, fouls, and more. Use this to enrich your match records with the features your model needs beyond raw scores.
Sample response:
{
"data": {
"match_id": 56789,
"home_team": {
"shots": 15,
"shots_on_target": 7,
"possession": 58.3,
"corners": 8,
"fouls": 11
},
"away_team": {
"shots": 9,
"shots_on_target": 3,
"possession": 41.7,
"corners": 3,
"fouls": 14
}
}
}
Odds Data
TheStatsAPI includes pre-match and live odds from Bet365, Pinnacle, Betfair Exchange, and Kambi operators - covering 1X2, Asian handicap, over/under goals, corners, both teams to score, and draw no bet markets. Opening and last-seen lines are available where prices were captured or stored, making it straightforward to calculate closing line value for model validation.
For prediction models that forecast outcomes before kick-off, having Pinnacle last-seen prices alongside historical match statistics in the same API removes the need to stitch data from multiple providers. See the Football Odds API, historical odds, and closing odds pages for full market and bookmaker coverage details.
Code Example: Build a Dataset with Python and pandas
import requests
import pandas as pd
API_KEY = "your_api_key"
BASE_URL = "https://api.thestatsapi.com/api"
headers = {"Authorization": f"Bearer {API_KEY}"}
# Fetch all finished Premier League matches
COMPETITION_ID = "comp_3039" # Premier League
all_matches = []
page = 1
while True:
response = requests.get(
f"{BASE_URL}/football/matches",
headers=headers,
params={
"competition_id": COMPETITION_ID,
"status": "finished",
"page": page,
"per_page": 100
}
)
data = response.json()
all_matches.extend(data["data"])
if page >= data["meta"]["total_pages"]:
break
page += 1
# Load into a DataFrame for analysis
df = pd.DataFrame(all_matches)
df["home_team_name"] = df["home_team"].apply(lambda x: x["name"])
df["away_team_name"] = df["away_team"].apply(lambda x: x["name"])
df["home_score"] = df["score"].apply(lambda x: x.get("home"))
df["away_score"] = df["score"].apply(lambda x: x.get("away"))
print(f"Total matches loaded: {len(df)}")
print(df[["utc_date", "home_team_name", "away_team_name", "home_score", "away_score"]].head(10))
Three seasons of Premier League data in 15 lines of Python. From here, enrich each match with per-match stats, build features, and train your model.
Pricing
The Starter plan at $50/month gives you 100,000 requests - enough to backfill several leagues of historical data and maintain ongoing updates. For large-scale data collection across dozens of leagues and seasons, the Growth plan at $129/month provides 500,000 requests with a higher rate limit of 60 requests per minute.
| Plan | Price | Requests/month | Rate Limit |
|---|---|---|---|
| Starter | $50/mo | 100,000 | 30/min |
| Growth | $129/mo | 500,000 | 60/min |
| Scale | $379/mo | 5,000,000 | 300/min |
Every plan includes a 7-day free trial and access to every endpoint. Start building your dataset today.
FAQ
How far back does the historical data go?
10 years. You can access match results, team statistics, and player data going back 10 years across major competitions. This depth is critical for training robust prediction models that capture long-term trends, not just recent form.
Does the API include odds data?
Yes. TheStatsAPI includes pre-match and live odds from Bet365, Pinnacle, Betfair Exchange, and Kambi. Opening and last-seen lines are available where prices were captured or stored, covering markets including 1X2, Asian handicap, over/under goals, corners, BTTS, and draw no bet. See the Football Odds API page for full details.
What about rate limits when doing bulk historical data collection?
The Starter plan allows 30 requests per minute, which is sufficient for methodical backfilling. The Growth plan increases this to 60/min, and the Scale plan provides 300/min for heavy data collection. For a one-time historical backfill, even the Starter rate limit lets you pull thousands of matches per hour.
Can I use this data in a commercial betting analytics product?
Yes. All plans support commercial use. There are no separate licensing fees for using the data in analytics tools, prediction platforms, or tipster services. Your plan's request limits are the only constraint.
Ready to Power Your Sports App?
Start your 7-day free trial. All endpoints included on every plan.