Login Get API Key
Tutorials

How to Build a League Standings Table with Form Guide and Zones

Illustration of a football league standings table with form indicators and colored zones

Learn how to fetch and display a full league standings table โ€” including last-5 form and qualification zones โ€” using Live Football API.

On this page

A basic standings table shows rank, points, and goal difference. A great one also shows recent form and highlights which teams are heading for Champions League football versus relegation. This guide shows how to build that full experience using /league_standings.

Fetching the Standings

Pass a league_id (from /leagues) to get the current table:

import requests

response = requests.get(
    'https://live-football-api.com/api/v1/league_standings',
    params={'api_key': 'YOUR_KEY', 'league_id': 'lfa-premier-league', 'lang': 'en'}
).json()

data = response['data']
table = data['standings'][0]['table']

for row in table:
    team = row['team']['name']
    print(f"{row['rank']}. {team} โ€” {row['points']} pts ({row['form']})")

Understanding the Form Field

Each row includes a form string like "WWDWL" โ€” the team's results over their last 5 matches, most recent last. This is ideal for rendering a row of colored form indicators:

function FormBadges({ form }) {
  const colors = { W: '#22c55e', D: '#9ca3af', L: '#ef4444' };
  return (
    <div style={{ display: 'flex', gap: 4 }}>
      {form.split('').map((result, i) => (
        <span key={i} style={{
          width: 20, height: 20, borderRadius: '50%',
          background: colors[result], color: 'white',
          fontSize: 12, display: 'flex', alignItems: 'center', justifyContent: 'center'
        }}>
          {result}
        </span>
      ))}
    </div>
  );
}

Highlighting Qualification and Relegation Zones

Each row's zone object tells you whether that position currently qualifies for something โ€” Champions League, relegation, and so on โ€” along with a suggested color:

{
  "rank": 1,
  "zone": { "name": "Champions League", "color": "#02206B" }
}

Use this to add a colored left-border or badge to each row without hardcoding your own qualification logic per league:

function StandingsRow({ row }) {
  const borderColor = row.zone ? row.zone.color : 'transparent';
  return (
    <tr style={{ borderLeft: `4px solid ${borderColor}` }}>
      <td>{row.rank}</td>
      <td>{row.team.name}</td>
      <td>{row.points}</td>
    </tr>
  );
}

Not every row has a zone โ€” mid-table positions typically return null, so check before rendering a badge.

Home and Away Splits

Beyond the main table, the response includes home_standings and away_standings โ€” the same table structure, filtered to home-only and away-only results. This is useful for a "home form" vs "away form" toggle in a UI:

const view = showHomeOnly ? data.home_standings : data.standings;

Handling Multi-Group Competitions

For competitions with multiple groups (like a Champions League group stage), standings is an array with one entry per group, each with its own title and table:

data.standings.forEach(group => {
  console.log(`Group: ${group.title}`);
  group.table.forEach(row => console.log(`  ${row.rank}. ${row.team.name}`));
});

Viewing Past Seasons

The available_seasons array lists which past seasons you can query, letting you build a season selector dropdown without guessing valid values:

data.available_seasons.forEach(season => {
  console.log(season); // "2024/2025", "2023/2024", ...
});

Frequently Asked Questions

Are rank, points, and other numbers returned as strings or numbers?

Numeric fields like rank, played, and points are returned as JSON numbers, not strings, so no parsing is needed before doing calculations or sorting.

What does it mean if zone is null for a team?

It means that position currently isn't associated with a qualification or relegation zone โ€” typically mid-table teams with nothing at stake in either direction.

Can I get standings split by home and away form only?

Yes, use the home_standings and away_standings fields alongside the main standings table, all returned in the same response.

Does this endpoint support competitions with group stages?

Yes, the standings array contains one entry per group when applicable, each with its own title and table.

Share this article:
โ† Back to blog