Skip to content

Livematches in play

Demo: Matchboard, opens in a new tab

Football · Spain · Tier 1

La Liga API with every season since 1969/70

A La Liga API for Spain's top flight: live scores, fixtures, the table, line-ups, statistics and transfers on league id 4408, with every season back to 1969/70. The API keeps the league's own spelling, LaLiga, and answers in the same JSON as every other football competition.

  • 58 seasons since 1969/70
  • 20 clubs · 380 matches a season
  • League id 4408
  • Head-to-head records on every plan

LaLiga

GET /v2/leagues/4408

League id
4408
Category
Spain
Tier
1
Archive
58 seasons since 1969/70
Teams
20 clubs
Matches
380 matches a season
Division below
LaLiga 2
Live channel
league:4408

In the data

The La Liga in the API

What league id 4408 holds, and how its seasons are laid out.

LaLiga, the division below and the cups

League id 4408 is the top flight. Its league card names LaLiga 2 in lowerDivisions, while the Copa del Rey and the Supercopa de España are competitions of their own, each with an id and its own seasons, so a Spanish football app runs on a handful of ids rather than one. /seasons lists every LaLiga season from 1969/70 to the current one, newest first.

Ties settled head to head

In Spain, clubs level on points are separated by their results against each other before goal difference, so a LaLiga table cannot be rebuilt from points and goals alone. Take the order from /standings, which serves the table as the source publishes it, with the source's tie-break text in tieBreakRule where it gives one, and show the meetings behind it with /v2/fixtures/{id}/h2h.

Before and during the big matches

Ahead of a Clásico or a Madrid derby, /h2h sums up both clubs' recent record against each other, /h2h/fixtures lists the meetings, and /form and /streaks add the run each side is on; odds join from Pro. During the match, line-ups come with each player's rating, and the shot map, momentum and heat maps follow from Pro, as for every top league.

First request

The La Liga in three calls

Every call starts from the league id, 4408. The seasons list gives the season ids, newest first, and the season id is what the tables, rounds, leaderboards and statistics ask for.

The answers use the usual { data, meta } envelope and the same field names as every other football competition, so the code works unchanged for the next league you add.

# Every season, newest first, with its season id
curl "https://api.datasportsapi.com/v2/leagues/4408/seasons" \
  -H "Authorization: Bearer $DATASPORTSAPI_API_KEY"

# The table, as the source publishes it
curl "https://api.datasportsapi.com/v2/leagues/4408/standings?season={seasonId}" \
  -H "Authorization: Bearer $DATASPORTSAPI_API_KEY"

# The biggest moves into and out of LaLiga
curl "https://api.datasportsapi.com/v2/transfers?league=4408&sort=fee" \
  -H "Authorization: Bearer $DATASPORTSAPI_API_KEY"
GET /v2/leagues/4408 · trimmed
{ "data": {
    "id": 4408, "name": "LaLiga", "sport": "football",
    "category": "Spain", "country": { "code": "ES", "name": "Spain" },
    "tier": 1, "gender": "male",
    "lowerDivisions": [ { "name": "LaLiga 2", … } ],
    …
} }

History

How much of the La Liga each plan reads

The archive goes back to 1969/70. Each plan reads back a set time from today; nothing live or upcoming is ever held back.

TopicHistoryWhat it covers of the La Liga
FreeLast 7 daysLive and upcoming matches, the table and statistics of a season still being played, and finished matches from the last 7 days.
StarterLast 30 daysLive and upcoming matches, the table and statistics of a season still being played, and finished matches from the last 30 days.
ProLast 6 monthsLive and upcoming matches, the table and statistics of a season still being played, and finished matches from the last 6 months.
BusinessLast 12 monthsLive and upcoming matches, the table and statistics of a season still being played, and finished matches from the last 12 months.
EnterpriseFull historyThe whole archive: 58 seasons since 1969/70.

Questions

La Liga API, answered

Anything else? The full FAQ covers quota, plans and the data in general.

Is it La Liga or LaLiga in the API?

The API returns the league's own spelling, LaLiga, as name. Whatever spelling your users type, the safest way to address it is the id, 4408, which never changes.

Can I show the head-to-head record before El Clásico?

Yes, on every plan. Pass the fixture id to /v2/fixtures/{id}/h2h for the clubs' wins, draws and losses over their recent meetings and to /v2/fixtures/{id}/h2h/fixtures for the matches themselves. /form and /streaks add the run each side is on.

Does it include the Copa del Rey and LaLiga 2?

Yes, as competitions of their own. LaLiga 2 is named in the league card's lowerDivisions, with its id; the Copa del Rey and the Supercopa de España (from 2008) have their own ids and seasons, and their knockout rounds come as a bracket from /cup-trees.

How far back does La Liga data go?

To 1969/70: the archive holds 58 seasons of the La Liga. How far back a key can read is set by its plan, counted back from today: Free 7 days, Starter 30 days, Pro 6 months, Business 12 months, and Enterprise the whole archive. Live and upcoming matches, and the table and statistics of a season still being played, are open on every plan.

Can I follow La Liga matches live on the free plan?

Yes. Live and upcoming matches are never held back by a plan, so a Free key follows every La Liga match in play through /v2/livescores or /v2/fixtures/{id}, with score, status and clock current to the second, within the plan's request quota. On Business and Enterprise, the WebSocket channel league:4408 pushes every change instead.

Keep reading

Other competitions

Everything in the football data Sports statistics API Live scores API

Build on the La Liga today.

1,000 free requests a day during the beta. No card, no sales call.