DiscoveryEndpoint 89 of 116
League directory
https://api.datasportsapi.com/
- Plan
- All plans
- Auth
Bearer dsa_live_…- Parameters
- 0 required · 3 optional
- Returns
LeagueRef[]
Directory of leagues: all leagues within a category, or all leagues of a given sport in a given country.
01Parameters
categoryqueryOptionalcategory id from /v2/categories; use it on its own, never combined with country
sportqueryOptionalsport slug; must be paired with country
countryqueryOptionalCountry.code value, two letters (EN, ES, US, …), case-insensitive; only valid together with sport
02Request
The same call from the command line and each SDK. The SDK lines assume a client created with your key; left out, it is read from DATASPORTSAPI_API_KEY. Installing a client: SDKs & CLI.
curl -H "Authorization: Bearer dsa_live_…" \
"https://api.datasportsapi.com/v2/leagues"03Response
The top-level keys of the JSON body. Each object links to its full shape in the data reference.
dataLeagueRef[]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)
$ curl -H "Authorization: Bearer dsa_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 } }04Errors
- 400
bad_requestone of: no category and no sport + country pair; category sent together with country; a country code that is not two letters; an unrecognised sport
- 404
not_supportedthe 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_unavailableevery category list for the country failed to load
unauthorized429rate_limited429quota_exceeded500internal_errorEvery error code