# Webhooks from Live scoreboard

Live scoreboard reads a venue's scoreboard by camera and publishes the scores. A webhook pushes each published change to the receiving system as it happens, so it doesn't need to poll. This document is for the developer of the receiving system: it says exactly what we send, when, and what we expect back.

## In short

- One `POST` with a JSON body per player, each time that player's published values change.
- Each request is the player's full current state, not a change: the latest one wins.
- Any 2xx means received. A timeout (10 seconds), 429 or 5xx is tried again after 5 s, 15 s, 45 s, 2 min, 5 min, then every 5 min, for up to 30 minutes from the first attempt (10 attempts at most). Anything else is not tried again.
- One player's requests go strictly one at a time, oldest first: an older state never lands after a newer one.
- In the live scoring format, names are always one of a list of spellings agreed with you in advance, and a name we can't match is never sent.

## When a request is sent

- **When a player's published values change.** A value is published once two readings of the board in a row agree on it, or when one of our operators corrects it. One request goes for each player whose values changed, and only for them.
- **Never on a timer.** There is no periodic resend or heartbeat. If nothing changes for a player, you hear nothing about them. A state identical to the last one sent for that player is not sent again.
- **Except when an operator resends everything.** Before the start (for example after you clear test scores) or after an outage, an operator can send the current state of every player in the stage, changed or not. Treat those requests like any other.
- **Before going live** we can record the requests without sending them, to check them with you.

## How it is sent

- Method `POST`, to the https address you give us. Redirects are not followed.
- `content-type: application/json`, UTF-8.
- `user-agent: scoreboard-webhook/1`.
- We wait 10 seconds for an answer.
- At most six requests are in flight at once. One player's requests are sent strictly in order, one at a time: the next is not sent until the previous one has been answered or given up.

## What we expect back

- **Any 2xx status** means you have it. The body of your reply is kept for our operators to read, but not interpreted.
- **A timeout, a network error, 429 or any 5xx** means "try again": we wait 5 s, 15 s, 45 s, 2 min, 5 min, then every 5 min between attempts, for up to 30 minutes after the first (10 attempts at most), checked every minute and whenever a reading of the board arrives. Then we stop and show the failure to our operators. When you answer 2xx again, each player's newest state that we gave up on is sent again, so you end on the latest state.
- **Any other status** (400, 401, 403, 404, a redirect…) is not tried again: we take it that the request itself is wrong. The status and the start of your reply text are kept for the operator, so a short plain reason in the reply helps us fix it quickly.

## Order: the latest state wins

Each request carries the player's whole current state. A player's requests are sent strictly in order, one at a time, so an older state can never arrive after a newer one. A newer state replaces an older one that hasn't been sent yet: if a request is still waiting to be tried again when the player's values change in the same round, the older one is dropped and only the newer one is sent. A round's last state is never dropped for the next round's first. So a receiving system should **store each request as the player's current state** for that round, replacing what it had, and never add it to what it had as a delta.

## Names

Every name we send is one of a fixed list of spellings agreed with you before the event, exactly as written there, accents included ("Zoë", not "Zoe"). The board or the camera may lose an accent or a capital; we match what we read to the list ignoring accents, case and punctuation, and send the list's spelling. In the live scoring format, if a name on the board matches nothing on the list, nothing is sent for that player: a wrong name is never sent, and our operators see each one that was held back and why. The generic format sends every player, with the list's spelling when the name matches and the board's reading when it doesn't.

## Format 1: live scoring

Exactly these six fields, in one JSON object, and nothing else unless the optional `extra` object has been agreed (below).

| Field | Type | Meaning |
|---|---|---|
| `key` | string | The key you gave us, exactly as given. This is how the request proves it is ours: there is no other authentication header. |
| `stage` | string: "SF1", "SF2", "F"… | Which round the score is for: semi-final 1, semi-final 2 or the final. Each round on our side has its own code, worked out from the board's title when the round opens ("Semi-final 2" gives SF2, "Final" gives F) or set by our operator. A round with no code is not sent at all, and is never sent under another round's code. |
| `action` | "score" | Always "score". |
| `name` | string | The player, spelt exactly as on the list of names agreed with you in advance, accents included. |
| `pcts` | array of numbers | Each level's percentage complete, Level 1 first, one entry per level on the board, placed by the number in the column's heading (pcts[n-1] is level n). Always 0 to 100: a value outside that range is never sent. A level not yet read or not started is 0. |
| `bonuses` | array of integers | The zero-based indexes of the bonuses completed: [0, 2] means Bonus 1 and Bonus 3 are done. Empty when none are. Each bonus cell on the board must read 0 or 1; anything else is never sent. |

How the levels and bonuses are found: a board column headed `L1`, `Level 1` or `Lvl 1` (any case) is a level, and `B1` or `Bonus 1` is a bonus. Levels go into `pcts` in level order. A bonus counts as completed when its cell is above 0.

A request is not sent (and our operators see why) when the board has no level columns; when a level is missing, repeated or has another column among the levels; when a level reads outside 0 to 100 or a bonus reads anything but 0 or 1; when the name is not on the list; or when the round has no code yet. A round without its own code may use the code agreed for the webhook only while no other round of the event has used it, so a score is never sent under the previous round's code.

A complete request:

