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

Group: Teams

Season leaderboards limited to one team’s players within a league — highest-rated players, leading scorers, top assisters and so on — paginated like the league-wide leaderboards.

Plans: Requires Pro, Business or Enterprise; a Free or Starter key receives 403 endpoint_not_in_plan.

Note: Response shape and pagination match /v2/leagues/{id}/top-players, filtered to this team’s players. An empty array means the source holds nothing for this team in that league season.

## Parameters

| Name | In | Required | Description |
| --- | --- | --- | --- |
| `id` | path | yes | DataSportsAPI team id, a positive integer |
| `league` | query | yes | id of a league the team competes in (see /v2/teams/{id}/leagues) |
| `season` | query | yes | season id, as listed by /v2/leagues/{id}/seasons |
| `type` | query | no | overall \| home \| away \| regularSeason \| playoffs. When omitted, the season’s native type applies: overall if the season has one (football), otherwise regularSeason (NBA, NHL, …); meta.type reports the one applied |
| `category` | query | no | restricts the response to a single leaderboard, named by one of this season’s categories such as goals; an unrecognised value returns 400 listing the season’s categories |
| `limit` | query | no | number of entries in each leaderboard, 1–50 (defaults to 10) |
| `page` | query | no | which block of limit entries to return, 0–49; the default 0 shows the leaders |

## Response

- `data`: `TopPlayersCategory[]`
- `meta`: season, type (as applied), category (null means every category), limit, page, count (number of categories), hasNextPage
- Objects: TopPlayersCategory (https://datasportsapi.com/markdown/reference.md#topplayerscategory)

## Errors

- 400 bad_request — league or season is absent, or paging, type or category is invalid (the rules of /v2/leagues/{id}/top-players apply)
- 403 history_not_in_plan — the season finished before your plan’s history window begins
- 404 not_found — the season id does not belong to this league

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}/top-players?league=…&season=…"
```

TypeScript:

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

Python:

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

Go:

```go
res, err := client.Teams.TopPlayers(ctx, id, &datasportsapi.TeamsTopPlayersParams{League: league, Season: season})
for page, err := range client.Teams.TopPlayersPages(ctx, id, &datasportsapi.TeamsTopPlayersParams{League: league, Season: season}) { … }
```

CLI:

```bash
$ dsa teams top-players <id> --league <league> --season <season>
$ dsa teams top-players <id> --league <league> --season <season> --all -o csv
```

## Example response

```json
{ "data": [ { "category": "goals", "statistic": "goals", "players": [
      { "player": { "id": 3759, "name": "Bukayo Saka", … }, "team": { "id": 18, "name": "Arsenal", … }, "value": 3, "appearances": 7,
        "playedEnough": true, "statistics": { "goals": 3, "appearances": 7 } }, … ] }, … ],
  "meta": { "season": 200386, "type": "overall", "category": null, "limit": 10, "page": 0, "count": 26, "hasNextPage": 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/teams/top-players/ · All docs: https://datasportsapi.com/markdown/docs.md · Data reference: https://datasportsapi.com/markdown/reference.md
