# GET /v2/leagues/{id}/player-statistics

Group: Leagues

A sortable player-statistics table for a football season: every player in the league, 20 per page, ordered by any statistic and returned with one column set — summary, attack, defense, passing, goalkeeping or other — with optional position and team filters. Only football leagues are covered, because our data source offers no equivalent for other sports (checked against the NBA, NHL and EuroLeague on 2026-10-28); those leagues return 404 not_supported, and /v2/leagues/{id}/top-players serves their season leaders instead.

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

Note: Statistic keys follow the season-statistics naming of /v2/players/{id}/statistics. Every row always includes appearances and minutesPlayed, plus the sort key when the chosen group does not contain it. Page through until hasNextPage turns false; there are never more than 50 pages (1,000 players). For just the leaders in one statistic, /top-players is cheaper.

## Parameters

| Name | In | Required | Description |
| --- | --- | --- | --- |
| `id` | path | yes | league id issued by DataSportsAPI, a positive integer |
| `season` | query | yes | season id, as listed by /v2/leagues/{id}/seasons |
| `group` | query | no | summary (default) \| attack \| defense \| passing \| goalkeeping \| other — selects the set of statistics returned on each row |
| `order` | query | no | season-statistic key used for sorting; defaults to averageRating, and an invalid key returns a 400 listing the accepted ones |
| `direction` | query | no | desc (default) \| asc |
| `page` | query | no | zero-based page number, an integer from 0 to 49 (0 if omitted) |
| `position` | query | no | one or more of goalkeeper, defender, midfielder, forward, separated by commas |
| `team` | query | no | team id; restricts the rows to that team’s players |

## Response

- `data`: `PlayerStatisticsRow[]`
- `meta`: season, group, order, direction, page, position (null, or the requested positions sorted), team, count, pageCount, hasNextPage
- Objects: PlayerStatisticsRow (https://datasportsapi.com/markdown/reference.md#playerstatisticsrow)

## Errors

- 400 bad_request — season is absent; group, order, direction or position is unrecognised; page is not 0–49; or team is not an id. The message lists every offending parameter with its accepted values, e.g. “invalid order (one of …)”, so all of them can be fixed in one go
- 403 history_not_in_plan — your plan’s history window begins after this season ended
- 404 not_supported — only football leagues are supported
- 404 no_data — our data source holds no player statistics for this league and season (or for the requested team)
- 404 not_found — the season id does not belong to this league; the error message names the offending parameter, and /v2/leagues/{id}/seasons lists the valid ones

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/leagues/{id}/player-statistics?season=…"
```

TypeScript:

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

Python:

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

Go:

```go
res, err := client.Leagues.PlayerStatistics(ctx, id, &datasportsapi.LeaguesPlayerStatisticsParams{Season: season})
for page, err := range client.Leagues.PlayerStatisticsPages(ctx, id, &datasportsapi.LeaguesPlayerStatisticsParams{Season: season}) { … }
```

CLI:

```bash
$ dsa leagues player-statistics <id> --season <season>
$ dsa leagues player-statistics <id> --season <season> --all -o csv
```

## Example response

```json
{ "data": [ { "player": { "id": 1, "name": "Jack Hinshelwood", "slug": "jack-hinshelwood", "shortName": null, "image": "…" },
    "team": { "id": 2, "name": "Brighton & Hove Albion", "slug": "brighton-and-hove-albion", "shortName": "Brighton", "code": "BHA", "image": "…" },
    "statistics": { "goals": 3, "expectedGoals": 2.33, "successfulDribbles": 1, "tackles": 2, "assists": 0,
                    "accuratePassesPercentage": 85, "averageRating": 8.05, "appearances": 9, "minutesPlayed": 750 } }, … ],
  "meta": { "season": 200386, "group": "summary", "order": "averageRating", "direction": "desc", "page": 0, "position": null, "team": null,
            "count": 20, "pageCount": 23, "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/leagues/player-statistics/ · All docs: https://datasportsapi.com/markdown/docs.md · Data reference: https://datasportsapi.com/markdown/reference.md
