# How to create a product

## Determine available countries and locales

Use the `List countries` endpoint to get the countries and locales your merchant account has been linked to.&#x20;

* **Countries** determine:
  * Where the product will be published.
  * Which prices must be defined.
* **Locales** determine:
  * Which languages are available for product descriptions.

## Determine product metadata

Before creating a product, gather the necessary information and identifiers from the API.

### Find the product category

Use the `List Categories` endpoint to search available product categories and retrieve the category ID.

### Get the required attributes

Once the category is selected:

* Call `List Attribute Groups` with the `category_id` to get:
  * Required **attributes**
  * Available **colors**
  * **Sizes**
  * **Brands**
  * **Material groups** (e.g. "Lining", "Shell") and **materials**

## Creating the product

### Drafting the product

Now that you've gathered all the necessary metadata, you're ready to draft your product.

#### Material compositions

Depending on the product category, you'll need to provide either a **textile** or **non-textile** material composition.

* The composition is a mapping of:
  * **Cluster** (e.g., `Lining`, `Shell`) from `material_group`
  * → to **Materials** (e.g., `Cotton`, `Leather`) from `material`
* **Textile materials** require a `fraction` field for each component.

**Example: Lining made of Cotton, Material made of Leather**

```json
[
    {
        "cluster_id": 164593, // Lining
        "components": [
            {
                "material_id": 293177, // Cotton
                "fraction": 100
            }
        ]
    },
    {
        "cluster_id": 164588, // Material
        "components": [
            {
                "material_id": 186717, // Leather
                "fraction": 100
            }
        ]
    },
]
```

#### Putting everything together

Use the `Upsert Product` endpoint to create or update your product.

**Example Payload**

```json
{
  "items": [
    {
      "style_key": "<your_style_key>",
      "sku": "<your_sku>",
      "ean": "<your_ean>",
      "hs_code": "<your_hs_code>",
      "name": "<your_product_name>",
      "descriptions": {
        "<locale_1>": "<description_in_locale_1>",
        "<locale_2>": "<description_in_locale_2>"
      },
      "color": <color_id>,
      "size": <size_id>,
      "second_size": <second_size_id>|null,
      "brand": <brand_id>,
      "category": <category_id>,
      "quantity": <your_product_quantity>,
      "weight": <product_weight>,
      "countries": [
        "<country_code_1>", "<country_code_2>"
      ],
      "country_of_origin": "<country_of_origin_code>",
      "attributes": [
        <attribute_ids>
      ],
      "material_composition_textile": [
        {
          "cluster_id": <material_group_1_id>,
          "components": [
            {
              "material_id": <material_1_id>,
              "fraction": <material_1_fraction>
            }
          ]
        }
      ],
      "prices": [
        {
          "country_code": "<country_code_1>",
          "retail_price": <your_retail_price>,
          "sale_price": <your_sale_price>
        },
        {
          "country_code": "<country_code_2>",
          "retail_price": <your_retail_price>,
          "sale_price": <your_sale_price>
        }
      ],
      "images": ["<your_product_image_urls>"]
    }
  ]
}
```

### Publishing the draft product

After creation and updates of the draft product, it can be published using the `Update Product Status` .

**Example Payload**

```json
{
  "items": [
    {
      "style_key": "<product_style_key>",
      "status": "published"
    }
  ]
}
```


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.partner.aboutyou.com/api/getting-started/how-to-create-a-product.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
