Skip to content
datasportsAPI

DiscoveryLeague directory

Documentation

/

Type to filter the docs by title or path.

DiscoveryEndpoint 89 of 116

League directory

GET

/v2/leagues

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

  • categoryqueryOptional

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

  • sportqueryOptional

    sport slug; must be paired with country

  • countryqueryOptional

    Country.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.

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)
ObjectsLeagueRef
Example call and response
$ 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

  • 400bad_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 sport

  • 404not_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 key can also meet401unauthorized429rate_limited429quota_exceeded500internal_errorEvery error code