V1 and V2Products (V1)
Add a variant
Add a new product as a variant of another product.
It's necessary to send a dictionary with the info of the new variant.
⚠️ Keep in mind that converting a Single product to a Parent might cause data loss
| field | Mandatory | Description |
|---|---|---|
| variant | yes | Data for the new variant created. It is possible to add extra attributes information in this field, apart from the mandatory field 'sku' |
Variant
| field | Mandatory | Description |
|---|---|---|
| sku | yes | sku for the new product |
| label | no | label for the new product. Any other System attribute can be set at the same level |
| attributes | no | custom attribute values for the new products. If you add a parent-level attribute here it will be set as Overwritten |
Authorization
bearerAuth AuthorizationBearer <token>
Obtain a token via POST /auth/api/get-token (15 minute lifetime), then send it as Authorization: Bearer <token>.
In: header
Path Parameters
parent_product_id*string
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
curl -X POST 'https://example.com/api/v1/products/string/variants' \ -H 'Content-Type: application/json' \ --data-raw '{ "variant": { "sku": "new variant from API", "label": "new variant label", "attributes": { "description_create_a_rich_text_type_attribute": "<b>Variants</b> can be created from the API", "price_create_a_decimal_number_type_attribute": 23.99 } }}'{ "data": [ { "_parent_id": "<product_id>", "assets": [], "attributes": {}, "categories": [], "created": "2023-03-16T11:10:37.599000+00:00", "gtin": null, "id": "6412f92da3438ee01ab81d38", "label": "new variant label", "modified": "2023-03-16T11:10:37.634000+00:00", "num_variations": 0, "overwritten_attributes": [], "product_family_id": "6405f5ce7288e165f149eb3c", "product_family_model_id": "6405f74a7288e165f149eb47", "product_type": "VARIANT", "relationships": [], "sku": "new variant from API", "status": "Draft", "thumbnail": null } ]}