API-Football¶
Summary¶
API-Football (operated by api-sports.io) is one of the most comprehensive football data APIs available, covering over 1,200 competitions worldwide. It provides fixtures, match results, player and team statistics, lineups, odds, and live scores via a RESTful API. It is the primary source for match-level event data (goals, cards, shots, corners) and is commonly paired with odds APIs for betting model development.
Pricing starts at $19/month. The standard plan covers all competitions and all endpoints including fixtures, statistics, and odds. Historical data access depends on the plan tier. The API is widely used in betting model development because it combines match event data with betting odds in a single service.
Key Endpoints¶
| Endpoint | Data Provided |
|---|---|
/fixtures |
Match dates, times, venues, referee, weather |
/fixtures/statistics |
Shots, corners, fouls, cards, possession, xG |
/fixtures/lineups |
Starting XI, substitutes, formation |
/players |
Player metadata, injury status |
/odds |
Pre-game odds from multiple bookmakers |
/predictions |
Model-generated probabilities (own model) |
/standings |
League tables, form, home/away splits |
Data Coverage¶
- 1,200+ competitions across 150+ countries
- Major leagues: Premier League, La Liga, Serie A, Bundesliga, Ligue 1, Champions League, Europa League
- Lower divisions for major countries (England to League 2, etc.)
- International: World Cup, Euros, Copa America
- American sports: NFL, NBA, MLB, NHL also available under api-sports.io brand
Pricing¶
- Starter: From $19/month — all competitions, core endpoints
- Pro: Higher request limits, faster data refresh, extended history
- Enterprise: Custom limits, dedicated support, bulk historical data
- All plans include all competitions and all endpoints
- Request limits are per-minute and per-month depending on plan
Key Features for Betting Models¶
- Match statistics are provided per fixture — shots on target, total shots, corners, fouls, yellow/red cards, possession. These feed directly into xG estimation models.
- Odds endpoint returns pre-game moneyline, totals, Asian handicap from multiple bookmakers — useful for market efficiency analysis and finding value vs. the model's implied probabilities.
- Predictions endpoint provides the provider's own model probabilities — useful as a baseline comparison for the client's model.
- Head-to-head history endpoint provides historical match results between two teams — useful for ELO-style rating updates.
Python Integration¶
import requests
API_KEY = "your-api-key"
HEADERS = {"x-apisports-key": API_KEY}
# Get upcoming Premier League fixtures
url = "https://v3.football.api-sports.io/fixtures"
params = {
"league": 39, # Premier League league ID
"season": 2024,
"from": "2024-09-01",
"to": "2024-09-05",
}
response = requests.get(url, params=params, headers=HEADERS)
fixtures = response.json()["response"]
for f in fixtures[:3]:
print(f"{f['teams']['home']['name']} vs {f['teams']['away']['name']}")
# Get match statistics
stats_url = "https://v3.football.api-sports.io/fixtures/statistics"
params = {"fixture": FIXTURE_ID}
stats = requests.get(stats_url, params=params, headers=HEADERS).json()
Notes¶
- The statistics endpoint provides aggregated match stats (team totals), not per-shot event data — xG must be estimated from these totals rather than built from shot-level data
- Odds are available for major leagues; lower divisions may lack bookmaker coverage
- The predictions endpoint uses API-Football's own model — not transparent or customizable
- Rate limits are strict on lower-tier plans; caching responses is essential
- Historical data depth varies: top leagues go back several seasons; lower leagues may have limited history
- Pair with The Odds API or a dedicated odds API if you need odds from specific sharp bookmakers (Pinnacle, etc.)