> ## Documentation Index
> Fetch the complete documentation index at: https://285e39fd5e337e58f16290.sightscreen.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Leagues

> League management and configuration endpoints.

## Endpoint reference

| Method   | Route                | Auth  | Purpose                               |
| -------- | -------------------- | ----- | ------------------------------------- |
| `GET`    | `/leagues`           | User  | List active leagues                   |
| `GET`    | `/admin/leagues`     | Admin | List all leagues (including inactive) |
| `POST`   | `/admin/leagues`     | Admin | Create a league                       |
| `PATCH`  | `/admin/leagues/:id` | Admin | Update a league                       |
| `DELETE` | `/admin/leagues/:id` | Admin | Delete a league                       |

***

### GET /leagues `User`

Returns all active leagues.

```json theme={null}
{
  "leagues": [
    {
      "id": "bbl",
      "name": "Big Bash League",
      "season": "2025-26",
      "status": "active"
    }
  ]
}
```

***

## Admin league management

### GET /admin/leagues `Admin`

List all leagues, including inactive ones.

### POST /admin/leagues `Admin`

Create a new league.

<ParamField body="name" type="string" required>
  League name (e.g., "Big Bash League").
</ParamField>

<ParamField body="shortName" type="string" required>
  Short code (e.g., "BBL").
</ParamField>

<ParamField body="season" type="string" required>
  Season identifier (e.g., "2025-26").
</ParamField>

<ParamField body="sportMonksLeagueId" type="number">
  SportMonks league ID.
</ParamField>

### PATCH /admin/leagues/:id `Admin`

Update league properties. Can be used to activate/deactivate a league.

### DELETE /admin/leagues/:id `Admin`

Delete a league. This does not delete associated matches or fixtures.

<Warning>
  Deleting a league that has active matches may cause unexpected behavior. Deactivate it instead.
</Warning>
