---
title: "Creates a quiz on an entry."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.sherpo.io/llms.txt
> Use this file to discover all available pages before exploring further.

Path: Sherpo merchant API › quiz

`POST /v1/stores/{store}/products/{product}/entries/{entry}/quizzes`

## Authentication

- `bearer`, http, header `Authorization`, scopes: `quiz:write`

## Path parameters

- `store` (`createQuiz.path.store`; string, required) — The store's id.
- `product` (`createQuiz.path.product`; string, required) — An id, or `slug:<slug>`.
  - minLength 1
- `entry` (`createQuiz.path.entry`; string, required)
  - minLength 1

## Header parameters

- `Idempotency-Key` (`createQuiz.header.Idempotency-Key`; string, optional) — Repeats within 24 hours answer the first result; the same key with other arguments is a conflict.
  - minLength 1; maxLength 255; pattern `^[\x21-\x7E]+$`

## Request body

_Required._

- `blocks` (`createQuiz.blocks`; array<any of>, required) — The blocks as the editor writes them; a key the schema does not know is refused.
  - any of: `object`, `object`, `object`, `object`, `object`, `object`, `object`, `object`
- `text_format` (`createQuiz.text_format`; string, optional) — The format the rich text fields are written in: the rich text format’s HTML, or Markdown converted into it before it is validated. A text already stored in the format (starting with `<rich-text`) is kept as it is either way.
  - one of `"html"`, `"markdown"`; default `"html"`
- `full` (`createQuiz.full`; boolean, optional) — Answers the texts, attachments and file lists the short answer leaves out.
- `after` (`createQuiz.after`; any of, optional) — The newest version the caller started from, null for none; a newer one refuses the write.
  - any of: `object`, `null`
- `follows` (`createQuiz.follows`; object, optional) — The questions that version held as the caller read them; others there refuse the write.
  - `id` (`createQuiz.follows.id`; string, required)
    - minLength 1; maxLength 512
- `title` (`createQuiz.title`; any of, optional)
  - any of: `string`, `null`
- `settings` (`createQuiz.settings`; object, optional)
  - `attempts_allowed` (`createQuiz.settings.attempts_allowed`; any of, optional) — Null is unlimited.
    - any of: `integer`, `null`
  - `pass_mark` (`createQuiz.settings.pass_mark`; any of, optional) — Percent needed to pass; null passes any finished sitting.
    - any of: `integer`, `null`
  - `show_answers` (`createQuiz.settings.show_answers`; boolean, optional)

## Example request

```json
{
  "text_format": "html",
  "full": true,
  "after": {
    "id": "string"
  },
  "follows": {
    "id": "string"
  },
  "blocks": [
    {
      "type": "multiple_choice",
      "id": "string",
      "question": "string",
      "options": [
        {
          "id": "string",
          "text": "string"
        },
        {
          "id": "string",
          "text": "string"
        }
      ],
      "correctOptionId": "string",
      "weight": 0,
      "hint": "string",
      "explanation": "string"
    }
  ],
  "title": "string",
  "settings": {
    "attempts_allowed": 1,
    "pass_mark": 100,
    "show_answers": true
  }
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url 'https://api.sherpo.io/merchant/v1/stores/<store>/products/<product>/entries/<entry>/quizzes' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "text_format": "html",
  "full": true,
  "after": {
    "id": "string"
  },
  "follows": {
    "id": "string"
  },
  "blocks": [
    {
      "type": "multiple_choice",
      "id": "string",
      "question": "string",
      "options": [
        {
          "id": "string",
          "text": "string"
        },
        {
          "id": "string",
          "text": "string"
        }
      ],
      "correctOptionId": "string",
      "weight": 0,
      "hint": "string",
      "explanation": "string"
    }
  ],
  "title": "string",
  "settings": {
    "attempts_allowed": 1,
    "pass_mark": 100,
    "show_answers": true
  }
}
'
```

### TypeScript

