DEV Community

Ken-Mutisya
Ken-Mutisya

Posted on

Nottingham Forest are 17th. Their expected points say 6th. Pulling xG tables from FotMob's JSON

Eleven games into the Premier League season, Nottingham Forest have 9 points and sit 17th. On the chances they have created and conceded, a team like that would expect about 17.7 points, which would put them 6th.

That gap between points and expected points (xPts) is one of the most useful numbers in football betting. Over a season, results drift back towards the underlying chances. Teams far above their xPts tend to cool off, and teams far below tend to pick up. Most sites show xG per match, but the expected-points table is harder to find in a form you can script.

FotMob has one, in plain JSON, with no key.

The endpoint

Every league page on FotMob loads this:

GET https://www.fotmob.com/api/data/leagues?id=47
Enter fullscreen mode Exit fullscreen mode

47 is the Premier League. LaLiga is 87, Serie A 55, Bundesliga 54, Ligue 1 53, MLS 130. Add &season=2025%2F2026 for a past season.

The response holds the fixtures, the stat leaderboards and the league table. The table comes in five views: all, home, away, form and xg. The xg rows carry xg, xgConceded, xPoints and xPosition for every team.

Ten lines of JavaScript

const res = await fetch('https://www.fotmob.com/api/data/leagues?id=47', {
  headers: { 'User-Agent': 'Mozilla/5.0' },
});
const league = await res.json();
const { all, xg } = league.table[0].data.table;
const realPos = new Map(all.map((t) => [t.id, t.idx]));

const rows = xg.map((t) => ({
  team: t.name,
  pts: t.pts,
  xPts: +t.xPoints.toFixed(1),
  gap: +(t.pts - t.xPoints).toFixed(1),
  pos: realPos.get(t.id),
  xPos: t.xPosition,
}));
console.table(rows.sort((a, b) => a.gap - b.gap).slice(0, 5));
Enter fullscreen mode Exit fullscreen mode

Output on November 24:

team pts xPts gap pos xPos
Nottingham Forest 9 17.7 -8.7 17 6
Sunderland 9 15.3 -6.3 18 10
Manchester United 8 13.1 -5.1 19 15
Fulham 11 14.6 -3.6 15 11
Crystal Palace 7 10.4 -3.4 20 20

Three of the bottom five are there because results have gone against them, not because the chances have.

The same view across the top five leagues

Running it for all five leagues, the biggest gaps either way:

Running hot (points above xPts)

team league pts xPts gap
Lazio Serie A 32 19.1 +12.9
Real Betis LaLiga 27 17.1 +9.9
Atlético Madrid LaLiga 31 23.4 +7.6
Milan Serie A 27 19.6 +7.4
Borussia Dortmund Bundesliga 24 16.8 +7.2

Running cold (points below xPts)

team league pts xPts gap
Le Havre Ligue 1 2 11.8 -9.8
Fiorentina Serie A 9 17.9 -8.9
Nottingham Forest Premier League 9 17.7 -8.7
Villarreal LaLiga 15 22.9 -7.9
Monza Serie A 10 17.3 -7.3

Lazio top Serie A with the seventh-best underlying numbers. Bayern are second in the Bundesliga but first on xPts, with 32.3 xG against 9.8 conceded.

Caveats

  • Eleven or twelve games is a small sample. Finishing and goalkeeping skill are real, and some teams beat their xG for years.
  • xPts uses FotMob's own xG model. Understat, Opta and StatsBomb numbers will differ a little.
  • The endpoint is undocumented. Send a normal User-Agent, cache what you fetch, and don't hammer it.

Going further

The same response links to about 40 player stat lists (xG, xA, xGOT, per 90) under stats.players[].fetchAllUrl. Per-match xG and full shot maps come from /api/data/matchDetails?matchId=....

I wrapped all three (xG tables, player xG/xA and match xG with shot maps, for 40+ leagues and past seasons) into an Apify actor, Football xG Stats, so it can run on a schedule and export to CSV or a spreadsheet. The same batch has four more for bettors:

But the snippet above is all you need for the xPts table. Which team do you think is most likely to keep beating its numbers?

Top comments (0)