Skip to content

Livematches in play

Demo: Matchboard, opens in a new tab
Docs v2

Discovery

League directory

GET

/v2/leagues

All plans

View as MarkdownTry in Playground →

Directory of leagues: all leagues within a category, or all leagues of a given sport in a given country.

Parameters

category

query

category id from /v2/categories; use it on its own, never combined with country

sport

query

sport slug; must be paired with country

country

query

Country.code value, two letters (EN, ES, US, …), case-insensitive; only valid together with sport

Response

data
LeagueRef[]
meta
for a category query, category and count; for a sport + country query, sport, country, categoryIds (the country’s categories), count and complete (false if at least one category’s list was temporarily unavailable — try again shortly)
errors
400 bad_request — one of: no category and no sport + country pair; category sent together with country; a country code that is not two letters; an unrecognised sport404 not_supported — the category or sport belongs to a race sport (motorsport, cycling), which uses series instead of leagues; the message points to /v2/series?category=503 upstream_unavailable — every category list for the country failed to load

Any /v2 call can also come back with one of the common errors.

Example
$ curl -H "Authorization: Bearer sk_live_…" "https://api.datasportsapi.com/v2/leagues?sport=football&country=EN"

{ "data": [ { "id": 195828, "name": "Premier League", "slug": "premier-league", "sport": "football", "category": "England",
                "country": { "code": "EN", "name": "England" }, "image": "…" },
    { "id": 195836, "name": "Championship", … }, { "id": 195840, "name": "FA Cup", … }, … ],
  "meta": { "sport": "football", "country": "EN", "categoryIds": [456], "count": 41, "complete": true } }