```typescript
const url = 'https://api.sherpo.io/merchant/v1/stores/<store>/products/<product>/entries/<entry>/quizzes';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({
    text_format: 'html',
    full: true,
    after: {id: 'string'},
    follows: {id: 'string'},
    blocks: [
      {
        type: 'multiple_choice',
        id: 'string',
        question: 'string',
        options: [{id: 'string', text: 'string'}, {id: 'string', text: 'string'}],
        correctOptionId: 'string',
        weight: 0,
        hint: 'string',
        explanation: 'string'
      }
    ],
    title: 'string',
    settings: {attempts_allowed: 1, pass_mark: 100, show_answers: true}
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.sherpo.io/merchant/v1/stores/<store>/products/<product>/entries/<entry>/quizzes"

payload = {
    "text_format": "html",
    "full": True,
    "after": { "id": "string" },
    "follows": { "id": "string" },
    "blocks": [
        {
            "type": "multiple_choice",
            "id": "string",
            "question": "string",
            "options": [
                {
                    "id": "string",
                    "text": "string"
                },
                {
                    "id": "string",
                    "text": "string"
                }
            ],
            "correctOptionId": "string",
            "weight": 0,
            "hint": "string",
            "explanation": "string"
        }
    ],
    "title": "string",
    "settings": {
        "attempts_allowed": 1,
        "pass_mark": 100,
        "show_answers": True
    }
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 201

Creates a quiz on an entry.

#### Example

```json
{
  "id": "string",
  "created_at": "string",
  "updated_at": "string",
  "settings": {
    "attempts_allowed": 0,
    "pass_mark": 0,
    "show_answers": true
  },
  "product_id": "string",
  "entry_id": "string",
  "version": 0,
  "certificates": [
    {
      "logo": {
        "attachment_id": "string",
        "asset_id": "string"
      },
      "id": "string",
      "product_id": "string",
      "quiz_id": "string",
      "headline_copy": "string",
      "title_copy": "string",
      "awarded_copy": "string",
      "reason_copy": "string",
      "score_copy": "string",
      "out_of_score_copy": "string",
      "settings": {
        "template": "string",
        "accent": "string",
        "requires_passing": true,
        "earned_on": "string",
        "shows": [
          "string"
        ]
      },
      "created_at": "string"
    }
  ],
  "question_count": 0,
  "sittings": 0,
  "body": {
    "attachment_id": "string",
    "asset_id": "string",
    "title": "string",
    "blocks": [
      {
        "type": "string",
        "id": "string",
        "property1": true,
        "property2": true
      }
    ]
  },
  "files": {
    "property1": {
      "id": "string",
      "kind": "string",
      "mime": "string",
      "name": "string",
      "bytes": 0,
      "width": 0,
      "height": 0,
      "duration": 0,
      "pages": 0,
      "status": "string",
      "url": "string",
      "resized": [
        {
          "width": 1,
          "avif": "string",
          "webp": "string"
        }
      ],
      "attachment_id": "string",
      "unlocks": [
        {
          "product_id": "string",
          "product_name": "string",
          "tier": {
            "id": "string",
            "name": "string",
            "rank": 0
          }
        }
      ],
      "video": {
        "attachment_id": "string",
        "tracks": [
          {
            "id": "string",
            "label": "string",
            "language": "string",
            "generated": true
          }
        ],
        "outputs": [
          "string"
        ]
      },
      "audio": {
        "waveform": "string",
        "attachment_id": "string",
        "tracks": [
          {
            "id": "string",
            "label": "string",
            "language": "string",
            "generated": true
          }
        ],
        "outputs": [
          "string"
        ]
      }
    },
    "property2": {
      "id": "string",
      "kind": "string",
      "mime": "string",
      "name": "string",
      "bytes": 0,
      "width": 0,
      "height": 0,
      "duration": 0,
      "pages": 0,
      "status": "string",
      "url": "string",
      "resized": [
        {
          "width": 1,
          "avif": "string",
          "webp": "string"
        }
      ],
      "attachment_id": "string",
      "unlocks": [
        {
          "product_id": "string",
          "product_name": "string",
          "tier": {
            "id": "string",
            "name": "string",
            "rank": 0
          }
        }
      ],
      "video": {
        "attachment_id": "string",
        "tracks": [
          {
            "id": "string",
            "label": "string",
            "language": "string",
            "generated": true
          }
        ],
        "outputs": [
          "string"
        ]
      },
      "audio": {
        "waveform": "string",
        "attachment_id": "string",
        "tracks": [
          {
            "id": "string",
            "label": "string",
            "language": "string",
            "generated": true
          }
        ],
        "outputs": [
          "string"
        ]
      }
    }
  },
  "created": [
    {
      "id": "string",
      "role": "string",
      "asset": {
        "id": "string"
      }
    }
  ]
}
```

- `id` (`createQuiz.response.201.id`; string, required)
- `created_at` (`createQuiz.response.201.created_at`; any of, required)
  - any of: `string`, `null`
- `updated_at` (`createQuiz.response.201.updated_at`; any of, required)
  - any of: `string`, `null`
- `settings` (`createQuiz.response.201.settings`; object, required)
  - `attempts_allowed` (`createQuiz.response.201.settings.attempts_allowed`; any of, required)
    - any of: `number`, `null`
  - `pass_mark` (`createQuiz.response.201.settings.pass_mark`; any of, required)
    - any of: `number`, `null`
  - `show_answers` (`createQuiz.response.201.settings.show_answers`; boolean, required)
- `product_id` (`createQuiz.response.201.product_id`; string, required)
- `entry_id` (`createQuiz.response.201.entry_id`; string, required)
- `version` (`createQuiz.response.201.version`; number, required)
- `certificates` (`createQuiz.response.201.certificates`; array<object>, required)
  - `logo` (`createQuiz.response.201.certificates.logo`; any of, required)
    - any of: `object`, `null`
  - `id` (`createQuiz.response.201.certificates.id`; string, required)
  - `product_id` (`createQuiz.response.201.certificates.product_id`; string, required)
  - `quiz_id` (`createQuiz.response.201.certificates.quiz_id`; any of, required)
    - any of: `string`, `null`
  - `headline_copy` (`createQuiz.response.201.certificates.headline_copy`; string, required)
  - `title_copy` (`createQuiz.response.201.certificates.title_copy`; any of, required)
    - any of: `string`, `null`
  - `awarded_copy` (`createQuiz.response.201.certificates.awarded_copy`; any of, required)
    - any of: `string`, `null`
  - `reason_copy` (`createQuiz.response.201.certificates.reason_copy`; any of, required)
    - any of: `string`, `null`
  - `score_copy` (`createQuiz.response.201.certificates.score_copy`; any of, required)
    - any of: `string`, `null`
  - `out_of_score_copy` (`createQuiz.response.201.certificates.out_of_score_copy`; any of, required)
    - any of: `string`, `null`
  - `settings` (`createQuiz.response.201.certificates.settings`; object, required)
    - `template` (`createQuiz.response.201.certificates.settings.template`; string, required)
    - `accent` (`createQuiz.response.201.certificates.settings.accent`; any of, required)
      - any of: `string`, `null`
    - `requires_passing` (`createQuiz.response.201.certificates.settings.requires_passing`; boolean, optional) — Earned by passing the quiz, not by merely finishing it.
    - `earned_on` (`createQuiz.response.201.certificates.settings.earned_on`; string, optional) — Set on a certificate no quiz awards: finishing every entry of a course, or a check-in at an event, earns it; losing its quiz never makes one.
    - `shows` (`createQuiz.response.201.certificates.settings.shows`; array<string>, optional)
  - `created_at` (`createQuiz.response.201.certificates.created_at`; any of, required)
    - any of: `string`, `null`
- `question_count` (`createQuiz.response.201.question_count`; number, required) — How many of its blocks are questions a sitter answers.
- `sittings` (`createQuiz.response.201.sittings`; number, required)
- `body` (`createQuiz.response.201.body`; object, required)
  - `attachment_id` (`createQuiz.response.201.body.attachment_id`; string, required)
  - `asset_id` (`createQuiz.response.201.body.asset_id`; string, required) — The body asset a later update's `replaces` names.
  - `title` (`createQuiz.response.201.body.title`; any of, required)
    - any of: `string`, `null`
  - `blocks` (`createQuiz.response.201.body.blocks`; array<object>, optional) — The questions as written; answered only with `full`.
    - `type` (`createQuiz.response.201.body.blocks.type`; string, required)
    - `id` (`createQuiz.response.201.body.blocks.id`; string, required)
- `created` (`createQuiz.response.201.created`; array<object>, required) — The attachments the write bound: the files its new static text names.
  - `id` (`createQuiz.response.201.created.id`; string, required)
  - `role` (`createQuiz.response.201.created.role`; string, required)
  - `asset` (`createQuiz.response.201.created.asset`; object, required)
    - `id` (`createQuiz.response.201.created.asset.id`; string, required)
- `files` (`createQuiz.response.201.files`; map<object>, optional) — The files its static text names, as its save bound them; answered only with `full`.

### default

A problem; see https://api.sherpo.io/merchant/docs/errors.

#### Example

```json
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "context": {},
  "reached_core": true,
  "core_answer": "string"
}
```

- `type` (`createQuiz.response.default.type`; string, required)
  - format `uri`
- `title` (`createQuiz.response.default.title`; string, required)
- `status` (`createQuiz.response.default.status`; integer, required)
- `detail` (`createQuiz.response.default.detail`; string, required)
- `code` (`createQuiz.response.default.code`; string, optional)
- `context` (`createQuiz.response.default.context`; object, optional)
- `reached_core` (`createQuiz.response.default.reached_core`; boolean, optional)
- `core_answer` (`createQuiz.response.default.core_answer`; string, optional)


Source: https://docs.sherpo.io/merchant-api/reference/create-quiz/index.md
