Docs Guides

Quizzes and questions

Question banks, eight question types, pools, attempts and manual grading.

The model#

  • A question bank is a folder. Every question lives in exactly one.
  • A question is a list of immutable versions. Editing adds a version; nothing is changed in place.
  • A quiz (assessment) belongs to a course draft and holds ordered items: a pinned question version, or a pool that draws N random questions from a bank.
  • An attempt freezes the exact paper a learner sees, so results never change when the bank does.

Question types#

Option, item and pair ids are 1 to 32 characters of A-Z a-z 0-9 _ -, unique within the question.

Type body Graded
SINGLE_CHOICE {"options":[{"id","text"}], "correctOptionId"} (2 to 10 options) auto
MULTIPLE_CHOICE {"options":[…], "correctOptionIds":[…], "scoring":"ALL_OR_NOTHING"|"PARTIAL"} auto
TRUE_FALSE {"correct": true} auto
SHORT_TEXT {"acceptedAnswers":["…"], "caseSensitive": false} auto
NUMERIC {"correct": 9.81, "tolerance": 0.05} auto
ORDERING {"items":[{"id","text"}], "correctOrder":[ids]} auto
MATCHING {"pairs":[{"id","left","right"}]} auto, partial credit per pair
LONG_TEXT {"rubric":"…", "maxLength": 2000} by a person, always

Create a question#

BANK_ID=7e41743a-ffa6-461a-95cb-e0760d83c476
curl -X POST "$LMS_URL/api/v1/question-banks/$BANK_ID/questions" \
  -H "X-API-Key: $LMS_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "type": "SINGLE_CHOICE",
  "prompt": "Where do you go when the fire alarm sounds?",
  "points": 1,
  "body": {
    "options": [
      {
        "id": "a",
        "text": "The nearest safe exit"
      },
      {
        "id": "b",
        "text": "Back to my desk"
      }
    ],
    "correctOptionId": "a"
  }
}'

Build a quiz#

Create the quiz:

COURSE_ID=ecec91e5-4eb9-4c55-98de-72dbe85cae33
curl -X POST "$LMS_URL/api/v1/courses/$COURSE_ID/draft/assessments" \
  -H "X-API-Key: $LMS_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "title": "Knowledge check",
  "passPercent": 70,
  "maxAttempts": 3,
  "feedbackMode": "AFTER_ATTEMPT"
}'

Add a question (this pins its latest version):

QUIZ_ID=a5ed7659-513d-4489-950f-3bda0fe05b1f
curl -X POST "$LMS_URL/api/v1/assessments/$QUIZ_ID/items" \
  -H "X-API-Key: $LMS_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "questionId": "9d3b6e21-4a85-4f17-b0c2-7e5a1d8f3b64"
}'

Or draw 5 random questions from a bank, 2 points each:

QUIZ_ID=a5ed7659-513d-4489-950f-3bda0fe05b1f
curl -X POST "$LMS_URL/api/v1/assessments/$QUIZ_ID/items" \
  -H "X-API-Key: $LMS_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "poolBankId": "7c1d2e3f-4a5b-4c6d-8e7f-9a0b1c2d3e4f",
  "poolDrawCount": 5,
  "pointsOverride": 2
}'

Send exactly one of questionId, questionVersionId or poolBankId.

Editing questions safely#

Posting a new version never changes a quiz that already uses the question. Choose to adopt it with POST /assessment-items/{id}/upgrade, usually in a new draft.

Taking a quiz#

  1. POST /me/enrollments/{e}/assessments/{a}/attempts starts (or resumes) an attempt. Questions arrive without the answer key.
  2. PUT …/attempts/{id}/answers autosaves.
  3. POST …/attempts/{id}/submit grades.

Answer shapes:

Type Response
SINGLE_CHOICE {"optionId": "b"}
MULTIPLE_CHOICE {"optionIds": ["a","c"]}
TRUE_FALSE {"value": true}
SHORT_TEXT {"text": "torque"}
NUMERIC {"value": 9.81}
ORDERING {"order": ["2","3","1"]}
MATCHING {"matches": [{"pairId":"p1","rightId":"p1"}]}
LONG_TEXT {"text": "…"}

Rules#

  • passed is score percent ≥ passPercent. Passing completes any lesson that requires it.
  • maxAttempts counts from start. Once passed, no further attempts.
  • Time limits: answers can’t be saved after the deadline (30 seconds of grace); the attempt is graded on what was saved.
  • feedbackMode: NEVER, AFTER_ATTEMPT, or AFTER_PASS controls when learners see results and the key.

Manual grading#

An attempt with essay questions becomes NEEDS_GRADING and shows the learner no score yet. Staff work the queue:

See what is waiting:

curl -X GET "$LMS_URL/api/v1/grading/queue" \
  -H "X-API-Key: $LMS_KEY"

Open one attempt (answers, the key and the rubric):

ATTEMPT_ID=ca174553-d8b0-4963-97c9-54203cea1ed5
curl -X GET "$LMS_URL/api/v1/attempts/$ATTEMPT_ID" \
  -H "X-API-Key: $LMS_KEY"

Mark it:

ATTEMPT_ID=ca174553-d8b0-4963-97c9-54203cea1ed5
curl -X POST "$LMS_URL/api/v1/attempts/$ATTEMPT_ID/grade" \
  -H "X-API-Key: $LMS_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "grades": [
    {
      "attemptQuestionId": "c4a1f2e8-6b3d-4e97-a5c0-1d8e7f2b9a63",
      "pointsAwarded": 4,
      "feedback": "Good."
    }
  ]
}'

Type to search guides and every endpoint.