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

Group: Leagues

Season leaderboards: the top players per statistic (rating, goals, xG, assists, tackles, saves, … — up to 50 each at the source), paged: limit players per leaderboard (default 10), or one leaderboard with category.

Plans: Pro + Business only (other plans get 403 endpoint_not_in_plan).

Note: Every leaderboard is cut to the same places: page 1 with limit 10 is places 11–20 in each. For the full top 50 of one statistic ask category=goals&limit=50 (one leaderboard, ~20 KB) instead of every leaderboard at once (football: 32 leaderboards, ~550 KB at 50 each). Categories vary by sport (football ~30; basketball points, rebounds, assists, …) and are named with the statistic keys (averageRating, goals, cleanSheets, goalInvolvements, …); statistic is the key in each entry’s statistics the board ranks (football mostConceded / leastConceded rank goalsConceded). Without type the season’s default is used (regularSeason in the NBA, NHL, …). 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`: `TopPlayersCategory[]`
- `meta`: season, type (the one used), category (null = all), limit, page, count (categories), hasNextPage (some leaderboard has more after this page)
- Objects: TopPlayersCategory (https://sportsapi.app/markdown/en/reference.md#topplayerscategory)

## 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 (the message lists the season’s categories)
- 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-players?season=…"
```

TypeScript:

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

Python:

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

Go:

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

CLI:

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

## Example response

```json
{ "data": [ { "category": "goals", "statistic": "goals", "players": [
      { "player": { "id": 3801, "name": "Erling Haaland", "image": "…", … },
        "team": { "id": 4438, "name": "Manchester City", "code": "MCI", "image": "…", … },
        "value": 8, "appearances": 7, "playedEnough": true, "statistics": { "goals": 8, "appearances": 7 } }, … ] },
    { "category": "averageRating", "statistic": "averageRating", "players": [ … ] }, … ],
  "meta": { "season": 200386, "type": "overall", "category": null, "limit": 10, "page": 0, "count": 32, "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-players · All docs: https://sportsapi.app/markdown/en/docs.md
