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.

Questions are the individual multiple-choice items that belong to a quiz. Each question has four options and a designated correct answer. Admin users can create, update, delete, and view questions with correct answers exposed. Regular authenticated users access a separate endpoint that omits the correct_option field so answers are not revealed before submission.

POST /api/questions

Add a new question to a quiz. Requires a valid bearer token with admin role.
quizId
number
required
ID of the quiz this question belongs to.
text
string
required
The full text of the question.
option1
string
required
First answer option.
option2
string
required
Second answer option.
option3
string
required
Third answer option.
option4
string
required
Fourth answer option.
correct_option
number
required
The number of the correct option (1–4).
Response fields — 201 Created
message
string
Confirmation message: Question created successfully.
question
object
cURL
curl --request POST \
  --url https://your-domain.com/api/questions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "quizId": 12,
    "text": "What is the determinant of a 2×2 identity matrix?",
    "option1": "0",
    "option2": "1",
    "option3": "2",
    "option4": "-1",
    "correct_option": 2
  }'

GET /api/questions/quiz/:quizId

List all questions for a quiz including the correct_option field. Intended for admin review. Requires a valid bearer token (any authenticated user).
quizId
number
required
The ID of the quiz whose questions to retrieve.
Response — 200 OK Returns an array of question objects, each including the correct_option field.
cURL
curl --request GET \
  --url https://your-domain.com/api/questions/quiz/12 \
  --header 'Authorization: Bearer <token>'

GET /api/questions/quiz/:quizId/user

List questions for a quiz without exposing correct answers. Use this endpoint when presenting questions to users taking the quiz. Requires a valid bearer token.
quizId
number
required
The ID of the quiz whose questions to retrieve.
Response — 200 OK Returns an array of question objects. The correct_option field is omitted from each item.
Always use this endpoint when rendering questions to non-admin users to prevent answer leakage.
cURL
curl --request GET \
  --url https://your-domain.com/api/questions/quiz/12/user \
  --header 'Authorization: Bearer <token>'

GET /api/questions/:id

Retrieve a single question by ID. Requires a valid bearer token.
id
number
required
The ID of the question to retrieve.
Response — 200 OK Returns the full question object including correct_option. Errors
StatusMessage
404Question not found
cURL
curl --request GET \
  --url https://your-domain.com/api/questions/55 \
  --header 'Authorization: Bearer <token>'

PUT /api/questions/:id

Update an existing question. Requires a valid bearer token with admin role.
id
number
required
The ID of the question to update.
text
string
Updated question text.
option1
string
Updated first option.
option2
string
Updated second option.
option3
string
Updated third option.
option4
string
Updated fourth option.
correct_option
number
Updated correct option number (1–4).
quizId
number
Move this question to a different quiz by providing the new quiz ID.
Response fields — 200 OK
message
string
Confirmation message.
question
object
Updated question object.
cURL
curl --request PUT \
  --url https://your-domain.com/api/questions/55 \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "option3": "4",
    "correct_option": 2
  }'

DELETE /api/questions/:id

Delete a question by ID. Requires a valid bearer token with admin role.
id
number
required
The ID of the question to delete.
Response fields — 200 OK
message
string
Confirmation message: Question deleted successfully.
cURL
curl --request DELETE \
  --url https://your-domain.com/api/questions/55 \
  --header 'Authorization: Bearer <token>'

Build docs developers (and LLMs) love