> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# CreateQuiz

# Package: onlinePrograms

# Namespace: QuizService

# Method link: https://dev.wix.com/docs/api-reference/business-management/online-programs/quizzes/create-quiz.md

## Permission Scopes:
Manage Online Programs: SCOPE.CHALLENGES.MANAGE

## Introduction

Creates a detached quiz definition with at least one question.

To use the quiz in an Online Program, specify the returned quiz ID as `step.quizOptions.id` when calling the Steps API's [Create Step](https://dev.wix.com/docs/api-reference/business-management/online-programs/steps/create-step.md) or [Bulk Create Steps](https://dev.wix.com/docs/api-reference/business-management/online-programs/steps/bulk-create-steps.md) method.

To create multiple quiz definitions in a single API call, call [Bulk Create Quizzes](https://dev.wix.com/docs/api-reference/business-management/online-programs/quizzes/bulk-create-quizzes.md).

---

## REST API

### Schema

```
 Method: createQuiz
 Description: Creates a detached quiz definition with at least one question.  To use the quiz in an Online Program, specify the returned quiz GUID as `step.quizOptions.id` when calling the Steps API's [Create Step](https://dev.wix.com/docs/api-reference/business-management/online-programs/steps/create-step.md) or [Bulk Create Steps](https://dev.wix.com/docs/api-reference/business-management/online-programs/steps/bulk-create-steps.md) method.  To create multiple quiz definitions in a single API call, call [Bulk Create Quizzes](https://dev.wix.com/docs/api-reference/business-management/online-programs/quizzes/bulk-create-quizzes.md).
 URL: https://www.wixapis.com/online-programs/v1/quizzes
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  quiz, quiz.fields, quiz.fields.id, quiz.fields.target, quiz.fields.question
 Method parameters: 
   param name: quiz | type: Quiz | description: A quiz definition used by an Online Programs quiz step.  Create or clone a quiz, then assign the returned quiz GUID to `step.quizOptions.id` when creating an Online Programs step. Quiz GUIDs are intentionally discovered through quiz-type steps rather than through a Quiz list or query method.  New submissions are evaluated against the quiz definition that exists when the submission is created. Previously stored submissions retain their recorded grades and answer evaluations if the definition changes later. | required: true 
        - name: settings | type: QuizSettings | description: Quiz title, passing grade, and attempt limit. New submissions use the current settings; stored submissions retain their recorded grade data.  
           - name: passingGrade | type: integer | description: Minimum unweighted integer percentage required to pass. The earned grade is calculated as `floor((correct answer count / submitted answer count) * 100)`; question `score` values don't weight it. Non-evaluable answers count as correct. If omitted, the submission has no earned or passing grade and its status is COMPLETED, even if an individual evaluated answer is incorrect.  | validation: minimum 0, maximum 100, format int32
           - name: title | type: string | description: Quiz title.  | validation: maxLength 200
           - name: attempts | type: integer | description: Maximum number of submissions allowed per submitter. If omitted, no attempt-limit check is applied. Submissions grouped together share an attempt count, even across quizzes. See [Attempt limits](https://dev.wix.com/docs/api-reference/business-management/online-programs/quizzes/quiz-grading.md#attempt-limits) for how submissions are counted.  | validation: minimum 1, format int32
        - name: fields | type: array<QuizField> | description: Active questions in the quiz. Each `QuizField` defines one question and its answer input. Creating or cloning a quiz requires at least one active question. A retrieved quiz can have an empty list after all its questions have been deleted. Check for active questions before displaying or reusing it.  New submissions use the current questions; stored submissions retain their recorded answer evaluations. | required: true | validation: minItems 1, maxItems 200
           - ONE-OF: 
              - name: numeric | type: NumericField | description: Numeric input.  
                 - name: rightAnswer | type: number | description: Correct numeric value. Matching is exact. If no correct value is stored for this question, its submitted answer is non-evaluable and counts as correct when calculating the earned grade.  Omitted from responses when the caller can't access answer keys. Hidden answers still participate in grading; an absent response value doesn't mean no correct value is stored.  | validation: format double
              - name: shortText | type: ShortTextField | description: Short-text input.  
                 - name: rightAnswer | type: string | description: Correct text. Matching trims leading and trailing whitespace and is case-insensitive. If no correct text is stored for this question, its submitted answer is non-evaluable and counts as correct when calculating the earned grade.  Omitted from responses when the caller can't access answer keys. Hidden answers still participate in grading; an absent response value doesn't mean no correct text is stored.  | validation: minLength 1, maxLength 200
              - name: longText | type: LongTextField | description: Long-text input. Set this to an empty object (`{}`) to select it.  
       EMPTY-OBJECT {}
              - name: singleChoice | type: SingleChoiceField | description: Input with predefined options where only one option can be selected.  
                 - name: rightAnswer | type: string | description: Correct option. When supplied, it must exactly match an entry in `options`; otherwise, creation fails with INVALID_QUIZ. Matching submitted answers is exact. If no correct option is stored for this question, its submitted answer is non-evaluable and counts as correct when calculating the earned grade.  Omitted from responses when the caller can't access answer keys. Hidden answers still participate in grading; an absent response value doesn't mean no correct option is stored.  | validation: minLength 1, maxLength 350
                 - name: options | type: array<string> | description: Options available to the participant. Labels must be unique; comparison is case-sensitive. Duplicate labels are rejected with INVALID_QUIZ before creation.  | validation: minItems 1, maxItems 90, minLength 1, maxLength 350
              - name: multiChoice | type: MultiChoiceField | description: Input with predefined options where multiple options can be selected.  
                 - name: rightAnswer | type: array<string> | description: Correct options. Every supplied value must exactly match an entry in `options`; otherwise, creation fails with INVALID_QUIZ. Matching submitted answers ignores option order but doesn't ignore duplicate values. If no correct options are stored for this question, its submitted answer is non-evaluable and counts as correct when calculating the earned grade.  Empty in responses when the caller can't access answer keys. Hidden answers still participate in grading; an empty response list doesn't mean no correct options are stored.  | validation: minItems 0, maxItems 90, minLength 1, maxLength 350
                 - name: options | type: array<string> | description: Options available to the participant.  | validation: minItems 1, maxItems 90, minLength 1, maxLength 350
              - name: fileUpload | type: FileUploadField | description: File-upload input.  
                 - name: buttonText | type: string | description: Text displayed on the upload button.  Default: `Upload`.  | validation: minLength 1, maxLength 100
                 - name: itemsLimit | type: integer | description: Maximum number of files a participant can upload for this question.  Default: `10`.  | validation: minimum 1, maximum 10, format int32
                 - name: fileUploadFormats | type: array<FileUploadFormat> | description: Wix Forms file categories that participants can upload.  Specify at least one format. `UNKNOWN_FILE_UPLOAD_FORMAT` isn't supported as a format selection. File-upload answers aren't evaluated and count as correct when calculating the earned grade.  | validation: maxItems 6
                         - enum:
                         -     IMAGE: Image-file category.
                         -     VIDEO: Video-file category.
                         -     AUDIO: Audio-file category.
                         -     DOCUMENT: Document-file category.
                         -     ARCHIVE: Archive-file category.
                         -     MODEL_3D: 3D-model-file category.
           - name: id | type: string | description: Caller-generated GUGUID that identifies this question. Use a stable value that is unique within the quiz. Submission answer evaluations use this GUID to identify the question.  | validation: format GUID, immutable
           - name: target | type: string | description: Stable key used to match a submitted answer to this question. Use a value that is unique within the quiz and don't change or reuse it for another question.  | validation: maxLength 200, immutable
           - name: question | type: string | description: Question text.  | validation: minLength 1, maxLength 350
           - name: score | type: number | description: Score returned for evaluable answers, whether correct or incorrect. Omitted from non-evaluable answer evaluations. This value doesn't weight the submission's unweighted `earnedGrade` percentage.  | validation: format double
           - name: rightMessage | type: string | description: Feedback returned when an evaluable submitted answer is correct. Omitted for non-evaluable answers.  | validation: maxLength 350
           - name: wrongMessage | type: string | description: Feedback returned when an evaluable submitted answer is incorrect. Omitted for non-evaluable answers.  | validation: maxLength 350
 Return type: CreateQuizResponse
  - name: quiz | type: Quiz | description: Created quiz definition. Assign its `id` to `step.quizOptions.id` to create an Online Programs quiz step.  
     - name: id | type: string | description: Quiz GUID.  | read-only: true | validation: format GUID
     - name: settings | type: QuizSettings | description: Quiz title, passing grade, and attempt limit. New submissions use the current settings; stored submissions retain their recorded grade data.  
        - name: passingGrade | type: integer | description: Minimum unweighted integer percentage required to pass. The earned grade is calculated as `floor((correct answer count / submitted answer count) * 100)`; question `score` values don't weight it. Non-evaluable answers count as correct. If omitted, the submission has no earned or passing grade and its status is COMPLETED, even if an individual evaluated answer is incorrect.  | validation: minimum 0, maximum 100, format int32
        - name: title | type: string | description: Quiz title.  | validation: maxLength 200
        - name: attempts | type: integer | description: Maximum number of submissions allowed per submitter. If omitted, no attempt-limit check is applied. Submissions grouped together share an attempt count, even across quizzes. See [Attempt limits](https://dev.wix.com/docs/api-reference/business-management/online-programs/quizzes/quiz-grading.md#attempt-limits) for how submissions are counted.  | validation: minimum 1, format int32
     - name: revision | type: string | description: Current revision of the stored quiz definition. The revision changes when the definition changes. The public Quiz API doesn't currently provide an update method.  | read-only: true | validation: format int64
     - name: createdDate | type: string | description: Date and time the quiz was created.  | read-only: true | validation: format date-time
     - name: updatedDate | type: string | description: Date and time the quiz was last updated.  | read-only: true | validation: format date-time
     - name: fields | type: array<QuizField> | description: Active questions in the quiz. Each `QuizField` defines one question and its answer input. Creating or cloning a quiz requires at least one active question. A retrieved quiz can have an empty list after all its questions have been deleted. Check for active questions before displaying or reusing it.  New submissions use the current questions; stored submissions retain their recorded answer evaluations.  | validation: minItems 1, maxItems 200
        - ONE-OF: 
           - name: numeric | type: NumericField | description: Numeric input.  
              - name: rightAnswer | type: number | description: Correct numeric value. Matching is exact. If no correct value is stored for this question, its submitted answer is non-evaluable and counts as correct when calculating the earned grade.  Omitted from responses when the caller can't access answer keys. Hidden answers still participate in grading; an absent response value doesn't mean no correct value is stored.  | validation: format double
           - name: shortText | type: ShortTextField | description: Short-text input.  
              - name: rightAnswer | type: string | description: Correct text. Matching trims leading and trailing whitespace and is case-insensitive. If no correct text is stored for this question, its submitted answer is non-evaluable and counts as correct when calculating the earned grade.  Omitted from responses when the caller can't access answer keys. Hidden answers still participate in grading; an absent response value doesn't mean no correct text is stored.  | validation: minLength 1, maxLength 200
           - name: longText | type: LongTextField | description: Long-text input. Set this to an empty object (`{}`) to select it.  
      EMPTY-OBJECT {}
           - name: singleChoice | type: SingleChoiceField | description: Input with predefined options where only one option can be selected.  
              - name: rightAnswer | type: string | description: Correct option. When supplied, it must exactly match an entry in `options`; otherwise, creation fails with INVALID_QUIZ. Matching submitted answers is exact. If no correct option is stored for this question, its submitted answer is non-evaluable and counts as correct when calculating the earned grade.  Omitted from responses when the caller can't access answer keys. Hidden answers still participate in grading; an absent response value doesn't mean no correct option is stored.  | validation: minLength 1, maxLength 350
              - name: options | type: array<string> | description: Options available to the participant. Labels must be unique; comparison is case-sensitive. Duplicate labels are rejected with INVALID_QUIZ before creation.  | validation: minItems 1, maxItems 90, minLength 1, maxLength 350
           - name: multiChoice | type: MultiChoiceField | description: Input with predefined options where multiple options can be selected.  
              - name: rightAnswer | type: array<string> | description: Correct options. Every supplied value must exactly match an entry in `options`; otherwise, creation fails with INVALID_QUIZ. Matching submitted answers ignores option order but doesn't ignore duplicate values. If no correct options are stored for this question, its submitted answer is non-evaluable and counts as correct when calculating the earned grade.  Empty in responses when the caller can't access answer keys. Hidden answers still participate in grading; an empty response list doesn't mean no correct options are stored.  | validation: minItems 0, maxItems 90, minLength 1, maxLength 350
              - name: options | type: array<string> | description: Options available to the participant.  | validation: minItems 1, maxItems 90, minLength 1, maxLength 350
           - name: fileUpload | type: FileUploadField | description: File-upload input.  
              - name: buttonText | type: string | description: Text displayed on the upload button.  Default: `Upload`.  | validation: minLength 1, maxLength 100
              - name: itemsLimit | type: integer | description: Maximum number of files a participant can upload for this question.  Default: `10`.  | validation: minimum 1, maximum 10, format int32
              - name: fileUploadFormats | type: array<FileUploadFormat> | description: Wix Forms file categories that participants can upload.  Specify at least one format. `UNKNOWN_FILE_UPLOAD_FORMAT` isn't supported as a format selection. File-upload answers aren't evaluated and count as correct when calculating the earned grade.  | validation: maxItems 6
                     - enum:
                     -     IMAGE: Image-file category.
                     -     VIDEO: Video-file category.
                     -     AUDIO: Audio-file category.
                     -     DOCUMENT: Document-file category.
                     -     ARCHIVE: Archive-file category.
                     -     MODEL_3D: 3D-model-file category.
        - name: id | type: string | description: Caller-generated GUGUID that identifies this question. Use a stable value that is unique within the quiz. Submission answer evaluations use this GUID to identify the question.  | validation: format GUID, immutable
        - name: target | type: string | description: Stable key used to match a submitted answer to this question. Use a value that is unique within the quiz and don't change or reuse it for another question.  | validation: maxLength 200, immutable
        - name: question | type: string | description: Question text.  | validation: minLength 1, maxLength 350
        - name: score | type: number | description: Score returned for evaluable answers, whether correct or incorrect. Omitted from non-evaluable answer evaluations. This value doesn't weight the submission's unweighted `earnedGrade` percentage.  | validation: format double
        - name: rightMessage | type: string | description: Feedback returned when an evaluable submitted answer is correct. Omitted for non-evaluable answers.  | validation: maxLength 350
        - name: wrongMessage | type: string | description: Feedback returned when an evaluable submitted answer is incorrect. Omitted for non-evaluable answers.  | validation: maxLength 350

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: INVALID_QUIZ | Description: The quiz definition is invalid.
   HTTP Code: 409 | Status Code: ALREADY_EXISTS | Application Code: QUIZ_CONFLICT | Description: Couldn't create the quiz because of a conflict. This doesn't necessarily mean the quiz already exists. If the conflict persists, contact support with the request GUID.


```

### Examples

### Create a quiz definition
Create a geography quiz with one multiple-choice question, a passing grade of 70%, and up to 3 attempts. Replace <AUTH> with your authorization token and generate a new UUID for each question. Save the returned quiz ID for subsequent requests. Sample response adapted from a successful request; titles updated for readability.

```curl
curl -X POST \
'https://www.wixapis.com/online-programs/v1/quizzes' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
-d '{
  "quiz": {
    "settings": {
      "title": "Introduction to French Geography",
      "passingGrade": 70,
      "attempts": 3
    },
    "fields": [
      {
        "id": "15a49936-aa7c-41e2-9edd-556ef9956b0d",
        "target": "capitalOfFrance",
        "question": "What is the capital of France?",
        "score": 1,
        "rightMessage": "Correct.",
        "wrongMessage": "Try again.",
        "singleChoice": {
          "rightAnswer": "Paris",
          "options": [
            "Paris",
            "Lyon",
            "Marseille"
          ]
        }
      }
    ]
  }
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.onlinePrograms.quizzes.createQuiz(quiz)
 Description: Creates a detached quiz definition with at least one question.  To use the quiz in an Online Program, specify the returned quiz GUID as `step.quizOptions.id` when calling the Steps API's [Create Step](https://dev.wix.com/docs/api-reference/business-management/online-programs/steps/create-step.md) or [Bulk Create Steps](https://dev.wix.com/docs/api-reference/business-management/online-programs/steps/bulk-create-steps.md) method.  To create multiple quiz definitions in a single API call, call [Bulk Create Quizzes](https://dev.wix.com/docs/api-reference/business-management/online-programs/quizzes/bulk-create-quizzes.md).
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  quiz, quiz.fields, quiz.fields._id, quiz.fields.target, quiz.fields.question, quiz.fields.singleChoice.options, quiz.fields.multiChoice.options
 Method parameters: 
   param name: quiz | type: Quiz | description: A quiz definition used by an Online Programs quiz step.  Create or clone a quiz, then assign the returned quiz GUID to `step.quizOptions.id` when creating an Online Programs step. Quiz GUIDs are intentionally discovered through quiz-type steps rather than through a Quiz list or query method.  New submissions are evaluated against the quiz definition that exists when the submission is created. Previously stored submissions retain their recorded grades and answer evaluations if the definition changes later. | required: true 
        - name: settings | type: QuizSettings | description: Quiz title, passing grade, and attempt limit. New submissions use the current settings; stored submissions retain their recorded grade data.  
           - name: passingGrade | type: integer | description: Minimum unweighted integer percentage required to pass. The earned grade is calculated as `floor((correct answer count / submitted answer count) * 100)`; question `score` values don't weight it. Non-evaluable answers count as correct. If omitted, the submission has no earned or passing grade and its status is COMPLETED, even if an individual evaluated answer is incorrect.  | validation: minimum 0, maximum 100, format int32
           - name: title | type: string | description: Quiz title.  | validation: maxLength 200
           - name: attempts | type: integer | description: Maximum number of submissions allowed per submitter. If omitted, no attempt-limit check is applied. Submissions grouped together share an attempt count, even across quizzes. See [Attempt limits](https://dev.wix.com/docs/api-reference/business-management/online-programs/quizzes/quiz-grading.md#attempt-limits) for how submissions are counted.  | validation: minimum 1, format int32
        - name: fields | type: array<QuizField> | description: Active questions in the quiz. Each `QuizField` defines one question and its answer input. Creating or cloning a quiz requires at least one active question. A retrieved quiz can have an empty list after all its questions have been deleted. Check for active questions before displaying or reusing it.  New submissions use the current questions; stored submissions retain their recorded answer evaluations. | required: true | validation: minItems 1, maxItems 200
           - ONE-OF: - required: true
              - name: numeric | type: NumericField | description: Numeric input.  
                 - name: rightAnswer | type: number | description: Correct numeric value. Matching is exact. If no correct value is stored for this question, its submitted answer is non-evaluable and counts as correct when calculating the earned grade.  Omitted from responses when the caller can't access answer keys. Hidden answers still participate in grading; an absent response value doesn't mean no correct value is stored.  
              - name: shortText | type: ShortTextField | description: Short-text input.  
                 - name: rightAnswer | type: string | description: Correct text. Matching trims leading and trailing whitespace and is case-insensitive. If no correct text is stored for this question, its submitted answer is non-evaluable and counts as correct when calculating the earned grade.  Omitted from responses when the caller can't access answer keys. Hidden answers still participate in grading; an absent response value doesn't mean no correct text is stored.  | validation: minLength 1, maxLength 200
              - name: singleChoice | type: SingleChoiceField | description: Input with predefined options where only one option can be selected.  
                 - name: rightAnswer | type: string | description: Correct option. When supplied, it must exactly match an entry in `options`; otherwise, creation fails with INVALID_QUIZ. Matching submitted answers is exact. If no correct option is stored for this question, its submitted answer is non-evaluable and counts as correct when calculating the earned grade.  Omitted from responses when the caller can't access answer keys. Hidden answers still participate in grading; an absent response value doesn't mean no correct option is stored.  | validation: minLength 1, maxLength 350
                 - name: options | type: array<string> | description: Options available to the participant. Labels must be unique; comparison is case-sensitive. Duplicate labels are rejected with INVALID_QUIZ before creation.  | validation: minItems 1, maxItems 90, minLength 1, maxLength 350
              - name: multiChoice | type: MultiChoiceField | description: Input with predefined options where multiple options can be selected.  
                 - name: rightAnswer | type: array<string> | description: Correct options. Every supplied value must exactly match an entry in `options`; otherwise, creation fails with INVALID_QUIZ. Matching submitted answers ignores option order but doesn't ignore duplicate values. If no correct options are stored for this question, its submitted answer is non-evaluable and counts as correct when calculating the earned grade.  Empty in responses when the caller can't access answer keys. Hidden answers still participate in grading; an empty response list doesn't mean no correct options are stored.  | validation: minItems 0, maxItems 90, minLength 1, maxLength 350
                 - name: options | type: array<string> | description: Options available to the participant.  | validation: minItems 1, maxItems 90, minLength 1, maxLength 350
              - name: fileUpload | type: FileUploadField | description: File-upload input.  
                 - name: buttonText | type: string | description: Text displayed on the upload button.  Default: `Upload`.  | validation: minLength 1, maxLength 100
                 - name: itemsLimit | type: integer | description: Maximum number of files a participant can upload for this question.  Default: `10`.  | validation: minimum 1, maximum 10, format int32
                 - name: fileUploadFormats | type: array<FileUploadFormat> | description: Wix Forms file categories that participants can upload.  Specify at least one format. `UNKNOWN_FILE_UPLOAD_FORMAT` isn't supported as a format selection. File-upload answers aren't evaluated and count as correct when calculating the earned grade.  | validation: maxItems 6
                         - enum:
                         -     IMAGE: Image-file category.
                         -     VIDEO: Video-file category.
                         -     AUDIO: Audio-file category.
                         -     DOCUMENT: Document-file category.
                         -     ARCHIVE: Archive-file category.
                         -     MODEL_3D: 3D-model-file category.
           - name: _id | type: string | description: Caller-generated GUGUID that identifies this question. Use a stable value that is unique within the quiz. Submission answer evaluations use this GUID to identify the question.  | validation: format GUID, immutable
           - name: target | type: string | description: Stable key used to match a submitted answer to this question. Use a value that is unique within the quiz and don't change or reuse it for another question.  | validation: maxLength 200, immutable
           - name: question | type: string | description: Question text.  | validation: minLength 1, maxLength 350
           - name: score | type: number | description: Score returned for evaluable answers, whether correct or incorrect. Omitted from non-evaluable answer evaluations. This value doesn't weight the submission's unweighted `earnedGrade` percentage.  
           - name: rightMessage | type: string | description: Feedback returned when an evaluable submitted answer is correct. Omitted for non-evaluable answers.  | validation: maxLength 350
           - name: wrongMessage | type: string | description: Feedback returned when an evaluable submitted answer is incorrect. Omitted for non-evaluable answers.  | validation: maxLength 350
 Return type: PROMISE<Quiz>
  - name: _id | type: string | description: Quiz GUID.  | read-only: true | validation: format GUID
  - name: settings | type: QuizSettings | description: Quiz title, passing grade, and attempt limit. New submissions use the current settings; stored submissions retain their recorded grade data.  
     - name: passingGrade | type: integer | description: Minimum unweighted integer percentage required to pass. The earned grade is calculated as `floor((correct answer count / submitted answer count) * 100)`; question `score` values don't weight it. Non-evaluable answers count as correct. If omitted, the submission has no earned or passing grade and its status is COMPLETED, even if an individual evaluated answer is incorrect.  | validation: minimum 0, maximum 100, format int32
     - name: title | type: string | description: Quiz title.  | validation: maxLength 200
     - name: attempts | type: integer | description: Maximum number of submissions allowed per submitter. If omitted, no attempt-limit check is applied. Submissions grouped together share an attempt count, even across quizzes. See [Attempt limits](https://dev.wix.com/docs/api-reference/business-management/online-programs/quizzes/quiz-grading.md#attempt-limits) for how submissions are counted.  | validation: minimum 1, format int32
  - name: revision | type: string | description: Current revision of the stored quiz definition. The revision changes when the definition changes. The public Quiz API doesn't currently provide an update method.  | read-only: true | validation: format int64
  - name: _createdDate | type: Date | description: Date and time the quiz was created.  | read-only: true 
  - name: _updatedDate | type: Date | description: Date and time the quiz was last updated.  | read-only: true 
  - name: fields | type: array<QuizField> | description: Active questions in the quiz. Each `QuizField` defines one question and its answer input. Creating or cloning a quiz requires at least one active question. A retrieved quiz can have an empty list after all its questions have been deleted. Check for active questions before displaying or reusing it.  New submissions use the current questions; stored submissions retain their recorded answer evaluations.  | validation: minItems 1, maxItems 200
     - ONE-OF: 
        - name: numeric | type: NumericField | description: Numeric input.  
           - name: rightAnswer | type: number | description: Correct numeric value. Matching is exact. If no correct value is stored for this question, its submitted answer is non-evaluable and counts as correct when calculating the earned grade.  Omitted from responses when the caller can't access answer keys. Hidden answers still participate in grading; an absent response value doesn't mean no correct value is stored.  
        - name: shortText | type: ShortTextField | description: Short-text input.  
           - name: rightAnswer | type: string | description: Correct text. Matching trims leading and trailing whitespace and is case-insensitive. If no correct text is stored for this question, its submitted answer is non-evaluable and counts as correct when calculating the earned grade.  Omitted from responses when the caller can't access answer keys. Hidden answers still participate in grading; an absent response value doesn't mean no correct text is stored.  | validation: minLength 1, maxLength 200
        - name: singleChoice | type: SingleChoiceField | description: Input with predefined options where only one option can be selected.  
           - name: rightAnswer | type: string | description: Correct option. When supplied, it must exactly match an entry in `options`; otherwise, creation fails with INVALID_QUIZ. Matching submitted answers is exact. If no correct option is stored for this question, its submitted answer is non-evaluable and counts as correct when calculating the earned grade.  Omitted from responses when the caller can't access answer keys. Hidden answers still participate in grading; an absent response value doesn't mean no correct option is stored.  | validation: minLength 1, maxLength 350
           - name: options | type: array<string> | description: Options available to the participant. Labels must be unique; comparison is case-sensitive. Duplicate labels are rejected with INVALID_QUIZ before creation.  | validation: minItems 1, maxItems 90, minLength 1, maxLength 350
        - name: multiChoice | type: MultiChoiceField | description: Input with predefined options where multiple options can be selected.  
           - name: rightAnswer | type: array<string> | description: Correct options. Every supplied value must exactly match an entry in `options`; otherwise, creation fails with INVALID_QUIZ. Matching submitted answers ignores option order but doesn't ignore duplicate values. If no correct options are stored for this question, its submitted answer is non-evaluable and counts as correct when calculating the earned grade.  Empty in responses when the caller can't access answer keys. Hidden answers still participate in grading; an empty response list doesn't mean no correct options are stored.  | validation: minItems 0, maxItems 90, minLength 1, maxLength 350
           - name: options | type: array<string> | description: Options available to the participant.  | validation: minItems 1, maxItems 90, minLength 1, maxLength 350
        - name: fileUpload | type: FileUploadField | description: File-upload input.  
           - name: buttonText | type: string | description: Text displayed on the upload button.  Default: `Upload`.  | validation: minLength 1, maxLength 100
           - name: itemsLimit | type: integer | description: Maximum number of files a participant can upload for this question.  Default: `10`.  | validation: minimum 1, maximum 10, format int32
           - name: fileUploadFormats | type: array<FileUploadFormat> | description: Wix Forms file categories that participants can upload.  Specify at least one format. `UNKNOWN_FILE_UPLOAD_FORMAT` isn't supported as a format selection. File-upload answers aren't evaluated and count as correct when calculating the earned grade.  | validation: maxItems 6
                 - enum:
                 -     IMAGE: Image-file category.
                 -     VIDEO: Video-file category.
                 -     AUDIO: Audio-file category.
                 -     DOCUMENT: Document-file category.
                 -     ARCHIVE: Archive-file category.
                 -     MODEL_3D: 3D-model-file category.
     - name: _id | type: string | description: Caller-generated GUGUID that identifies this question. Use a stable value that is unique within the quiz. Submission answer evaluations use this GUID to identify the question.  | validation: format GUID, immutable
     - name: target | type: string | description: Stable key used to match a submitted answer to this question. Use a value that is unique within the quiz and don't change or reuse it for another question.  | validation: maxLength 200, immutable
     - name: question | type: string | description: Question text.  | validation: minLength 1, maxLength 350
     - name: score | type: number | description: Score returned for evaluable answers, whether correct or incorrect. Omitted from non-evaluable answer evaluations. This value doesn't weight the submission's unweighted `earnedGrade` percentage.  
     - name: rightMessage | type: string | description: Feedback returned when an evaluable submitted answer is correct. Omitted for non-evaluable answers.  | validation: maxLength 350
     - name: wrongMessage | type: string | description: Feedback returned when an evaluable submitted answer is incorrect. Omitted for non-evaluable answers.  | validation: maxLength 350

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: INVALID_QUIZ | Description: The quiz definition is invalid.
   HTTP Code: 409 | Status Code: ALREADY_EXISTS | Application Code: QUIZ_CONFLICT | Description: Couldn't create the quiz because of a conflict. This doesn't necessarily mean the quiz already exists. If the conflict persists, contact support with the request GUID.


```

### Examples

### Create a quiz definition
```javascript
import { quizzes } from "@wix/online-programs";

// Run in an authorized Wix context. Generate a new UUID for each question.
// Save the returned _id for subsequent calls.
const createdQuiz = await quizzes.createQuiz({
  settings: {
    title: "Introduction to French Geography",
    passingGrade: 70,
    attempts: 3
  },
  fields: [
    {
      _id: "41c8698b-45b1-47b3-bb59-e9440844e3b5",
      target: "capitalOfFrance",
      question: "What is the capital of France?",
      score: 1,
      rightMessage: "Correct.",
      wrongMessage: "Try again.",
      singleChoice: {
        rightAnswer: "Paris",
        options: [
          "Paris",
          "Lyon",
          "Marseille"
        ]
      }
    }
  ]
});

/* Promise resolves to:
{
  "settings": {
    "passingGrade": 70,
    "title": "Introduction to French Geography",
    "attempts": 3
  },
  "revision": "1",
  "fields": [
    {
      "target": "capitalOfFrance",
      "question": "What is the capital of France?",
      "score": 1,
      "rightMessage": "Correct.",
      "wrongMessage": "Try again.",
      "singleChoice": {
        "rightAnswer": "Paris",
        "options": [
          "Paris",
          "Lyon",
          "Marseille"
        ]
      },
      "_id": "41c8698b-45b1-47b3-bb59-e9440844e3b5"
    }
  ],
  "_id": "963bc415-3e38-457a-a868-0269bc73c4b7",
  "_createdDate": "2026-09-15T14:55:09.034Z",
  "_updatedDate": "2026-09-15T14:55:09.034Z"
}
*/

```

### createQuiz (self-hosted)
Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { quizzes } from '@wix/online-programs';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { quizzes },
  // Include the auth strategy and host as relevant
});


async function createQuiz(quiz) {
  const response = await myWixClient.quizzes.createQuiz(quiz);
};
```

---