---
title: "Upsert a league season window"
method: PUT
path: "/api/admin/leagues/{leagueId}/season-windows"
tags: ["Admin"]
---

# Upsert a league season window

`PUT /api/admin/leagues/{leagueId}/season-windows`

## Request

- Base URL: `https://app.d-sports.org`
- URL: `https://app.d-sports.org/api/admin/leagues/{leagueId}/season-windows`
- Auth: HTTP bearer

Platform admin only. Creates or replaces the window for one season year, idempotent on (leagueId, seasonYear). Body: { seasonYear, startDate, endDate, preseasonStartDate?, stateOverride?, hubEnabled? }. Dates are ISO-8601; endDate must not precede startDate and preseasonStartDate must not follow startDate. stateOverride (in_season | off_season | preseason | null) opens or holds the off-season hub outside the date math; hubEnabled (boolean | null) pins the hub switch on its own. Both nullable — null derives. 400 is returned only for an invalid body; a persistence failure is 500.

## Path parameters

- `leagueId` string, required

## Request body

- object
  - `seasonYear` integer, required: Season label year (2026 = the 2026-27 season).
  - `startDate` string, date-time, required
  - `endDate` string, date-time, required: Last day of the season, inclusive.
  - `preseasonStartDate` string, date-time, nullable: Training camp opener. Null means no preseason phase.
  - `stateOverride` 'in_season' | 'off_season' | 'preseason', nullable
  - `hubEnabled` boolean, nullable

## Response `200`

{ success, data: { window } }

## Other responses

- `400`: VALIDATION_ERROR — invalid body
- `401`: UNAUTHORIZED
- `403`: FORBIDDEN — platform admin only
- `404`: League not found
- `500`: INTERNAL_ERROR — the write could not be persisted

## Changes

- **2026-11-18** `6de639c52609`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/d-sports-ecosystem/apis/d-sports-api/changes/api/admin/leagues/:leagueId/season-windows/put.md)

---

[API](https://skmtc.dev/d-sports-ecosystem/apis/d-sports-api.md) - [All operations](https://skmtc.dev/d-sports-ecosystem/apis/d-sports-api/llms.txt) - [OpenAPI document](https://skmtc.dev/d-sports-ecosystem/apis/d-sports-api/revisions/63735cf90a04?raw)
