# GET /v2/teams/{id}/statistics/ranks

Group: Teams

How a team’s season statistics compare with the rest of its league: for every statistic, the value plus the team’s rank on the season total and on the per-game figure (NBA, NFL and other leagues our data source ranks).

Plans: Every plan, Free included.

Note: The keys match those of /v2/teams/{id}/statistics (in basketball: points, rebounds, fieldGoalPercentage, netRating, …). teamCount says how many teams were ranked.

## Parameters

| Name | In | Required | Description |
| --- | --- | --- | --- |
| `id` | path | yes | DataSportsAPI team id, a positive integer |
| `league` | query | yes | league id — for example, the league of one of the team’s fixtures |
| `season` | query | yes | season id, as listed by /v2/leagues/{id}/seasons |
| `type` | query | no | overall \| home \| away \| regularSeason \| playoffs \| mainDraw (a tennis tournament’s main draw). 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 |

## Response

- `data`: `TeamStatisticRanks`
- `meta`: league, season, type (as applied)
- Objects: TeamStatisticRanks (https://datasportsapi.com/markdown/reference.md#teamstatisticranks)

## Errors

- 403 history_not_in_plan — your plan’s history window begins after this season ended
- 404 no_data — our data source has no ranking of this team’s statistics for that league and season

Plus the errors every /v2 call shares (https://datasportsapi.com/markdown/docs/errors.md).

## Request

cURL:

```bash
curl -H "Authorization: Bearer sk_live_…" \
    "https://api.datasportsapi.com/v2/teams/{id}/statistics/ranks?league=…&season=…"
```

TypeScript:

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

Python:

```python
res = client.teams.statistic_ranks(id, league=league, season=season)
```

Go:

```go
res, err := client.Teams.StatisticRanks(ctx, id, &datasportsapi.TeamsStatisticRanksParams{League: league, Season: season})
```

CLI:

```bash
$ dsa teams statistic-ranks <id> --league <league> --season <season>
```

## Example response

```json
{ "data": { "teamCount": 30, "matches": 15, "ranks": { "points": { "value": 1642, "rank": 21, "rankPerGame": 25 }, "rebounds": { "value": 705, "rank": 9, "rankPerGame": 3 }, … } },
  "meta": { "league": 132, "season": 100772, "type": "regularSeason" } }
```

---

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/statistic-ranks/ · Group: https://datasportsapi.com/markdown/docs/teams.md · All docs: https://datasportsapi.com/markdown/docs.md · Data model: https://datasportsapi.com/markdown/reference.md
