REST API Reference
Full reference for the Online Snooker Scoring platform API. All endpoints return application/json. State changes are persisted automatically — no separate save call is required.
All paths are relative to your deployment root, e.g. https://yourdomain.com
Send Content-Type: application/json on all POST/PUT requests.
Errors return {"error": "description"} with an appropriate HTTP status code.
Club context is derived automatically from your API key or manager session — never pass club_id in requests.
Authentication
API Key•
Authorization: Bearer sk_<your-key> header•
X-Api-Key: sk_<your-key> header•
?api_key=sk_<your-key> query parameterGenerate keys from the /club settings page or via the key management endpoints below. Raw keys are shown only once at creation time.
API Key Management
Manager SessionReturns all API keys for the club (active and revoked). Raw key values are never returned — only the prefix and metadata. Requires manager session for the same club.
[
{
"id": 1,
"label": "TV Display Screen",
"key_prefix": "sk_ABCD",
"is_active": true,
"last_used_at": "2026-04-17T10:22:00",
"created_at": "2026-04-01T09:00:00"
}
]
Creates a new API key for the club. The full raw key is returned once only — store it securely. Subsequent calls to list keys will only show the prefix.
| Field | Type | Notes |
|---|---|---|
label | string | required — human-readable name, e.g. "TV Display" |
{
"success": true,
"id": 1,
"key": "sk_AbCdEfGhIjKlMnOpQrStUvWxYz012345",
"key_prefix": "sk_AbCdEf"
}
Marks the key as inactive. Any requests using the revoked key will immediately receive 401. Requires manager session for the same club.
{ "success": true }
Live Game State & Scoreboard Remote Control
API Key or ManagerReturns the current scoring state for the given table. Requires manager session or API key — club is identified automatically from auth.
{
"players": [{"name": "Alice", "club": "TRSCL", "nationality": "GB"}, {...}],
"player_ids": [3, 7],
"current_player": 0,
"frames_won": [2, 1],
"current_frame": {
"points": [47, 12],
"current_break": 23,
"reds_remaining": 8
},
"game_mode": "frames",
"current_match_id": 42
}
Returns the raw internal game-state dict for the given table. Includes undo history, frame stats, and all internal counters. Club is identified from auth. Use /api/state/{table_id} for the leaner client-formatted state.
Adds points to the current player's break. Returns the updated game state.
| Field | Type | Notes |
|---|---|---|
table_id | string | required |
points | int | required — ball value (1–7) |
ball | string | optional — e.g. "red", "black", "manual" |
Awards foul points to the non-offending player.
| Field | Type | Notes |
|---|---|---|
table_id | string | required |
foul_points | int | optional — minimum 4, default 4 |
Ends the current player's visit and transfers play to the other player.
| Field | Type | Notes |
|---|---|---|
table_id | string | required |
Steps back one entry in the undo history. Returns 400 if nothing to undo.
| Field | Type | Notes |
|---|---|---|
table_id | string | required |
Finalises the current frame, records the winner, and starts a new frame. If the match target is reached the match is completed and persisted.
| Field | Type | Notes |
|---|---|---|
table_id | string | required |
Clears all live state for the table. Any in-progress match is finalised and closed in the database.
| Field | Type | Notes |
|---|---|---|
table_id | string | required |
Sets player names, clubs, nationalities and optionally links to database player records. Call before the first frame is scored. A match record is created lazily when the first frame ends.
| Field | Type | Notes |
|---|---|---|
table_id | string | required |
player1_name | string | optional |
player1_id | int | optional — DB player ID; auto-fills name & nationality |
player1_nationality | string | optional — ISO 3166-1 alpha-2 |
player2_name | string | optional |
player2_id | int | optional |
player2_nationality | string | optional |
game_mode | string | optional — e.g. "(5)" for best of 5 |
Players
API Key or Manager| Param | Type | Notes |
|---|---|---|
include_inactive | bool | optional — include inactive players, default false |
[
{ "id": 3, "name": "Alice", "nationality": "GB", "is_active": true, "sort_order": 0 }
]
| Field | Type | Notes |
|---|---|---|
name | string | required |
nationality | string | optional |
is_active | bool | optional — default true |
Partial update — only provided fields are changed.
| Field | Type | Notes |
|---|---|---|
name | string | optional |
nationality | string | optional |
is_active | bool | optional |
sort_order | int | optional |
Permanently removes the player record. Returns 404 if not found.
Sets the display order for a list of players in bulk.
| Field | Type | Notes |
|---|---|---|
order | int[] | required — array of player IDs in desired order |
Live Tables
API Key or ManagerReturns the live status of every active table. The primary endpoint for public display screens. Club is identified from auth.
{
"club_id": 5,
"club_name": "TRSCL",
"session_high_break": 63,
"tables": [
{
"scoreboard_id": 1,
"table_name": "Table 1",
"status": "live",
"player1": { "name": "Alice", "frames": 2, "points": 47 },
"player2": { "name": "Bob", "frames": 1, "points": 12 },
"match_start": "2026-04-17T09:12:00"
},
{
"scoreboard_id": 2,
"table_name": "Table 2",
"status": "idle"
}
]
}
Returns all recorded matches for a player, with frame wins/losses and high breaks. Matches with no completed frames are excluded.
| Param | Type | Notes |
|---|---|---|
player_id | int | required |
from | date | optional — YYYY-MM-DD |
to | date | optional — YYYY-MM-DD |
Returns the most recent completed matches for a club, newest first. Club is identified from auth.
| Param | Type | Notes |
|---|---|---|
limit | int | optional — max 100, default 25 |
Returns complete frame-by-frame detail for a single match including player names, points per frame, breaks, and high breaks.
Tournaments
API Key or ManagerReturns all tournaments for the club identified from auth.
Returns the full bracket/group results for a tournament. Used by the public results wall display.
Returns the highest breaks achieved during a tournament, sorted descending. Used by the high breaks display screen.
Health Check
PublicReturns 200 with DB and Redis status when healthy, 500 on error. Use for uptime monitoring.
{ "status": "healthy", "db": "ok", "redis": "ok" }