Skip to content

REST API

import { Aside } from ‘@astrojs/starlight/components’;

All API routes are prefixed with /api when accessed through the web app’s proxy. Direct API calls use the base URL configured in ADDR (default :8080).

All host routes require a Bearer token from Auth0:

Authorization: Bearer <access_token>

In local dev with DEV_AUTH_TOKEN set, pass the dev token instead:

Authorization: Bearer devtoken123

Player routes (join, submit answer) are unauthenticated.

MethodPathDescription
GET/healthzLiveness — checks Postgres + Redis
GET/readyzReadiness — same checks

Both return 200 OK with {"status":"ok"} when healthy.

MethodPathDescription
GET/banksList all banks owned by the authenticated host
POST/banksCreate a bank
GET/banks/:idGet a bank with its questions
PUT/banks/:idUpdate a bank
DELETE/banks/:idDelete a bank
MethodPathDescription
GET/banks/:id/questionsList questions in a bank
POST/banks/:id/questionsAdd a question
PUT/banks/:bankId/questions/:idUpdate a question
DELETE/banks/:bankId/questions/:idDelete a question
MethodPathDescription
GET/quizzesList all quizzes
POST/quizzesCreate a quiz
GET/quizzes/:idGet a quiz with rounds and questions
PUT/quizzes/:idUpdate a quiz
DELETE/quizzes/:idDelete a quiz
MethodPathDescription
POST/quizzes/:id/roundsAdd a round
PUT/quizzes/:quizId/rounds/:idUpdate a round
DELETE/quizzes/:quizId/rounds/:idRemove a round
POST/quizzes/:quizId/rounds/:id/questionsAdd a question to a round
DELETE/quizzes/:quizId/rounds/:roundId/questions/:idRemove a question from a round
MethodPathDescription
GET/gamesList all games
POST/gamesCreate a game from a quiz
GET/games/:idGet game details
DELETE/games/:idDelete a game
MethodPathDescription
POST/joinJoin a game by code. Body: {"code":"ABCDEF","displayName":"Alice"}. Returns a session token for the WebSocket.
PathDescription
/ws/:gameCodeReal-time game connection. See WebSocket Protocol.

All resource IDs are UUIDv7, generated app-side. Every POST response includes the created resource with its id.