Skip to content

Create a Quiz

Create a new quiz within a namespace.


Overview

This endpoint allows you to create a new quiz with customizable appearance, behavior, and scheduling options.

Method: POST
Endpoint:
/api/v1/namespaces/:namespaceId/quizzes

Requires administrative authentication.


Request

Headers

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

Path Parameters

ParameterTypeRequiredDescription
namespaceIdstringNamespace unique ID

Body Parameters

ParameterTypeRequiredDescription
namestringName of the quiz
startdateJavaScript timestamp when the quiz becomes active, must be in the future
enddateJavaScript timestamp when the quiz closes, must be in the future
questionsarrayArray of question objects, each containing an id from predefined question types and optional required boolean
primaryColorstringHex color code for the quiz theme (#RRGGBB or #RGB format)
retryAfterDaysintegerNumber of days to wait before retry, must be 0 (for no retry) or greater
anonymousbooleanIndicates if the quiz allows anonymous responses (defaults to true)
inappbooleanIndicates if the quiz is of the "InApp" type (defaults to false)
disableEmailingbooleanPrevents the quiz from sending emails (defaults to true)
customIntroScreenobjectCustom introduction screen configuration
customOutroScreenobjectCustom conclusion screen configuration
customLogostring/objectCustom logo URL or object
demographicMessagestringCustom message for demographic section
hasCustomIntrobooleanIndicates if quiz uses custom intro screen
hasCustomOutrobooleanIndicates if quiz uses custom outro screen
customCTAobjectCustom call-to-action configuration
fhscorebooleanEnable financial health scoring for user results page (defaults to false)
customRecommendationCardobjectCustom recommendation card configuration

customIntroScreen Object

FieldTypeRequiredDescription
headerMessagestringHeader text for intro screen. Can be empty
mainMessagestringMain body text for intro screen. Can be empty
buttonMessagestringCustom text for start button. Can be empty
footnoteMessagestringFooter text for intro screen. Can be empty
customLogoUrlstringURL for custom logo on intro screen
inheritLogobooleanWhether to inherit logo from namespace

customOutroScreen Object

FieldTypeRequiredDescription
outroMessagestringMessage displayed on completion screen if hasCustomOutro is true

customCTA Object

FieldTypeRequiredDescription
ctaLinkstringURL for call-to-action. Can be empty
ctaTitlestringTitle for call-to-action (max 65 chars)
ctaButtonstringButton text for CTA (max 50 chars)
ctaDescriptionstringDescription text for CTA (max 320 chars)
stickybooleanWhether CTA should be sticky

customRecommendationCard Object

This is where the recommendations live, and they can be customized. Each key in this object represents a card ID. The keys must be the following:

  • fhn1
  • fhn2
  • fhn3
  • fhn4
  • fhn5
  • fhn6
  • fhn7
  • fhn8

Empty text fields will have a default set value, except for the CTA links. The customRecommendationCard object has the following properties:

FieldTypeRequiredDescription
titlestringCard title. Can be empty
subtitlestringCard subtitle. Can be empty
recommendationTitlestringTitle for recommendations. Can be empty
recommendationsarrayArray of recommendation strings
CTA1ButtonstringText for first CTA button. Can be empty
CTA1LinkstringURL for first CTA. Can be empty
CTA2ButtonstringText for second CTA button. Can be empty
CTA2LinkstringURL for second CTA. Can be empty
CTA3ButtonstringText for third CTA button. Can be empty
CTA3LinkstringURL for third CTA. Can be empty

Example Request Body

json
{
  "name": "Employee Satisfaction Survey",
  "primaryColor": "#3366ff",
  "start": 1626246000000,
  "end": 1626417959999,
  "anonymous": true,
  "disableEmailing": true,
  "customIntroScreen": {
    "headerMessage": "Annual Employee Survey",
    "mainMessage": "Help us improve your workplace experience",
    "buttonMessage": "Start Survey"
  },
  "questions": [
    {
      "id": "fin_health",
      "required": true
    },
    {
      "id": "nps",
      "required": false
    }
  ]
}

Response

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

Notes

  • Demo namespaces and namespaces with a yearly quiz allocation have a limit on the number of quizzes that can be created
  • The quiz is created with a status of "queued" and will become active at the specified start time