# GET /v2/leagues/{id}/team-of-the-week

Group: Leagues

The team of the week for one round or week, set out as a line-up of the top-rated players: formation, then each player with their club, position, the rating that won them the spot and the match they earned it in.

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

Note: Football teams have 11 players, with order 1 being the goalkeeper; NBA teams have 5 players in formation "2-3". Ratings are our data source’s match ratings on a 0–10 scale. Once published, a team of the week is final.

## 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 |
| `period` | query | no | a period id listed by /v2/leagues/{id}/team-of-the-week/periods; defaults to the latest period |

## Response

- `data`: `TeamOfTheWeek`
- `meta`: season, period (the period actually shown), count (players in the team)
- Objects: TeamOfTheWeek (https://datasportsapi.com/markdown/reference.md#teamoftheweek)

## Errors

- 403 history_not_in_plan — your plan’s history window begins after this season ended
- 404 no_data — no team of the week is available from our data source for this league and season so far
- 404 not_found — the period belongs to a different season, or the season to a different 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/leagues/{id}/team-of-the-week?season=…"
```

TypeScript:

```ts
const { data, meta } = await client.leagues.teamOfTheWeek(id, { season });
```

Python:

```python
res = client.leagues.team_of_the_week(id, season=season)
```

Go:

```go
res, err := client.Leagues.TeamOfTheWeek(ctx, id, &datasportsapi.LeaguesTeamOfTheWeekParams{Season: season})
```

CLI:

```bash
$ dsa leagues team-of-the-week <id> --season <season>
```

## Example response

```json
{ "data": { "period": { "id": 812604, "kind": "round", "sequence": 9, "round": 9, "roundName": "9", … },
    "formation": "3-4-3",
    "players": [
      { "order": 1, "player": { "id": 994363, "name": "Bart Verbruggen", "shortName": "B. Verbruggen", … },
        "team": { "id": 30, "name": "Brighton & Hove Albion", … }, "position": "goalkeeper", "rating": 9.6, "fixtureId": 701188 },
      { "order": 2, "player": { "name": "Jan Paul van Hecke", … }, "position": "defender", "rating": 9.8, … }, … ] },
  "meta": { "season": 200386, "period": 812604, "count": 11 } }
```

---

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/team-of-the-week/ · All docs: https://datasportsapi.com/markdown/docs.md · Data reference: https://datasportsapi.com/markdown/reference.md
