Before you can show scores, standings, or squads, most football apps need a way to let users pick a league — whether that's a dropdown selector, a country-filtered list, or a "favorite leagues" screen. This guide shows you how to fetch and organize league data using Live Football API.
Why League Data Matters
League listings are typically the starting point for several common features:
- League selector dropdowns — letting users choose which competition to follow
- Country-based navigation — grouping competitions the way fans naturally browse them
- Coverage pages — showing which leagues and countries your app supports
- Onboarding flows — asking new users to pick their favorite leagues on first launch
Fetching All Available Leagues
The /leagues endpoint returns every available league, grouped by country and sorted alphabetically.
import requests
response = requests.get(
'https://live-football-api.com/api/v1/leagues',
params={'api_key': 'YOUR_KEY', 'lang': 'en'}
).json()
data = response['data']
print(f"Total countries: {data['total_countries']}")
for country in data['data']:
print(f"\n{country['country']}")
for league in country['leagues']:
print(f" - {league['name']} (ID: {league['id']})")
The same call in JavaScript:
const res = await fetch(
'https://live-football-api.com/api/v1/leagues' +
'?api_key=YOUR_KEY&lang=en'
);
const result = await res.json();
const data = result.data;
data.data.forEach(country => {
console.log(country.country);
country.leagues.forEach(league => {
console.log(` - ${league.name} (ID: ${league.id})`);
});
});
Filtering Leagues by Country
Since the response is already grouped by country, filtering to a single country is just a matter of finding the matching entry client-side — no extra API call needed:
const englandLeagues = data.data.find(c => c.country === 'England');
console.log(englandLeagues.leagues);
Fetching a Single League's Details
Once you have a league_id (from the /leagues response), use /league to get detailed information about that specific competition, including season and team data.
import requests
response = requests.get(
'https://live-football-api.com/api/v1/league',
params={'api_key': 'YOUR_KEY', 'league_id': 'lfa-premier-league', 'lang': 'en'}
).json()
print(response['data'])
Building a League Selector Dropdown
A common pattern is to fetch /leagues once on app load, cache it locally, and use it to populate a searchable dropdown or accordion grouped by country. Since league lists don't change often, this single call can typically be cached for a day or more to save credits.
Combining Leagues with Standings
Once a user selects a league from the list, you can pass its league_id straight into /league_standings to show the live table — connecting the browsing experience directly to the data covered in our live scores guide.
Frequently Asked Questions
How many leagues and countries are covered?
Live Football API covers 50+ leagues and tournaments across 45+ countries, including major competitions like the Premier League, La Liga, Serie A, Bundesliga, and the Champions League.
How often does the leagues list change?
League listings are relatively stable and change infrequently (mainly at the start of new seasons), so this endpoint is a good candidate for local caching to reduce credit usage.
Can I get leagues in a language other than English?
Yes, the lang parameter supports English, Turkish, German, and Russian.
Does fetching league details cost more credits than fetching the full list?
No, both /leagues and /league cost the standard 1 credit per call.