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

Group: Leagues

Season team leaderboards: the top teams per statistic (average rating, goals scored, clean sheets, possession, …), paged like top-players.

Note: Paged like /top-players (limit teams per leaderboard, default 10). Categories vary by sport and are named with the statistic keys (same as the team statistics); statistic is the key in each entry’s statistics the board ranks. matches is null where the source reports 0 beside non-zero counts. A league, season or type without leaderboards returns an empty array.

## Parameters

| Name | In | Required | Description |
| --- | --- | --- | --- |
| `id` | path | yes | our numeric id (positive integer) |
| `season` | query | yes | a season id from /v2/leagues/{id}/seasons |
| `type` | query | no | overall \| home \| away \| regularSeason \| playoffs. Default: the season’s own — overall where it has one (football), else regularSeason (NBA, NHL, …); meta.type says which was used |
| `category` | query | no | one leaderboard only (a category of this season, e.g. goals); unknown → 400 listing the season’s categories |
| `limit` | query | no | entries per leaderboard, 1–50 (default 10) |
| `page` | query | no | page of limit entries, 0–49 (default 0 = the leaders) |

## Response

- `data`: `TopTeamsCategory[]`
- `meta`: season, type (the one used), category (null = all), limit, page, count (categories), hasNextPage
- Objects: TopTeamsCategory (https://sportsapi.app/markdown/en/reference.md#topteamscategory)

## Errors

- 400 bad_request — missing or invalid season, type not one of overall, home, away, regularSeason, playoffs, limit outside 1–50, page outside 0–49, or an unknown category
- 404 not_found — season is not one of this league’s seasons (the message names the parameter; list them with /v2/leagues/{id}/seasons)

Plus the common errors (https://sportsapi.app/markdown/en/docs.md#errors).

## Request

cURL:

```bash
curl -H "Authorization: Bearer sk_live_…" \
    "https://api.sportsapi.app/v2/leagues/{id}/top-teams?season=…"
```

TypeScript:

```ts
const { data, meta } = await client.leagues.topTeams(id, { season });
for await (const page of client.leagues.topTeamsPages(id, { season })) { … }
```

Python:

```python
res = client.leagues.top_teams(id, season=season)
for page in client.leagues.top_teams_pages(id, season=season): ...
```

Go:

```go
res, err := client.Leagues.TopTeams(ctx, id, &sportsapi.LeaguesTopTeamsParams{Season: season})
for page, err := range client.Leagues.TopTeamsPages(ctx, id, &sportsapi.LeaguesTopTeamsParams{Season: season}) { … }
```

CLI:

```bash
$ sportsapi leagues top-teams <id> --season <season>
$ sportsapi leagues top-teams <id> --season <season> --all -o csv
```

## Example response

```json
{ "data": [ { "category": "averageRating", "statistic": "averageRating", "teams": [
      { "team": { "id": 4438, "name": "Manchester City", "code": "MCI", "image": "…", … },
        "value": 7.02, "matches": 7, "statistics": { "averageRating": 7.02, "matches": 7 } }, … ] },
    { "category": "goalsScored", "statistic": "goalsScored", "teams": [ … ] }, … ],
  "meta": { "season": 200386, "type": "overall", "category": null, "limit": 10, "page": 0, "count": 12, "hasNextPage": true } }
```

---

Base URL: https://api.sportsapi.app. Send your API key as `Authorization: Bearer <key>` on every /v2 request; keys are created in the dashboard (https://sportsapi.app/dashboard).
HTML: https://sportsapi.app/docs/leagues/top-teams · All docs: https://sportsapi.app/markdown/en/docs.md
