# GET /v2/players/{id}/statistics/rankings

Group: Players

For every statistic, shows how the player compares with the rest of the league in one season: their value, their place (tied values share a place), how many players are tied there and how many are ranked in total. Available on Pro, Business and Enterprise plans.

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

Note: statistic takes its keys from /v2/players/{id}/statistics. Returns an empty list when the source ranks nobody, as in minor leagues and other sports.

## Parameters

| Name | In | Required | Description |
| --- | --- | --- | --- |
| `id` | path | yes | DataSportsAPI player id, a positive integer |
| `league` | query | yes | league id, as listed by /v2/players/{id}/seasons |
| `season` | query | yes | season id, as listed by /v2/leagues/{id}/seasons |
| `type` | query | no | statistics type; overall when omitted |

## Response

- `data`: `PlayerStatRanking[]`
- `meta`: league, season, type, count
- Objects: PlayerStatRanking (https://datasportsapi.com/markdown/reference.md#playerstatranking)

## Errors

- 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/players/{id}/statistics/rankings?league=…&season=…"
```

TypeScript:

```ts
const { data, meta } = await client.players.statisticsRankings(id, { league, season });
```

Python:

```python
res = client.players.statistics_rankings(id, league=league, season=season)
```

Go:

```go
res, err := client.Players.StatisticsRankings(ctx, id, &datasportsapi.PlayersStatisticsRankingsParams{League: league, Season: season})
```

CLI:

```bash
$ dsa players statistics-rankings <id> --league <league> --season <season>
```

## Example response

```json
{ "data": [ { "statistic": "goals", "value": 3, "rank": 12, "tiedCount": 13, "playerCount": 454 },
    { "statistic": "expectedGoals", "value": 3.619, "rank": 9, "tiedCount": 1, "playerCount": 364 }, … ],
  "meta": { "league": 200001, "season": 200386, "type": "overall", "count": 79 } }
```

---

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