Skip to content

Add a Question to a Quiz

Add a predefined question to an existing quiz.


Overview

This endpoint allows you to add a standard question to a quiz. Questions can only be added to quizzes that have not yet started.

Method: POST
Endpoint:
/api/v1/namespaces/:namespaceId/quizzes/:quizId/questions/addQuestion

Requires administrative authentication.


Request

Headers

http
x-api-key: {your_api_key}  # Required
Content-Type: application/json

Path Parameters

ParameterTypeRequiredDescription
namespaceIdstringNamespace unique ID
quizIdstringQuiz unique ID

Body Parameters

ParameterTypeRequiredDescription
idstringID of the question to add to the quiz

The id parameter must be one of the following predefined question types:

  • age
  • education
  • income
  • region
  • fin_health
  • nps
  • csat
  • emailNameZip
  • ufcu_member
  • ufcu_goodwill_employee_id
  • ethnicity
  • orientation
  • gender
  • trans

Example Request Body

json
{
  "id": "fin_health"
}

Response

json
{
  "quiz": {
    "id": "sample-quiz",
    "name": "sample-quiz",
    "primaryColor": "#9b8163",
    "createdOn": 1626101719367,
    "start": 1626246000000,
    "end": 1626417959999,
    "questions": [... ],
    "anonymous": false,
    "status": "queued"
  }
}

Error Responses

  • 500 Internal Server Error – If the namespace does not exist
json
{
  "error": "namespace does not exist"
}
  • 500 Internal Server Error – If the quiz does not exist
json
{
  "error": "quiz does not exist"
}
  • 400 Bad Request – If the quiz has already started
json
{
  "error": "Cannot modify questions after quiz has started"
}

Authorization Requirements

This endpoint requires authentication with one of the following permissions:

  • System administrator
  • Namespace administrator

Notes

  • Questions can only be added to quizzes that have not yet started
  • Only predefined question types can be added using this endpoint