Skip to main content
PUT
/
quiz
/
endQuiz
/
{quizId}
End Quiz
curl --request PUT \
  --url https://api.example.com/quiz/endQuiz/{quizId} \
  --header 'api-key: <api-key>'
{
  "_id": "65f3...",
  "orgId": "65f1c0f5a2b3c4d5e6f7a8b9",
  "userId": "user-123",
  "hasStarted": true,
  "hasCompleted": true,
  "quizName": "Algebra Basics Quiz",
  "questionsWithOptionsAndAnswers": [...]
}

Description

This endpoint marks a quiz as completed using its unique quizId. It updates the quiz status to indicate that the user has finished the quiz. Use this endpoint to finalize quiz attempts and record completion in your application.

Example Request

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

Authentication

api-key
string
required
Your organisation’s API key

Path Parameters

quizId
string
required
The ID of the quiz to complete

Response

Returns the updated quiz object with hasCompleted set to true.
_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
Set to true after this operation
quizName
string
Name of the quiz
questionsWithOptionsAndAnswers
array
Array of quiz questions
{
  "_id": "65f3...",
  "orgId": "65f1c0f5a2b3c4d5e6f7a8b9",
  "userId": "user-123",
  "hasStarted": true,
  "hasCompleted": true,
  "quizName": "Algebra Basics Quiz",
  "questionsWithOptionsAndAnswers": [...]
}