```http
POST /your/address HTTP/1.1
content-type: application/json
user-agent: scoreboard-webhook/1

{
  "key": "the-key-you-gave-us",
  "stage": "F",
  "action": "score",
  "name": "Zoë Lindqvist",
  "pcts": [
    100,
    100,
    100,
    45,
    0
  ],
  "bonuses": [
    0,
    2
  ]
}
```

Here Zoë Lindqvist has completed levels 1 to 3, is 45% through level 4, has not started level 5, and has completed bonuses 1 and 3.

### The optional `extra` object

Off unless you have agreed to it, because a receiving system may refuse a field it doesn't know. When it is on, one more top-level key, `extra`, is added; the six fields above are unchanged.

| Field | Type | Meaning |
|---|---|---|
| `extra.points` | number or null | The player's total as shown on the board (its Score, Total or Points column). |
| `extra.percent` | number or null | Percent complete: points ÷ max_total × 100, one decimal place, capped at 100. Null when no maximum is set. |
| `extra.max_total` | number or null | The highest total possible in the stage, if one has been set. |
| `extra.rank` | integer or null | The rank printed on the board, or null if it shows none. |
| `extra.values` | object | Every column on the board, heading → value, exactly as read. A cell not read is null (unlike pcts, where it is 0). |
| `extra.flags` | array of strings | "decreased": the total went down at this change. "manual": set by one of our operators, and held until the camera agrees. "camera_disagrees": the camera reads something else for a manual value. "over_max": the total is above max_total. Usually empty. |
| `extra.read_at` | string (ISO 8601, UTC) | When this state was published on our side. |
| `extra.source` | "camera" or "operator" | Whether it came from a reading of the board or an operator's correction. |

The same request with `extra` on:

```http
POST /your/address HTTP/1.1
content-type: application/json
user-agent: scoreboard-webhook/1

{
  "key": "the-key-you-gave-us",
  "stage": "F",
  "action": "score",
  "name": "Zoë Lindqvist",
  "pcts": [
    100,
    100,
    100,
    45,
    0
  ],
  "bonuses": [
    0,
    2
  ],
  "extra": {
    "points": 825,
    "percent": 66,
    "max_total": 1250,
    "rank": 2,
    "values": {
      "Level 1": 100,
      "Level 2": 100,
      "Level 3": 100,
      "Level 4": 45,
      "Level 5": null,
      "Bonus 1": 1,
      "Bonus 2": 0,
      "Bonus 3": 1,
      "Score": 825
    },
    "flags": [],
    "read_at": "2026-12-03T20:14:06Z",
    "source": "camera"
  }
}
```

## Format 2: generic

For a receiving system that wants everything we know about the player in a neutral shape. The key, if one is agreed, travels in the `authorization` header as `Bearer <key>`, not in the body.

| Field | Type | Meaning |
|---|---|---|
| `session` | object | { id, name, kind }: the recording this belongs to. kind is "live" for a real event and "test" for a rehearsal: ignore "test" unless you are testing with us. |
| `stage` | object | { id, label, max_total }: the stage (a round, heat or final). max_total is the highest total possible, or null. |
| `at` | string (ISO 8601, UTC) | When this state was published. |
| `player.id` | string | Our id for the player. Stable across stages. |
| `player.name` | string | The player's name, from the list of spellings for the session when it matches. |
| `player.rank` | integer or null | The rank printed on the board. |
| `player.values` | object | Every column on the board, heading → value. A cell not read is null. |
| `player.total` | number or null | The total column's value. |
| `player.percent` | number or null | total ÷ max_total × 100, one decimal place, capped at 100; null without a maximum. |
| `player.flags` | array of strings | "decreased", "manual", "camera_disagrees" or "over_max", as in the extra object above. Usually empty. |

A complete request:

```http
POST /your/address HTTP/1.1
content-type: application/json
user-agent: scoreboard-webhook/1
authorization: Bearer the-key-you-gave-us

{
  "session": {
    "id": "final",
    "name": "Final",
    "kind": "live"
  },
  "stage": {
    "id": "s3",
    "label": "F",
    "max_total": 1250
  },
  "at": "2026-12-03T20:14:06Z",
  "player": {
    "id": "p7",
    "name": "Zoë Lindqvist",
    "rank": 2,
    "values": {
      "Level 1": 100,
      "Level 2": 100,
      "Level 3": 100,
      "Level 4": 45,
      "Level 5": null,
      "Bonus 1": 1,
      "Bonus 2": 0,
      "Bonus 3": 1,
      "Score": 825
    },
    "total": 825,
    "percent": 66,
    "flags": []
  }
}
```

## The key

- Live scoring format: in the body, as `key`.
- Generic format: in the `authorization: Bearer <key>` header, when a key is agreed.
- It is stored on our side and never shown in full: our operators see its last four characters, and it is never written to our logs or our public feed. Give us a key used only for this.

## What is never sent

- Eliminations: we only know whether a name is on the board, not why it isn't.
- The clock or any time remaining.
- In the live scoring format, points, rank and the other columns, unless `extra` is on.
- Pictures of the board: we never store them.

## What we need from you

1. The https address to send to.
2. The key, and which format you want.
3. For the live scoring format, the code for each round: SF1, SF2 and F unless you tell us otherwise. Each of our rounds carries its own code, so nothing needs changing between rounds.
4. The exact list of player names, spelt as you want them, accents included.
5. Whether you accept the `extra` object. If you are not sure, the answer is no.
6. A time to test: we can send the current state of every player on request.

## See also

- The public data feed, if you would rather poll: https://mewc.scorchsoft.tools/api.md
