API reference¶
All HTTP endpoints exposed by Pollux.
UUID¶
GET /api/uuid¶
Generate a new UUIDv7.
Voting¶
POST /api/vote¶
Submit a vote for a static or dynamic poll.
Request body:
| Field | Type | Description |
|---|---|---|
uuid |
string | Poll UUIDv7 |
choice |
number | Choice index (0–99 for step 0, 100–199 for step 1, etc.) |
Response: 201 Created
GET /api/vote/:uuid¶
Get poll results. Optional query parameter ?step=N to filter by step.
Dynamic polls¶
POST /api/dynamic/:uuid/step¶
Define choices for a step.
Request body:
Response: 201 Created
GET /api/dynamic/:uuid/step?step=N¶
Get choices for a specific step.
Quizzes¶
POST /api/quizz/:uuid/step¶
Save a quiz question definition.
Request body:
{
"step": 0,
"choices": ["Paris", "London", "Berlin"],
"correct": [0, 2],
"question": "Which cities are capitals?",
"media": "https://example.com/image.jpg"
}
| Field | Type | Description |
|---|---|---|
step |
number | Step number (0-based) |
choices |
string[] | Array of choice strings |
correct |
number[] | Array of 0-based indices of correct answers |
question |
string | Optional question text |
media |
string | Optional media URL (image, video, or audio) |
Response: 201 Created
GET /api/quizz/:uuid/step?step=N¶
Get a question definition with correct answers.
{
"step": 0,
"choices": ["Paris", "London", "Berlin"],
"question": "Which cities are capitals?",
"correct": [0, 2],
"timer": 0,
"startedAt": null,
"media": "https://example.com/image.jpg"
}
POST /api/quizz/:uuid/start¶
Start a question with a timer.
Request body:
Response:
POST /api/quizz/:uuid/podium¶
Broadcast the final podium to all connected clients.
Response:
POST /api/quizz/:uuid/register¶
Register a player with a pseudonym.
Response: 201 Created
GET /api/quizz/:uuid/players¶
Get all registered players.
POST /api/quizz/vote¶
Submit a quiz answer.
Request body:
{
"uuid": "0194f1e0-...",
"user_id": "0194f1e0-...",
"step": 0,
"choices": [0, 2],
"response_time_ms": 4500
}
Response:
GET /api/quizz/:uuid/scores¶
Get leaderboard or individual submissions.
Use ?user_id=UUID to get a specific player's submissions.
GET /api/quizz/:uuid/results?step=N¶
Get aggregated results for a step.
Raffles¶
POST /api/raffle/:uuid/register¶
Register a player for a raffle draw. A random pseudo is auto-assigned if not provided.
Request body:
| Field | Type | Description |
|---|---|---|
user_id |
string | Unique player identifier |
pseudo |
string | Optional display name (auto-generated if omitted) |
Response: 201 Created
POST /api/raffle/:uuid/spin¶
Spin the wheel and randomly pick a winner. Requires at least 2 registered players.
Response:
GET /api/raffle/:uuid/players¶
Get all registered players.
GET /api/raffle/:uuid/status¶
Get the current raffle status (winner and player count).
After spinning:
Pages¶
| Path | Description |
|---|---|
/raffle-admin |
Raffle admin page — UUID generation, player list, spinning wheel |
/raffle-vote#<uuid> |
Raffle player page — auto-registration, real-time win/lose result |
Flush¶
POST /api/flush/:uuid¶
Delete all votes for a poll.
Static assets¶
| Path | Content type |
|---|---|
/styles/style.css |
text/css |
/scripts/script.js |
application/javascript |
/scripts/vote.js |
application/javascript |
/scripts/result.js |
application/javascript |
/scripts/many.js |
application/javascript |
/scripts/dynamic-vote.js |
application/javascript |
/scripts/dynamic-many.js |
application/javascript |
/scripts/dynamic-result.js |
application/javascript |
/scripts/quizz-admin.js |
application/javascript |
/scripts/quizz-vote.js |
application/javascript |
/scripts/quizz-result.js |
application/javascript |
/scripts/raffle-admin.js |
application/javascript |
/scripts/raffle-vote.js |
application/javascript |
Error codes¶
| Status | Meaning |
|---|---|
200 |
Success |
201 |
Created |
204 |
No content (OPTIONS) |
400 |
Bad request / WebSocket upgrade failed |
404 |
Not found |
408 |
Timeout (quiz submission after deadline) |
422 |
Invalid UUID or request body |