Football xG (Expected Goals) API
Access expected goals (xG) — per match, per team, and per shot — to measure underlying performance beyond the scoreline.
Quick answer
The football xG API returns expected goals values per team and per shot for covered matches, letting you quantify chance quality, spot over- and under-performance, and feed predictive models.
GET /football/matches/{match_id}/statsExample request
const res = await fetch(
"https://api.thestatsapi.com/api/football/matches/{match_id}/stats",
{ headers: { Authorization: "Bearer YOUR_API_KEY" } }
);
const data = await res.json();
console.log(data);{
"data": {
"match_id": "mt_10477",
"home": { "team": "Liverpool", "goals": 3, "xg": 2.41 },
"away": { "team": "Leicester City", "goals": 1, "xg": 0.88 },
"shots": [
{ "team": "Liverpool", "minute": 23, "xg": 0.34, "result": "goal" },
{ "team": "Liverpool", "minute": 41, "xg": 0.07, "result": "saved" }
]
}
}Key response fields
xg (team)Total expected goals for the team in the match.
shots[].xgExpected goals value for each individual shot.
resultOutcome of the shot (goal, saved, missed, blocked).
goalsActual goals, to compare against xG.
What you can build with the Football xG API
The Football xG API is part of TheStatsAPI, a single REST API covering 1,000+ football competitions with fixtures, results, standings, player and match stats, odds, and xG. Plans start at $50/month with a 7-day free trial and every endpoint included.
Frequently Asked Questions
Which competitions have xG?
xG is available for the majority of top-tier competitions. Check the xG column on the coverage page for specifics.
Do you provide per-shot xG?
Yes, where available, each shot includes an xg value and result so you can rebuild shot maps.
Can I use xG with the Poisson predictor?
Yes. Feed team xG into our free Poisson score predictor to estimate scoreline probabilities.
Simple, Transparent Pricing
Every plan includes stats, odds, xG, history, and every documented endpoint.
Starter
For prototypes, side projects, and early products
Included in every plan:
- All football data endpoints included
- Pre-match & live odds endpoints
- Bet365, Pinnacle, Betfair Exchange & Kambi odds
- 1X2, Asian handicap, totals, BTTS, DNB & corners
- Fixtures, results, match stats, teams & players
- xG, player season stats & team stats
- 10 years of historical match data
- Build with AI
- 80 competitions by default, up to 1,196 on request
- 100,000 requests/month
- 120 requests/min
- Email & chat support
Growth
For production apps with steady traffic
Everything in Starter, plus:
- 500,000 requests/month
- 300 requests/min
- Priority support for production teams
Scale
For high-volume, production-grade usage
Everything in Growth, upgraded to:
- 5,000,000 requests/month
- 1,000 requests/min
- Dedicated support & SLA
Build with the Football xG API today
Start a 7-day free trial. Every endpoint and competition is included on every plan.
Get your API key