# API reference

Base URL: `https://api.sidelined.ch/v1` · Free, no key · 60 requests a minute per IP address · [OpenAPI 3.1 document](https://api.sidelined.ch/v1/openapi.json)

Every response includes an `attribution` to show with the data. Errors are [problem details](/api/errors). Field meanings and rules: [the data model](/api/concepts).

## GET /v1/teams

The 14 clubs with their current counts.

```sh
curl "https://api.sidelined.ch/v1/teams"
```

| Status | Meaning | Body |
|---|---|---|
| 200 | All teams. | `data`: array of [Team](#team), `attribution`: [Attribution](#attribution) |
| 403 | Before the public launch: not open yet. | [Problem](#problem) |
| 429 | Rate limit: 60 requests a minute per IP address. | [Problem](#problem) |

## GET /v1/teams/{slug}

One club with all its current entries (every category, marked).

| Parameter | In | Type | Description |
|---|---|---|---|
| `slug` (required) | path | `string` | Team slug, from GET /v1/teams. |

```sh
curl "https://api.sidelined.ch/v1/teams/zug"
```

| Status | Meaning | Body |
|---|---|---|
| 200 | The team. | `data`: [Team](#team) + `object`, `attribution`: [Attribution](#attribution) |
| 403 | Before the public launch: not open yet. | [Problem](#problem) |
| 404 | Unknown team slug. | [Problem](#problem) |
| 429 | Rate limit: 60 requests a minute per IP address. | [Problem](#problem) |

## GET /v1/teams/{slug}/absences

A club's current entries, as on its team page.

| Parameter | In | Type | Description |
|---|---|---|---|
| `slug` (required) | path | `string` | Team slug, from GET /v1/teams. |
| `category` | query | `string` | Which entries: `out` (default, as the site counts), `scratch`, `loan`, several comma-separated (`out,loan`), or `all`. Default: `out`. |

```sh
curl "https://api.sidelined.ch/v1/teams/zug/absences?category=out,loan"
```

| Status | Meaning | Body |
|---|---|---|
| 200 | The entries. | `data`: array of [Absence](#absence), `attribution`: [Attribution](#attribution) |
| 400 | Invalid parameter. | [Problem](#problem) |
| 403 | Before the public launch: not open yet. | [Problem](#problem) |
| 404 | Unknown team slug. | [Problem](#problem) |
| 429 | Rate limit: 60 requests a minute per IP address. | [Problem](#problem) |

## GET /v1/absences

Current entries across the league, filterable.

| Parameter | In | Type | Description |
|---|---|---|---|
| `team` | query | `string` | Team slug. |
| `type` | query | `string` | Absence type. One of: `injury`, `illness`, `suspension`, `loan`, `national_team`, `personal`, `healthy_scratch`, `import_limit`, `unknown`. |
| `confidence` | query | `string` | Confidence. One of: `official`, `league`, `media`, `inferred`. |
| `category` | query | `string` | Which entries: `out` (default, as the site counts), `scratch`, `loan`, several comma-separated (`out,loan`), or `all`. Default: `out`. |

```sh
curl "https://api.sidelined.ch/v1/absences?team=zug"
```

| Status | Meaning | Body |
|---|---|---|
| 200 | The entries. | `data`: array of [Absence](#absence), `attribution`: [Attribution](#attribution) |
| 400 | Invalid parameter. | [Problem](#problem) |
| 403 | Before the public launch: not open yet. | [Problem](#problem) |
| 404 | Unknown team slug. | [Problem](#problem) |
| 429 | Rate limit: 60 requests a minute per IP address. | [Problem](#problem) |

## GET /v1/changes

Recent changes: players newly out, updated, back, or no longer listed (last 14 days).

| Parameter | In | Type | Description |
|---|---|---|---|
| `since` | query | `string` | Only changes after this ISO 8601 date or timestamp (at most 14 days back). |
| `team` | query | `string` | Team slug. |
| `limit` | query | `integer` | Page size, 1–100. Default: `50`. |
| `cursor` | query | `string` | `next_cursor` from the previous page. |

```sh
curl "https://api.sidelined.ch/v1/changes?team=zug"
```

| Status | Meaning | Body |
|---|---|---|
| 200 | Newest first. A page can hold fewer than `limit` changes; follow `next_cursor` until it is null. | `data`: array of [Change](#change), `next_cursor`: `string` or null, `attribution`: [Attribution](#attribution) |
| 400 | Invalid parameter or cursor. | [Problem](#problem) |
| 403 | Before the public launch: not open yet. | [Problem](#problem) |
| 429 | Rate limit: 60 requests a minute per IP address. | [Problem](#problem) |

## GET /v1/openapi.json

This document.

| Status | Meaning | Body |
|---|---|---|
| 200 | OpenAPI 3.1 document. |  |

## Schemas

### Attribution

Must be shown wherever the data is shown (terms of use).

| Field | Type | Description |
|---|---|---|
| `text` | `string` | Credit line to display. |
| `url` | `string` (uri) | Link the credit points to. |

### Team

| Field | Type | Description |
|---|---|---|
| `slug` | `string` | Stable identifier used in URLs and filters. |
| `name` | `string` | Full club name. |
| `short_name` | `string` | Short name for tight spaces. |
| `logo_url` | `string` (uri) | Club logo (256 px WebP). The logos are the clubs' trademarks; use them only to identify the club. |
| `url` | `string` (uri) | The team page on sidelined.ch. |
| `out` | `integer` | Players currently unavailable (category `out`): scratches and loans are not counted. |
| `scratches` | `integer` | Fit players left out of the last game (healthy scratch, import limit; category `scratch`). |
| `loans` | `integer` | Players with the farm team or another club (category `loan`). |
| `checked_at` | `string` or null (date-time) | When one of the club's own sources was last read successfully (UTC). |
| `next_game` | `object` or null | The club's next National League game, or today's until it's over, from the league's schedule (no cup or Champions Hockey League games). Null when none is scheduled. |

### Player

| Field | Type | Description |
|---|---|---|
| `id` | `integer` | Stable player ID. |
| `name` | `string` | Display name, "First Last". |
| `jersey` | `integer` or null | Jersey number, when known. |

### Source

| Field | Type | Description |
|---|---|---|
| `kind` | `string` | Where the entry comes from. One of: `medical_report`, `manual`, `news`, `league_news`, `lineup`, `lineup_sheet`, `media`. |
| `label` | `string` | Human-readable source name. |
| `url` | `string` or null (uri) | The page or document it comes from: the club's report, the article, the lineup sheet. Null for lineup data. |

### Absence

A player currently unavailable. Reasons are given as the source published them; sidelined.ch adds no medical details of its own.

| Field | Type | Description |
|---|---|---|
| `id` | `integer` | Stable ID of this absence. |
| `team` | `string` | Team slug. |
| `player` | [Player](#player) |  |
| `type` | `string` | Why the player is unavailable. One of: `injury`, `illness`, `suspension`, `loan`, `national_team`, `personal`, `healthy_scratch`, `import_limit`, `unknown`. |
| `category` | `string` | out: counted as unavailable. scratch: fit, left out by the coach (healthy scratch, import limit). loan: with the farm team or another club. Only `out` counts in `Team.out`. One of: `out`, `scratch`, `loan`. |
| `confidence` | `string` | How the information is known: official (the club), league (National League, SIHF), media, inferred (only missing from lineups; reason unknown). One of: `official`, `league`, `media`, `inferred`. |
| `reason_text` | `string` or null | The reason as the source published it, in its language. |
| `body_region` | `string` or null | Body region, when the source names one. One of: `upper_body`, `lower_body`, `head`. |
| `since` | `string` (date) | Date the absence started or was first reported (see `since_kind`). |
| `since_kind` | `string` | What `since` is: reported (a date the source published), article (the article's date), first_seen (when sidelined.ch first saw it), lineup (the first game missed). One of: `reported`, `article`, `first_seen`, `lineup`. |
| `return` | `object` | Expected return: the source's wording and sidelined.ch's reading of it. An estimate, not a club statement. |
| `detail` | `string` or null | Extra context, e.g. "Not dressed for the last 3 games" on inferred entries. |
| `sources` | array of [Source](#source) |  |
| `off_club_report` | `object` or null | The club's medical report no longer lists him, but another source (usually SIHF's lineup sheet of his team's last game) keeps the entry open. `return` is then the club's last estimate, from before it dropped him. Null otherwise. |
| `expected_back` | `object` or null | The club says he plays a named upcoming game (a game preview or club news, read by a language model and checked against the article): the game and the article. The entry stays open until he's dressed. Null once that game has started, or when no club says so. |
| `updated_at` | `string` (date-time) | Last change to this entry (UTC). |

### Change

| Field | Type | Description |
|---|---|---|
| `id` | `integer` | Event ID, increasing. |
| `kind` | `string` | opened: a player became unavailable. updated: an open entry has a new type, a new reason or a new suspension length (reworded return estimates are left out), or the club's medical report dropped him or lists him again while another source keeps the entry open. closed: no longer listed. One of: `opened`, `updated`, `closed`. |
| `closed_reason` | `string` or null | returned: dressed for a game again. cleared: the sources no longer list him. moved: dressed for another club (a loan to another National League club, a transfer). One of: `returned`, `cleared`, `moved`. |
| `changed` | array of `string` | For `updated`: what is new. Null otherwise. |
| `club_report` | `object` or null | For `updated` with `changed: ["club_report"]`: whether the club's medical report lists him now. False: it dropped him, but another source (usually SIHF's lineup sheet) keeps the entry open. Null otherwise. |
| `suspension` | `object` or null | For `updated` with a new suspension length (a decision after a provisional suspension, an appeal). Null otherwise. |
| `at` | `string` (date-time) | When sidelined.ch recorded it (UTC). |
| `team` | `string` | Team slug. |
| `absence_id` | `integer` |  |
| `player` | [Player](#player) |  |
| `type` | `string` | Absence type. One of: `injury`, `illness`, `suspension`, `loan`, `national_team`, `personal`, `healthy_scratch`, `import_limit`, `unknown`. |
| `confidence` | `string` | Confidence of the absence. One of: `official`, `league`, `media`, `inferred`. |
| `reason_text` | `string` or null | The reason as published. |

### Problem

RFC 9457 problem details. `type` links to a page explaining what to do.

| Field | Type | Description |
|---|---|---|
| `type` | `string` (uri) | Docs page for this error. |
| `title` | `string` |  |
| `status` | `integer` |  |
| `detail` | `string` |  |
