Loading…
Production-ready quiz platform backend: JWT auth with rotating refresh tokens, RBAC (guest / user / instructor / admin / super admin), quizzes, attempts, leaderboards, certificates, notifications, analytics, reports, audit trails and user tracking.
/api/auth/registerCreate an account and receive an access + refresh token pair
Request body
{
"type": "object",
"required": [
"name",
"email",
"password"
],
"properties": {
"name": {
"type": "string",
"minLength": 2
},
"email": {
"type": "string",
"format": "email"
},
"password": {
"type": "string",
"minLength": 8
}
}
}Responses
/api/auth/loginSign in with email + password
Request body
{
"type": "object",
"required": [
"email",
"password"
],
"properties": {
"email": {
"type": "string",
"format": "email"
},
"password": {
"type": "string"
}
}
}Responses
/api/auth/refreshRotate a refresh token (old token is revoked, same family)
Request body
{
"type": "object",
"required": [
"refreshToken"
],
"properties": {
"refreshToken": {
"type": "string"
}
}
}Responses
/api/auth/logoutRevoke the presented refresh token and close its session
Request body
{
"type": "object",
"required": [
"refreshToken"
],
"properties": {
"refreshToken": {
"type": "string"
}
}
}Responses
/api/auth/logout-all BearerRevoke every refresh token for the signed-in user
Responses
/api/auth/me BearerFetch the current user from the access token
Responses
/api/categoriesList categories with quiz counts (cached)
Responses
/api/quizzesBrowse quizzes with search / category / difficulty / sort / pagination
Parameters
id | query | Fetch a single full quiz by id | string |
search | query | string | |
category | query | string | |
difficulty | query | (easy, medium, hard) | string |
sort | query | (popular, newest, rating, title) | string |
page | query | integer | |
pageSize | query | integer |
Responses
/api/quizzes/{id}/playFetch a quiz for playing (answers stripped)
Parameters
idrequired | path | string |
Responses
/api/quizzes/{id}/rateRate a quiz 1–5 stars. Registered users get one vote per account; guests one per IP. The quiz's displayed rating blends these votes with the performance-derived rating.
Request body
{
"type": "object",
"required": [
"rating"
],
"properties": {
"rating": {
"type": "integer",
"minimum": 1,
"maximum": 5
}
}
}Responses
/api/quizzes/{id}/rateThe caller's own rating for a quiz (null when they haven't voted)
Responses
/api/attemptsSubmit a quiz attempt — registered and guest attempts persist, roll the quiz's plays/rating/average score, and capture IP + location
Request body
{
"type": "object",
"required": [
"quizId",
"answers",
"durationSeconds"
],
"properties": {
"quizId": {
"type": "string"
},
"durationSeconds": {
"type": "integer",
"minimum": 0
},
"answers": {
"type": "array",
"items": {
"type": "object",
"properties": {
"questionId": {
"type": "string"
},
"selectedOptionIds": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
}Responses
/api/leaderboardRankings — global or per quiz, filtered by period
Parameters
scope | query | (global, quiz) | string |
quizId | query | string | |
period | query | (all, week, month) | string |
limit | query | integer |
Responses
/api/certificates/verifyVerify a certificate by its code
Parameters
coderequired | query | string |
Responses
/api/users/me/dashboard BearerDashboard data: stats, attempts, bookmarks, certificates, achievements
Responses
/api/users/me/attempts BearerList the signed-in user's attempts
Responses
/api/users/me/bookmarks BearerList the signed-in user's bookmarks
Responses
/api/users/me/bookmarks/{quizId} BearerToggle a bookmark for a quiz
Parameters
quizIdrequired | path | string |
Responses
/api/users/me/certificates BearerList the signed-in user's certificates
Responses
/api/notifications BearerList notifications + unread count
Parameters
limit | query | integer |
Responses
/api/notifications BearerBroadcast a notification to every user (staff)
Request body
{
"type": "object",
"required": [
"title",
"body"
],
"properties": {
"title": {
"type": "string"
},
"body": {
"type": "string"
},
"link": {
"type": "string"
}
}
}Responses
/api/notifications/read BearerMark one notification (id) or all (all: true) as read
Request body
{
"type": "object",
"properties": {
"id": {
"type": "string"
},
"all": {
"type": "boolean"
}
}
}Responses
/api/admin/stats BearerAggregate admin statistics (cached)
Responses
/api/admin/analytics BearerDeep analytics: retention, difficulty mix, geography, per-day/per-quiz/per-category, top users & quizzes
Responses
/api/admin/attempts BearerList every attempt (registered + guest) with user, quiz, IP and location
Parameters
limit | query | integer |
Responses
/api/admin/guests BearerAnonymous visitor analytics — per-device breakdown, locations, top quizzes, recent guest attempts
Parameters
guestId | query | A guest device id (e.g. `guest-a1b2c3d4e5`) to view one visitor's full attempt history | string |
Responses
/api/admin/users BearerList all users
Responses
/api/admin/users/{id} BearerUpdate a user's role (audited)
Parameters
idrequired | path | string |
Request body
{
"type": "object",
"required": [
"role"
],
"properties": {
"role": {
"type": "string",
"enum": [
"user",
"instructor",
"admin",
"super_admin"
]
}
}
}Responses
/api/admin/users/{id} BearerDelete a user (audited)
Parameters
idrequired | path | string |
Responses
/api/admin/quizzes BearerList quizzes (staff view)
Responses
/api/admin/quizzes BearerCreate a quiz with questions (audited)
Request body
{
"type": "object",
"required": [
"title",
"categoryId"
],
"properties": {
"title": {
"type": "string"
},
"categoryId": {
"type": "string"
}
}
}Responses
/api/admin/quizzes/{id} BearerFetch a full quiz (with questions)
Parameters
idrequired | path | string |
Responses
/api/admin/quizzes/{id} BearerUpdate a quiz (audited)
Parameters
idrequired | path | string |
Responses
/api/admin/quizzes/{id} BearerDelete a quiz and its questions (audited)
Parameters
idrequired | path | string |
Responses
/api/admin/questions BearerList questions (optionally filtered by quizId)
Responses
/api/admin/questions BearerCreate a question (audited)
Responses
/api/admin/questions/{id} BearerUpdate a question (audited)
Parameters
idrequired | path | string |
Responses
/api/admin/questions/{id} BearerDelete a question (audited)
Parameters
idrequired | path | string |
Responses
/api/admin/categories BearerList categories (staff view)
Responses
/api/admin/categories BearerCreate a category (audited)
Responses
/api/admin/categories/{id} BearerUpdate a category (audited)
Parameters
idrequired | path | string |
Responses
/api/admin/categories/{id} BearerDelete a category (audited)
Parameters
idrequired | path | string |
Responses
/api/admin/reports BearerExport a report (attempts / users / quizzes / activity) as JSON or CSV
Parameters
typerequired | query | (attempts, users, quizzes, activity) | string |
format | query | (json, csv) | string |
from | query | string | |
to | query | string |
Responses
/api/admin/audit-logs BearerList recent audit log entries (staff actions)
Parameters
limit | query | integer |
Responses
/api/docs/openapi.jsonThis OpenAPI specification
Responses