V1 and V2Products (V2 beta)
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.
It returns the id of the new product created.
⚠️ Keep in mind that converting a Single product to a Parent might cause data loss
| 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/v2/products/string/variants' \ -H 'Content-Type: application/json' \ --data-raw '{ "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": [ { "id": "6734ac432bbf7d289efd7988", "created": "2024-11-13T13:40:19.620951", "created_user_audit": { "type": "API", "user_email": "api", "user_id": "67191ed7d6e8e300016f1414", "user_name": "api" }, "modified": "2024-11-13T13:40:19.707781", "modified_user_audit": { "type": "API", "user_email": "api", "user_id": "67191ed7d6e8e300016f1414", "user_name": "api" } } ]}