# Create an option value

> Add a value to a product option.
{/* generated:versioned-pages - edit _pm-authored, not this file */}

`POST /api/option_values`

Creates a Option Value resource.

Creates a value on a [Product Option](/api/product-management/options/) - for example *Medium* on a *Size* option. Point it at the option with the `productOption` IRI.

> **Linking to an option**
>
> `productOption` is the IRI of the option this value belongs to, e.g. `/api/product_options/{productOptionId}`. The value's `position` controls its order within that option.

## Headers

| Name              | Type     | Required | Description                                                                                                      |
| ----------------- | -------- | -------- | ---------------------------------------------------------------------------------------------------------------- |
| `Flowkiwi-Locale` | `string` | -        | Specifies the locale for properties that support localization. If not provided, the default locale will be used. |

## Request body

| Property        | Type              | Required | Description                                                                            |
| --------------- | ----------------- | -------- | -------------------------------------------------------------------------------------- |
| `value`         | `string \| null`  | Yes      | The value of the option.                                                               |
| `position`      | `integer \| null` | -        | The position of the option value. Use -1 to put the option value at the end.           |
| `productOption` | `string \| null`  | Yes      | The `Product Option` to which this option value belongs.                               |
| `variants`      | `string[]`        | -        | A list of `Variant`, each one representing a variant associated with the option value. |

## Response

**201** - Option Value resource created

| Property        | Type              | Required | Description                                                                            |
| --------------- | ----------------- | -------- | -------------------------------------------------------------------------------------- |
| `@context`      | `object`          | -        |                                                                                        |
| `@id`           | `string`          | Yes      |                                                                                        |
| `@type`         | `string`          | Yes      |                                                                                        |
| `id`            | `string`          | -        |                                                                                        |
| `value`         | `string \| null`  | Yes      | **This property supports translations.**<br><br>The value of the option.               |
| `position`      | `integer \| null` | -        | The position of the option value. Use -1 to put the option value at the end.           |
| `productOption` | `string`          | Yes      | The `Product Option` to which this option value belongs.                               |
| `variants`      | `string[]`        | -        | A list of `Variant`, each one representing a variant associated with the option value. |
| `createdAt`     | `string`          | -        | The date and time when the resource was created (ISO 8601 format).                     |
| `updatedAt`     | `string`          | -        | The date and time when the resource was last modified (ISO 8601 format).               |

## Errors

**400** - Invalid input

| Property      | Type              | Required | Description                                                                                                                          |
| ------------- | ----------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| `@context`    | `object`          | -        |                                                                                                                                      |
| `@id`         | `string`          | Yes      |                                                                                                                                      |
| `@type`       | `string`          | Yes      |                                                                                                                                      |
| `title`       | `string \| null`  | -        | A short, human-readable summary of the problem.                                                                                      |
| `detail`      | `string \| null`  | -        | A human-readable explanation specific to this occurrence of the problem.                                                             |
| `status`      | `integer \| null` | -        |                                                                                                                                      |
| `instance`    | `string \| null`  | -        | A URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced. |
| `type`        | `string`          | -        | A URI reference that identifies the problem type                                                                                     |
| `description` | `string \| null`  | -        |                                                                                                                                      |

**403** - Access denied. The caller is missing one or more identity permissions required for this operation.

| Property             | Type       | Required | Description                                                                                                                                |
| -------------------- | ---------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `@context`           | `object`   | -        |                                                                                                                                            |
| `@id`                | `string`   | Yes      |                                                                                                                                            |
| `@type`              | `string`   | Yes      |                                                                                                                                            |
| `type`               | `string`   | -        |                                                                                                                                            |
| `title`              | `string`   | -        |                                                                                                                                            |
| `status`             | `integer`  | -        |                                                                                                                                            |
| `detail`             | `string`   | -        |                                                                                                                                            |
| `missingPermissions` | `string[]` | -        | Identity permissions that the caller is missing for this operation. Present only when the 403 is caused by a denied identity:* permission. |

**422** - An error occurred

| Property      | Type             | Required | Description |
| ------------- | ---------------- | -------- | ----------- |
| `@context`    | `object`         | -        |             |
| `@id`         | `string`         | Yes      |             |
| `@type`       | `string`         | Yes      |             |
| `status`      | `integer`        | -        |             |
| `violations`  | `object[]`       | -        |             |
| `detail`      | `string`         | -        |             |
| `description` | `string`         | -        |             |
| `type`        | `string`         | -        |             |
| `title`       | `string \| null` | -        |             |
| `instance`    | `string \| null` | -        |             |

## Examples

### Example request

```bash
curl -X POST 'https://<tenant>.product-management.flowkiwi.net/api/option_values' \
  -H 'Authorization: Bearer {access_token}' \
  -H 'Flowkiwi-Api-Version: 2026-07' \
  -H 'Accept: application/ld+json' \
  -H 'Content-Type: application/ld+json' \
  -d '{
  "value": "Large",
  "productOption": "/api/productOptions/b41c0169-dd12-5fe5-bbbe-b8d55192d7eb",
  "variants": [
    "/api/variants/cbd04bfe-8d8a-5118-83ea-b834a40fb82a",
    "/api/variants/896739ac-2b86-5e8f-8d40-51e17eeb27d0"
  ]
}'
```

### Example response

```json
{
  "@context": "/api/contexts/OptionValue",
  "@id": "/api/OptionValues/1aa93653-0d77-5dbb-ae5e-03d19221b819",
  "@type": "OptionValue",
  "id": "1aa93653-0d77-5dbb-ae5e-03d19221b819",
  "value": "Large",
  "position": 0,
  "productOption": "/api/productOptions/54f1c7e4-396b-544c-b538-6c5e7a6d5267",
  "variants": [
    "/api/variants/ef81bc02-91a8-5df8-a58b-8af7acecdea8",
    "/api/variants/20867a8f-f581-54c4-b12c-380c0bfefa7a"
  ],
  "createdAt": "2024-01-01T00:00:00+00:00",
  "updatedAt": "2024-01-01T00:00:00+00:00"
}
```
