Questions are the atomic unit of learning in Sealearn. Each question belongs to a specific lesson and has aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/DerBasilisk/SEA-ServicioEvaluaconAsistida/llms.txt
Use this file to discover all available pages before exploring further.
type that governs the interaction model — from tapping a single correct option to writing Python code executed against test cases. Administrators create and review questions via this API; the AI generation endpoint lets them seed an entire lesson’s question pool from a single request. All authenticated users can report a question and submit open-ended answers for AI evaluation.
Question model
The fields below are shared by every question type. Type-specific fields are described in the table that follows.Reference to the parent Lesson document.
One of:
multiple_choice, true_false, fill_blank, order_items, match_pairs, sentence_builder, free_text, typing, code_python.The question text shown to the learner. For
sentence_builder questions, the server normalises spacing around ___ markers on save.Post-answer explanation shown regardless of whether the learner was correct.
Optional hint shown when the learner requests help. Using a hint halves
xpValue earned for a correct answer.Optional image URL displayed with the question prompt.
easy, medium, or hard. Used by the adaptive engine to compose difficulty-balanced question sets. Defaults to easy.XP earned for a correct answer. Defaults to
2. Halved when hintUsed is true.Arbitrary tags for filtering and curriculum mapping. Defaults to
[].Soft-delete flag. Inactive questions are excluded from session question pools. Defaults to
true.Whether an admin has reviewed and approved this question. AI-generated questions start with
isReviewed: false and isActive: false until approved. Defaults to false.true for questions created by the AI generation service.Identifier of the AI model used, when applicable.
Array of user-submitted reports on this question.
Type-specific fields
| Type | Required field(s) | Description |
|---|---|---|
multiple_choice | options | Array of option objects (text, isCorrect, optional explanation). At least 2 options required, at least 1 must be correct, no duplicate option text. |
true_false | correctBoolean | The correct boolean value (true or false). |
fill_blank | correctAnswers | Array of accepted answer strings. On save, the server automatically adds normalised variants (lowercase, diacritics stripped) to widen matching. caseSensitive defaults to false. |
order_items | items | Array of strings representing the correct sequence. At least 2 items required. |
match_pairs | pairs | Array of { left, right } pair objects. At least 2 pairs required. Right-column values must be unique. |
sentence_builder | wordBank, correctAnswers | wordBank: array of words (≥ 2) shown shuffled. correctAnswers: the correct word sequence. |
free_text | (none beyond prompt) | evaluationCriteria guides the AI evaluator. maxScore sets the top numeric score (default 10). isCodeExercise (boolean) hints to the AI that the answer involves code. |
typing | typingText | The exact string the user must reproduce character-for-character. |
code_python | testCases | Array of test case objects. Each requires expectedOutput (string). Optional fields: description, testType (stdout or return), callCode. At least 1 test case required, every case must have a non-empty expectedOutput. |
Endpoints
GET /api/questions
Returns all questions matching the provided filters, sorted by creation date descending. Each question has itslesson field populated with the lesson name.
Authentication: Bearer token + admin role required.
Query parameters
Filter by lesson ObjectId.
Filter by question type (e.g.
multiple_choice).Filter by difficulty:
easy, medium, or hard.Filter by review status. Pass
true or false as a string query parameter.true on success.Array of question documents.
Count of matched questions.
POST /api/questions
Creates a single question manually. All validation rules defined in the model are enforced (see the type-specific table above). Forfill_blank, the server automatically expands correctAnswers with normalised accent variants on save.
Authentication: Bearer token + admin role required.
Request body — any valid question document. See the model fields and type-specific table above for required fields.
201 Created with the new question document under data.
POST /api/questions/generate
Instructs the AI to generate a batch of questions for a lesson. The generated questions are saved withisReviewed: false and isActive: false, so they do not appear in learner sessions until an admin reviews them. The endpoint resolves the lesson’s full context (subject name, unit name, subject AI prompt context) before calling the generation service.
Authentication: Bearer token + admin role required.
Request body
ObjectId of the lesson to generate questions for.
Number of questions to generate. Defaults to
5.Desired difficulty for the generated questions:
easy, medium, or hard. Defaults to easy.Array of question types the AI may produce. Defaults to all nine types:
multiple_choice, true_false, fill_blank, order_items, match_pairs, sentence_builder, free_text, typing, code_python.true on success.Human-readable summary, e.g.
"8 preguntas generadas correctamente para la lección "Adding and Subtracting". Deben ser revisadas antes de activarse."Array of the newly created (unreviewed) question documents.
Generated questions must be approved via
PUT /api/questions/:id/review before they become available to learners. This two-step workflow lets admins catch AI mistakes before they reach production.POST /api/questions/evaluate-open
Sends a free-text or code answer to the AI for evaluation. This endpoint is available to all authenticated users and is called automatically byPOST /api/lessons/:id/answer for free_text questions, but can also be called standalone — for example, in a preview or practice mode.
Authentication: Bearer token required.
Request body
The original question text.
The learner’s answer to evaluate.
Rubric text guiding the AI. Defaults to a general relevance and comprehension rubric if omitted.
Maximum possible score the AI should award. Defaults to
10.true on success.PUT /api/questions/:id
Updates an existing question. Runs all model validators on the new values. Returns the updated document. Authentication: Bearer token + admin role required. Path parametersObjectId of the question to update.
200 OK with the updated question under data. Returns 404 if not found.
PUT /api/questions/:id/review
Reviews an AI-generated (or manually created) question. Settingapproved: true marks it as reviewed and active; approved: false deactivates it. Optionally accepts edited field values to apply before saving, enabling inline correction.
Authentication: Bearer token + admin role required.
Path parameters
ObjectId of the question to review.
true to approve and activate the question; false to reject and deactivate it. In both cases isReviewed is set to true.Optional partial question document. Fields here are merged into the update, allowing the reviewer to fix the question in the same request.
200 OK with the reviewed question document under data.
DELETE /api/questions/:id
Performs a soft delete by settingisActive: false. The question is excluded from future session question pools but its data is preserved.
Authentication: Bearer token + admin role required.
Path parameters
ObjectId of the question to deactivate.
POST /api/questions/:questionId/report
Allows any authenticated user to flag a question for admin review. The report is appended to the question’sreports array and does not immediately alter the question’s active status. Admins can then review flagged questions through the admin dashboard.
Authentication: Bearer token required.
Path parameters
ObjectId of the question to report.
The category of the problem. Must be one of:
| Value | Meaning |
|---|---|
wrong_answer | The marked correct answer is incorrect. |
unclear | The question is ambiguous or confusing. |
typo | The question or answers contain a spelling or grammar error. |
too_hard | The question is disproportionately difficult for its lesson. |
other | Any other issue (requires a comment). |
Optional free-text description of the problem. Maximum 300 characters.