Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/geeky-hamster/Quizmaster/llms.txt

Use this file to discover all available pages before exploring further.

The scores endpoints handle quiz submission and results. When a user submits a quiz, the server evaluates each answer against the stored correct options and returns a score. Users can retrieve their own attempt history and aggregate statistics. Admin users have access to scores across all users and quizzes.

POST /api/scores/submit

Submit answers for a completed quiz. The server computes the score by comparing each selected_option against the stored correct_option for the question. Requires a valid bearer token.
quiz_id
number
required
ID of the quiz being submitted.
answers
object[]
required
Array of answer objects, one per question.
time_taken
string
required
Time spent on the quiz as a string (e.g. "18:42").
Response fields — 201 Created
message
string
Confirmation message: Quiz submitted successfully.
score
object
percentage
number
Score expressed as a percentage (0–100).
Errors
StatusMessage
400No questions found for this quiz
404Quiz not found
cURL
curl --request POST \
  --url https://your-domain.com/api/scores/submit \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "quiz_id": 12,
    "answers": [
      { "question_id": 55, "selected_option": 2 },
      { "question_id": 56, "selected_option": 1 },
      { "question_id": 57, "selected_option": 4 }
    ],
    "time_taken": "18:42"
  }'

GET /api/scores/user

Retrieve all quiz attempts for the currently authenticated user, ordered by most recent first. Requires a valid bearer token. No request body. Response — 200 OK Returns an array of score objects, each including a nested quiz object. Items are ordered descending by time_stamp_of_attempt.
id
number
Score record ID.
quiz_id
number
Quiz ID.
user_id
number
User ID.
time_stamp_of_attempt
string
Attempt timestamp.
total_questions
number
Total questions in the quiz.
total_scored
number
Correct answers.
time_taken
string
Time taken.
quiz
object
The associated quiz object.
cURL
curl --request GET \
  --url https://your-domain.com/api/scores/user \
  --header 'Authorization: Bearer <token>'

GET /api/scores/user/stats

Retrieve aggregate performance statistics for the currently authenticated user. Requires a valid bearer token. No request body. Response fields — 200 OK
totalQuizzes
number
Total number of quizzes the user has attempted.
totalQuestions
number
Total number of questions answered across all attempts.
totalCorrect
number
Total number of correct answers across all attempts.
averageScore
number
Average score expressed as a percentage (0–100).
cURL
curl --request GET \
  --url https://your-domain.com/api/scores/user/stats \
  --header 'Authorization: Bearer <token>'

GET /api/scores/quiz/:quizId

List all scores for a specific quiz, including user details. Requires a valid bearer token with admin role.
quizId
number
required
The ID of the quiz whose scores to retrieve.
Response — 200 OK Returns an array of score objects. Each object includes a nested user object with basic identity fields.
id
number
Score record ID.
quiz_id
number
Quiz ID.
user_id
number
User ID.
time_stamp_of_attempt
string
Attempt timestamp.
total_questions
number
Total questions.
total_scored
number
Correct answers.
time_taken
string
Time taken.
user
object
cURL
curl --request GET \
  --url https://your-domain.com/api/scores/quiz/12 \
  --header 'Authorization: Bearer <token>'

GET /api/scores

List all scores across every quiz and user. Requires a valid bearer token with admin role. No request body. Response — 200 OK Returns an array of score objects, each including nested quiz and user objects.
cURL
curl --request GET \
  --url https://your-domain.com/api/scores \
  --header 'Authorization: Bearer <token>'

Build docs developers (and LLMs) love