Quiz API
A REST API for multiplayer quiz games. Register players, manage a question bank,
open a lobby, and run rounds where everyone answers the same question at the same time.
What it does
- Accounts & JWT auth — register with a nickname, log in for a bearer token; admin and player roles.
- Question bank — 16 categories, 4 answers per question, exactly one correct. Bulk import supported.
- Game lobbies — set a player limit and question count, others join or leave until the host starts.
- Live rounds — fetch the current question, submit an answer, per-player scores tracked as you go.
Quick start
# create a player
curl -X POST https://quiz-api.vitali.live/api/users \
-H 'Content-Type: application/json' \
-d '{"nickname":"ada","password":"secret123"}'
# log in
TOKEN=$(curl -s -X POST https://quiz-api.vitali.live/api/auth/login \
-H 'Content-Type: application/json' \
-d '{"nickname":"ada","password":"secret123"}' | jq -r .accessToken)
# open a game
curl -X POST https://quiz-api.vitali.live/api/games \
-H "Authorization: Bearer $TOKEN" \
-H 'Content-Type: application/json' \
-d '{"playersLimit":4,"questionsCount":10}'
Endpoints
Auth
| POST | /api/auth/login | Exchange credentials for a token |
Users
| POST | /api/users | Register |
| GET | /api/users | List all (admin) |
| GET | /api/users/{id} | Fetch one |
| PATCH | /api/users/{id} | Update own profile |
| DELETE | /api/users/{id} | Delete own profile |
Questions (admin)
| POST | /api/questions | Create |
| POST | /api/questions/bulk | Create many at once |
| GET | /api/questions | List all |
| GET | /api/questions/{id} | Fetch one |
| PATCH | /api/questions/{id} | Update |
| DELETE | /api/questions/{id} | Delete |
Games
| POST | /api/games | Open a lobby |
| GET | /api/games | List games |
| GET | /api/games/{id} | Fetch one |
| PATCH | /api/games/{id} | Update settings (host, pre-start) |
| DELETE | /api/games/{id} | Delete (host, pre-start) |
| POST | /api/games/{id}/join | Join the lobby |
| POST | /api/games/{id}/leave | Leave the lobby |
| POST | /api/games/{id}/start | Start the game |
| GET | /api/games/{id}/question | Current question |
| POST | /api/games/{id}/question | Submit an answer |
Categories
general · programming · geography · history · math · literature · music · movies ·
games · animals · vehicles · sports · politics · science · art · other