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
namespaceIdstring✅Namespace unique ID

Body Parameters ​

ParameterTypeRequiredDescription
namestring✅Name of the quiz
startdate✅JavaScript timestamp when the quiz becomes active, must be in the future
enddate✅JavaScript timestamp when the quiz closes, must be in the future
questionsarray❌Array of question objects, each containing an id from predefined question types and optional required boolean
primaryColorstring❌Hex color code for the quiz theme (#RRGGBB or #RGB format)
retryAfterDaysinteger❌Number of days to wait before retry, must be 0 (for no retry) or greater
anonymousboolean❌Indicates if the quiz allows anonymous responses (defaults to true)
inappboolean❌Indicates if the quiz is of the "InApp" type (defaults to false)
disableEmailingboolean❌Prevents the quiz from sending emails (defaults to true)
customIntroScreenobject❌Custom introduction screen configuration
customOutroScreenobject❌Custom conclusion screen configuration
customLogostring/object❌Custom logo URL or object
demographicMessagestring❌Custom message for demographic section
hasCustomIntroboolean❌Indicates if quiz uses custom intro screen
hasCustomOutroboolean❌Indicates if quiz uses custom outro screen
customCTAobject❌Custom call-to-action configuration
fhscoreboolean❌Enable financial health scoring for user results page (defaults to false)
customRecommendationCardobject❌Custom recommendation card configuration

customIntroScreen Object ​

FieldTypeRequiredDescription
headerMessagestring❌Header text for intro screen. Can be empty
mainMessagestring❌Main body text for intro screen. Can be empty
buttonMessagestring❌Custom text for start button. Can be empty
footnoteMessagestring❌Footer text for intro screen. Can be empty
customLogoUrlstring❌URL for custom logo on intro screen
inheritLogoboolean❌Whether to inherit logo from namespace

customOutroScreen Object ​

FieldTypeRequiredDescription
outroMessagestring❌Message displayed on completion screen if hasCustomOutro is true

customCTA Object ​

FieldTypeRequiredDescription
ctaLinkstring❌URL for call-to-action. Can be empty
ctaTitlestring❌Title for call-to-action (max 65 chars)
ctaButtonstring❌Button text for CTA (max 50 chars)
ctaDescriptionstring❌Description text for CTA (max 320 chars)
stickyboolean❌Whether 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
titlestring❌Card title. Can be empty
subtitlestring❌Card subtitle. Can be empty
recommendationTitlestring❌Title for recommendations. Can be empty
recommendationsarray❌Array of recommendation strings
CTA1Buttonstring❌Text for first CTA button. Can be empty
CTA1Linkstring❌URL for first CTA. Can be empty
CTA2Buttonstring❌Text for second CTA button. Can be empty
CTA2Linkstring❌URL for second CTA. Can be empty
CTA3Buttonstring❌Text for third CTA button. Can be empty
CTA3Linkstring❌URL 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