> For the complete documentation index, see [llms.txt](https://docs.ecwid.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ecwid.com/changelog/march-2025/march-28/color-swatches-as-product-options-in-ecwid-api.md).

# Color swatches as product options in Ecwid API

#### What's new

Product options will soon have "Color swatches" options. And now these are available with Ecwid API.

#### Changes in API

* New value for the  `options[]` -> `type` field: `SWATCHES`. It allows product option to work as a color swatch.
* New field for option object in the `options[]`: `useImageAsSwatchSelector`. It only works with `SWATCHES` options.
* New fields for the `option[]` -> `choices` object: `hexCodes` and `imageId`. \
  \
  They allow you to define storefront display options for the swatch: swatches can either be displayed as colored circles or open a specified product image when clicked. \
  \
  This behavior is controlled by the `useImageAsSwatchSelector`  field. If it's `true`, swatches open specific product image when clicked. If `false`, then the swatches are represented as colored circles using provided hexCodes) instead of the radio buttons.

<details>

<summary>"Update product" request example</summary>

The following request updates product options to a single "Color" option with "Red" and "Dark Green" choices (red color costs $10 extra):

```http
PUT /api/v3/STOREID/products/PRODUCTID HTTP/1.1
Host: app.ecwid.com
Content-Type: application/json
Authorization: Bearer secret_token
Content-Length: 644

{
    "options": [
        {
            "type": "SWATCHES",
            "name": "Color",
            "required": true,
            "useImageAsSwatchSelector": false,
            "choices": [
                {
                    "text": "Red",
                    "priceModifierType": "ABSOLUTE",
                    "priceModifier": 10,
                    "hexCodes": [
                        "#FFA500"
                    ]
                },
                {
                    "text": "Dark Green",
                    "hexCodes": [
                        "#06402B"
                    ]
                }
            ]
        }
    ]
}
```

</details>

#### Documentation links

Find swatches and related new fields in product [options](/api-reference/rest-api/products/search-products.md#options).

{% content-ref url="/spaces/G9n5VxMY9T0Ob3D56PSD/pages/6UldOxeID8cqQpk9Zvlb" %}
[Update product](/api-reference/rest-api/products/update-product.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.ecwid.com/changelog/march-2025/march-28/color-swatches-as-product-options-in-ecwid-api.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
