Skip to main content
GET
/
quiz
/
getQuizById
/
{quizId}
Get Quiz by ID
curl --request GET \
  --url https://api.example.com/quiz/getQuizById/{quizId} \
  --header 'api-key: <api-key>'
{
  "_id": "65f3...",
  "orgId": "65f1c0f5a2b3c4d5e6f7a8b9",
  "userId": "user-123",
  "hasStarted": false,
  "hasCompleted": false,
  "quizName": "Algebra Basics Quiz",
  "questionsWithOptionsAndAnswers": [
    {
      "question_text": "What is the value of x in the equation 2x + 5 = 15?",
      "options": ["2", "5", "10", "15"],
      "correct_answer_index": 1
    }
  ]
}

Description

This endpoint retrieves the details of a specific quiz using its unique quizId. It returns all information about the quiz, including its questions, options, correct answers, and status (started/completed). Use this endpoint to fetch quiz data for display or further processing.

Example Request

curl -X GET \
  'https://b2b-api-backend-95487.ondigitalocean.app/quiz/getQuizById/{quizId}' \
  -H 'accept: application/json' \
  -H 'api-key: <your-api-key>'

Example Value

{
  "_id": "65f3...",
  "orgId": "65f1c0f5a2b3c4d5e6f7a8b9",
  "userId": "user-123",
  "hasStarted": false,
  "hasCompleted": false,
  "quizName": "Algebra Basics Quiz",
  "questionsWithOptionsAndAnswers": [
    {
      "question_text": "What is the value of x in the equation 2x + 5 = 15?",
      "options": ["2", "5", "10", "15"],
      "correct_answer_index": 1
    }
  ],
  "createdAt": "2024-03-12T10:00:00.000Z",
  "updatedAt": "2024-03-12T10:00:00.000Z"
}

Authentication

api-key
string
required
Your organisation’s API key

Path Parameters

quizId
string
required
The ID of the quiz to retrieve

Response

_id
string
MongoDB ObjectId of the quiz
orgId
string
Organisation ID
userId
string
User identifier
hasStarted
boolean
Whether the quiz has been started
hasCompleted
boolean
Whether the quiz has been completed
quizName
string
Name of the quiz
questionsWithOptionsAndAnswers
array
Array of quiz questions
{
  "_id": "65f3...",
  "orgId": "65f1c0f5a2b3c4d5e6f7a8b9",
  "userId": "user-123",
  "hasStarted": false,
  "hasCompleted": false,
  "quizName": "Algebra Basics Quiz",
  "questionsWithOptionsAndAnswers": [
    {
      "question_text": "What is the value of x in the equation 2x + 5 = 15?",
      "options": ["2", "5", "10", "15"],
      "correct_answer_index": 1
    }
  ]
}