# GET /v2/leagues/{id}/cup-trees

Group: Leagues

A season’s knockout brackets (the knockout phase of a cup in football and other sports, a playoff tree, a tennis draw), nested as rounds, then ties, then each tie’s two participants (team, seed, winner, score), then DataSportsAPI fixture ids.

Plans: Every plan, Free included.

Note: score is the tie result as our data source reports it — aggregate goals across both legs in football, series wins in basketball and ice hockey, sets in tennis — and penalties holds shoot-out goals. fromBlock gives the order of the previous-round tie the participant advanced from. A null team marks a placeholder slot (“winner of QF 1”), and matchCount 0 marks a bye. Load the individual matches with /v2/fixtures/{id}. Seasons without a knockout phase return an empty array.

## 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 |

## Response

- `data`: `CupTree[]`
- `meta`: season, count
- Objects: CupTree (https://datasportsapi.com/markdown/reference.md#cuptree)

## Errors

- 400 bad_request — season is absent or invalid
- 403 history_not_in_plan — your plan’s history window begins after this season ended
- 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}/cup-trees?season=…"
```

TypeScript:

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

Python:

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

Go:

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

CLI:

```bash
$ dsa leagues cup-trees <id> --season <season>
```

## Example response

```json
{ "data": [ { "name": "CONMEBOL Libertadores 2026, Knockout stage", "currentRound": 3, "rounds": [ …,
    { "order": 3, "name": "Semifinals", "blocks": [
      { "order": 1, "finished": true, "inProgress": false, "startTime": "2026-10-16T00:30:00.000Z",
        "matchCount": 2, "fixtureIds": [789, 790], "automaticProgression": false, "venue": null,
        "home": { "team": { "id": 11, "name": "Estudiantes de La Plata", "slug": "estudiantes-de-la-plata", "shortName": "Estudiantes", "code": "ELP", "image": "…" },
                  "seed": null, "winner": true, "score": 0, "penalties": 3, "fromBlock": 1 },
        "away": { "team": { "id": 12, "name": "Flamengo", … }, "seed": null, "winner": false, "score": 0, "penalties": 2, "fromBlock": 2 } }, … ] }, … ] } ],
  "meta": { "season": 87760, "count": 1 } }
```

---

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