# GET /v2/teams/{id}/leagues

Group: Teams

All competitions the team takes part in now or has taken part in before: domestic league, cups, European competitions and friendly tournaments.

Plans: Every plan, Free included.

Note: Use a returned league id with /v2/leagues/{id}/seasons and the other season endpoints. Players do not need this step, as /v2/players/{id}/seasons already returns their leagues together with the seasons. The array is empty when the source lists no competitions.

## Parameters

| Name | In | Required | Description |
| --- | --- | --- | --- |
| `id` | path | yes | DataSportsAPI team id, a positive integer |

## Response

- `data`: `LeagueRef[]`
- `meta`: count
- Objects: LeagueRef (https://datasportsapi.com/markdown/reference.md#leagueref)

## Errors

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/teams/{id}/leagues"
```

TypeScript:

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

Python:

```python
res = client.teams.leagues(id)
```

Go:

```go
res, err := client.Teams.Leagues(ctx, id)
```

CLI:

```bash
$ dsa teams leagues <id>
```

## Example response

```json
{ "data": [ { "id": 195828, "name": "Premier League", "slug": "premier-league", "sport": "football", "category": "England",
                "country": { "code": "EN", "name": "England" }, "image": "https://cdn.datasportsapi.com/v2/leagues/195828/logo" },
    { "id": 195841, "name": "EFL Cup", … }, { "id": 195840, "name": "FA Cup", … },
    { "id": 195900, "name": "UEFA Champions League", "category": "Europe", "country": null, … },
    { "id": 196215, "name": "Emirates Cup", … }, … ],
  "meta": { "count": 9 } }
```

---

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/teams/leagues/ · All docs: https://datasportsapi.com/markdown/docs.md · Data reference: https://datasportsapi.com/markdown/reference.md
