---
title: "Gives up a quiz: the open attempt, or the attempts left, after which no attempt can be started."
---

> 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 customer API › quiz

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

## Authentication

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

## Path parameters

- `store` (`forfeitQuiz.path.store`; string, required) — A hostname of the store.
- `product` (`forfeitQuiz.path.product`; string, required) — An id, or `slug:<slug>`.
  - minLength 1
- `entry` (`forfeitQuiz.path.entry`; string, required)
  - minLength 1
- `quiz` (`forfeitQuiz.path.quiz`; string, required)
  - minLength 1

## Request body

_Optional._

- `preview` (`forfeitQuiz.preview`; string, optional) — A token a seller made for the quiz's product's page, which opens the quiz of a published entry of the product unpublished, or for the quiz's entry, which opens it unpublished too, gated as ever; with it, any quiz it does not open is `not_found` `preview`.
  - minLength 1; maxLength 128

## Example request

```json
{
  "preview": "string"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url 'https://api.sherpo.io/customer/v1/stores/<store>/products/<product>/entries/<entry>/quizzes/<quiz>/forfeit' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "preview": "string"
}
'
```

### TypeScript

```typescript
const url = 'https://api.sherpo.io/customer/v1/stores/<store>/products/<product>/entries/<entry>/quizzes/<quiz>/forfeit';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({preview: 'string'})
};

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/customer/v1/stores/<store>/products/<product>/entries/<entry>/quizzes/<quiz>/forfeit"

payload = { "preview": "string" }
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

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

print(response.text)
```

## Responses

### 200

Gives up a quiz: the open attempt, or the attempts left, after which no attempt can be started.

#### Example

```json
{
  "attempt": {
    "id": "string",
    "product_id": "string",
    "quiz_id": "string",
    "entry_id": "string",
    "attempt": 0,
    "status": "string",
    "score": 0,
    "correct": 0,
    "started_at": "string",
    "finished_at": "string",
    "access": "string"
  },
  "certificate": {
    "id": "string",
    "product_id": "string",
    "certificate_id": "string",
    "score": 0,
    "attempt": 0,
    "issued_at": "string"
  },
  "certificates": [
    {
      "id": "string",
      "product_id": "string",
      "certificate_id": "string",
      "score": 0,
      "attempt": 0,
      "issued_at": "string"
    }
  ]
}
```

- `attempt` (`forfeitQuiz.response.200.attempt`; object, required)
  - `id` (`forfeitQuiz.response.200.attempt.id`; string, required)
  - `product_id` (`forfeitQuiz.response.200.attempt.product_id`; string, required)
  - `quiz_id` (`forfeitQuiz.response.200.attempt.quiz_id`; string, required)
  - `entry_id` (`forfeitQuiz.response.200.attempt.entry_id`; string, required)
  - `attempt` (`forfeitQuiz.response.200.attempt.attempt`; number, required)
  - `status` (`forfeitQuiz.response.200.attempt.status`; string, required)
  - `score` (`forfeitQuiz.response.200.attempt.score`; any of, required)
    - any of: `number`, `null`
  - `correct` (`forfeitQuiz.response.200.attempt.correct`; any of, required)
    - any of: `number`, `null`
  - `started_at` (`forfeitQuiz.response.200.attempt.started_at`; string, required)
  - `finished_at` (`forfeitQuiz.response.200.attempt.finished_at`; any of, required)
    - any of: `string`, `null`
  - `access` (`forfeitQuiz.response.200.attempt.access`; string, required)
- `certificate` (`forfeitQuiz.response.200.certificate`; any of, required)
  - any of: `object`, `null`
- `certificates` (`forfeitQuiz.response.200.certificates`; array<object>, required)
  - `id` (`forfeitQuiz.response.200.certificates.id`; string, required)
  - `product_id` (`forfeitQuiz.response.200.certificates.product_id`; string, required)
  - `certificate_id` (`forfeitQuiz.response.200.certificates.certificate_id`; string, required)
  - `score` (`forfeitQuiz.response.200.certificates.score`; any of, required)
    - any of: `number`, `null`
  - `attempt` (`forfeitQuiz.response.200.certificates.attempt`; any of, required)
    - any of: `number`, `null`
  - `issued_at` (`forfeitQuiz.response.200.certificates.issued_at`; string, required)

### default

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

#### Example

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

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


Source: https://docs.sherpo.io/customer-api/reference/forfeit-quiz/index.md
