# GET /v2/leagues

Group: Discovery

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

Plans: Every plan, Free included.

## Parameters

| Name | In | Required | Description |
| --- | --- | --- | --- |
| `category` | query | no | category id from /v2/categories; use it on its own, never combined with country |
| `sport` | query | no | sport slug; must be paired with country |
| `country` | query | no | 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)
- Objects: LeagueRef (https://datasportsapi.com/markdown/reference.md#leagueref)

## 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 sport
- 404 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

Plus the common errors (https://datasportsapi.com/markdown/docs.md#errors).

## Request

cURL:

```bash
curl -H "Authorization: Bearer sk_live_…" \
    "https://api.datasportsapi.com/v2/leagues"
```

TypeScript:

```ts
const { data, meta } = await client.leagues.list();
```

Python:

```python
res = client.leagues.list()
```

Go:

```go
res, err := client.Leagues.List(ctx, &datasportsapi.LeaguesListParams{})
```

CLI:

```bash
$ dsa leagues list
```

## Example response

```json
$ 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 } }
```

---

Base URL: https://api.datasportsapi.com. Authenticate each /v2 call with the header `Authorization: Bearer <key>` (secret keys begin with `sk_live_`).
HTML: https://datasportsapi.com/docs/discovery/leagues-list/ · All docs: https://datasportsapi.com/markdown/docs.md · Data reference: https://datasportsapi.com/markdown/reference.md
