League directory
GET
/
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
categoryquery
category id from /v2/categories; use it on its own, never combined with country
sportquery
sport slug; must be paired with country
countryquery
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 sport404not_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=503upstream_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 } }