---
title: "Answers a product's registration questions while the customer buys it; checkout asks for every required one, and any answer off its pattern, before payment."
---

> 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 › checkout

`PUT /v1/stores/{store}/products/{product}/answers`

## Authentication

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

## Path parameters

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

## Request body

_Required._

- `answers` (`setProductAnswers.answers`; array<object>, required) — One answer per question; a question left out keeps what it holds.
  - `question` (`setProductAnswers.answers.question`; string, required)
  - `value` (`setProductAnswers.answers.value`; any of, required) — A trimmed text for a `text` (one line, at most 300) or `long_text` (at most 3000) question, an option for a `select`, options for a `multi_select`, a boolean for a `checkbox`; null or a blank text clears an optional one.
    - any of: `boolean`, `string`, `array<string>`, `null`
- `checkout` (`setProductAnswers.checkout`; object, optional) — The customer's cart the answers are given in; named, it must be theirs, open or frozen, and hold the product, else nothing is written.
  - `id` (`setProductAnswers.checkout.id`; string, required)
    - minLength 1; maxLength 512

## Example request

```json
{
  "checkout": {
    "id": "string"
  },
  "answers": [
    {
      "question": "string",
      "value": true
    }
  ]
}
```

## Code samples

### cURL

```bash
curl --request PUT \
  --url 'https://api.sherpo.io/customer/v1/stores/<store>/products/<product>/answers' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "checkout": {
    "id": "string"
  },
  "answers": [
    {
      "question": "string",
      "value": true
    }
  ]
}
'
```

### TypeScript

```typescript
const url = 'https://api.sherpo.io/customer/v1/stores/<store>/products/<product>/answers';
const options = {
  method: 'PUT',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({checkout: {id: 'string'}, answers: [{question: 'string', value: 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/customer/v1/stores/<store>/products/<product>/answers"

payload = {
    "checkout": { "id": "string" },
    "answers": [
        {
            "question": "string",
            "value": True
        }
    ]
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

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

print(response.text)
```

## Responses

### 200

Answers a product's registration questions while the customer buys it; checkout asks for every required one, and any answer off its pattern, before payment.

#### Example

```json
{
  "product_id": "string",
  "answers": [
    {
      "question_id": "string",
      "value": true
    }
  ]
}
```

- `product_id` (`setProductAnswers.response.200.product_id`; string, required)
- `answers` (`setProductAnswers.response.200.answers`; array<object>, required) — The customer's answers in the questions' order; one no longer standing, as a pick since taken off, is absent.
  - `question_id` (`setProductAnswers.response.200.answers.question_id`; string, required)
  - `value` (`setProductAnswers.response.200.answers.value`; any of, required)
    - any of: `boolean`, `string`, `array<string>`

### 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` (`setProductAnswers.response.default.type`; string, required)
  - format `uri`
- `title` (`setProductAnswers.response.default.title`; string, required)
- `status` (`setProductAnswers.response.default.status`; integer, required)
- `detail` (`setProductAnswers.response.default.detail`; string, required)
- `code` (`setProductAnswers.response.default.code`; string, optional)
- `context` (`setProductAnswers.response.default.context`; object, optional)
- `reached_core` (`setProductAnswers.response.default.reached_core`; boolean, optional)
- `core_answer` (`setProductAnswers.response.default.core_answer`; string, optional)


Source: https://docs.sherpo.io/customer-api/reference/set-product-answers/index.md
