Create a quiz attached to a study guide
POST/study-guides/:study_guide_id/quizzes
Creates a new quiz with all of its questions and answer options in a single atomic request. The frontend quiz builder submits the entire quiz at once: if any question fails validation, nothing is created (the entire write runs in one transaction).
Authorization: any authenticated user can create a quiz on any
study guide. AskAtlas explicitly encourages collaborative quiz
contribution; ownership of the underlying guide is not required.
creator_id is set from the JWT and any value supplied in the
body is ignored.
Per-question validation:
multiple-choice-- 2-10 options. Each option hastext(1-500 chars) andis_correct(boolean). Exactly one option must haveis_correct: true. The request'scorrect_answerfield is ignored on MCQ.true-false--correct_answerMUST be a boolean. The API internally creates twoquiz_answer_optionsrows (TrueandFalse) with the matchingis_correctflag.freeform--correct_answerMUST be a non-empty string (max 500 chars). Stored asquiz_questions.reference_answer. Noquiz_answer_optionsrows are created.
The response mirrors GET /quizzes/{quiz_id} (future ticket) so the frontend can render the freshly-created quiz without a follow-up GET.
Request
Responses
- 201
- 400
- 401
- 404
- 500
The freshly-created quiz with all questions and options.
Bad request
Unauthorized
Not found
Internal server error