---
title: "Adds a registration question to a product, its own or a standard detail: a text, a select or a checkbox, required or not."
---

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

`POST /v1/stores/{store}/products/{product}/questions`

## Authentication

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

## Path parameters

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

## Header parameters

- `Idempotency-Key` (`createProductQuestion.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

_Optional._

- `kind` (`createProductQuestion.kind`; string, optional) — What the buyer answers with: a short or long text, one option, any options, or a tick; a preset's own when unset.
  - one of `"text"`, `"select"`, `"long_text"`, `"multi_select"`, `"checkbox"`
- `preset` (`createProductQuestion.preset`; string, optional) — A standard detail to ask for: `name`, `phone`, `company` or `address`, each once per product; it sets the kind, and the label and pattern unless given.
  - one of `"name"`, `"phone"`, `"address"`, `"company"`
- `label` (`createProductQuestion.label`; string, optional) — What the buyer is asked, trimmed, with no line break or control character; required unless a preset names it.
  - minLength 1; maxLength 200
- `required` (`createProductQuestion.required`; boolean, optional) — Whether checkout asks for an answer before payment; a required checkbox must be ticked. False when unset.
- `options` (`createProductQuestion.options`; array<string>, optional) — A select's or a multi select's options, in order and distinct, each trimmed with no line break or control character; refused for any other kind.
- `pattern` (`createProductQuestion.pattern`; any of, optional) — A text answer's pattern, trimmed and matched against the whole answer: literals, `.`, classes, `\d \w \s`, groups, `|` and repeats up to 100; refused for any other kind and for what can't be matched safely.
  - any of: `string`, `null`
- `example` (`createProductQuestion.example`; any of, optional) — An answer that fits the pattern, trimmed with no line break or control character, which checkout shows buyers as the format to follow; refused without a pattern or when the pattern doesn't match it, and cleared with the pattern.
  - any of: `string`, `null`
- `position` (`createProductQuestion.position`; integer, optional) — Where it goes among the product's questions, from zero; last when unset.
  - min 0; max 19

## Example request

```json
{
  "kind": "text",
  "preset": "name",
  "label": "string",
  "required": true,
  "options": [
    "string",
    "string"
  ],
  "pattern": "string",
  "example": "string",
  "position": 19
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url 'https://api.sherpo.io/merchant/v1/stores/<store>/products/<product>/questions' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "kind": "text",
  "preset": "name",
  "label": "string",
  "required": true,
  "options": [
    "string",
    "string"
  ],
  "pattern": "string",
  "example": "string",
  "position": 19
}
'
```

### TypeScript

```typescript
const url = 'https://api.sherpo.io/merchant/v1/stores/<store>/products/<product>/questions';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({
    kind: 'text',
    preset: 'name',
    label: 'string',
    required: true,
    options: ['string', 'string'],
    pattern: 'string',
    example: 'string',
    position: 19
  })
};

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>/questions"

payload = {
    "kind": "text",
    "preset": "name",
    "label": "string",
    "required": True,
    "options": ["string", "string"],
    "pattern": "string",
    "example": "string",
    "position": 19
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

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

print(response.text)
```

## Responses

### 201

Adds a registration question to a product, its own or a standard detail: a text, a select or a checkbox, required or not.

#### Example

```json
{
  "id": "string",
  "product_id": "string",
  "position": 0,
  "kind": "string",
  "preset": "string",
  "label": "string",
  "required": true,
  "options": [
    "string"
  ],
  "pattern": "string",
  "example": "string",
  "created_at": "string",
  "updated_at": "string"
}
```

- `id` (`createProductQuestion.response.201.id`; string, required)
- `product_id` (`createProductQuestion.response.201.product_id`; string, required)
- `position` (`createProductQuestion.response.201.position`; number, required) — Where it shows among the product's questions, from zero.
- `kind` (`createProductQuestion.response.201.kind`; string, required) — `text`, `long_text`, `select`, `multi_select` or `checkbox`.
- `preset` (`createProductQuestion.response.201.preset`; any of, required) — The standard detail it asks for (`name`, `phone`, `company` or `address`), or null for one of the seller's own.
  - any of: `string`, `null`
- `label` (`createProductQuestion.response.201.label`; string, required)
- `required` (`createProductQuestion.response.201.required`; boolean, required) — Whether checkout asks for an answer before payment; a required checkbox must be ticked.
- `options` (`createProductQuestion.response.201.options`; any of, required) — A select's options, in order; null for any other kind.
  - any of: `array<string>`, `null`
- `pattern` (`createProductQuestion.response.201.pattern`; any of, required) — The pattern a text answer must match whole, or null for none.
  - any of: `string`, `null`
- `example` (`createProductQuestion.response.201.example`; any of, required) — An answer that fits the pattern, which checkout shows as the format to follow; null for none.
  - any of: `string`, `null`
- `created_at` (`createProductQuestion.response.201.created_at`; string, required)
- `updated_at` (`createProductQuestion.response.201.updated_at`; string, required)

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


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