API-Football

Overview

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.

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 Provider's own model probabilities
/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
  • International: World Cup, Euros, Copa America
  • American sports: NFL, NBA, MLB, NHL also available

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, "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
  • 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