Skip to main content

Bind Question API

Request to bind/unbind questions to a quiz with explicit ordering.

POST/api/v1/quizzes/bind-questions
Authentication Required

This endpoint currently requires JWT Authentication.

Authorization: Bearer <token>

Note: Support for Owner API Key (Hybrid Auth) is planned for future updates.

This endpoint performs bulk operations in a single transaction:

  1. Removes questions specified in remove array
  2. Adds/updates questions from add array with order based on array index

Array Order Semantics

The position of each question ID in the add array determines its display order:

  • Index 0 → question_order = 0 (displays first)
  • Index 1 → question_order = 1 (displays second)
  • Index N → question_order = N

Behavior

  • All operations are atomic (all succeed or all rollback)
  • Uses UPSERT pattern: if question already bound, updates ordering
  • will error if question does not exist
  • Duplicate IDs are automatically removed before processing

Validation

  • Maximum 100 questions per quiz
  • Question IDs must exist
  • question Ids in add must not in remove will enforce errors

Example Request

{
"quiz_id": 1,
"add": [
"question-uuid-1", // Will be displayed first (order=0)
"question-uuid-2", // Will be displayed second (order=1)
"question-uuid-3" // Will be displayed third (order=2)
],
"remove": [
"question-uuid-4" // Will be unbound from quiz
]
}

Response

Returns complete quiz with all bound questions in display order. See QuizWithQuestionsResponse for response structure.