POST
/hyax-api/v1/products/:id/variantsCreate variant
Adds one variant. Prefer **Generate variants** for a full grid. Pin it to a combination with `options` (by name) or `optionValues` (by id); a combination that already has a live variant returns `409`. The SKU code is derived from the combination when omitted.
Base URL: https://platform.hyax.com · Replace YOUR_API_KEY with your team API key.
Request body
| Field | Required | Description |
|---|---|---|
sku | No | SKU code, unique per product. Derived from the options/title when omitted |
title | No | Display label, e.g. "Black / XS". Composed from the options when omitted |
price | No | Overrides the product price. Null falls back to it |
inventory | No | `null` is unlimited stock. Omitted defaults to 0 for `PHYSICAL`, unlimited otherwise |
weight | No | Number, for shipping |
image | No | Image URL shown when this variant is selected |
unitsGranted | No | Overrides the product's wallet grant for this variant |
options | No | Combination by name: `[{ "group": "Color", "value": "Black" }]` |
optionValues | No | Combination by id: `[{ "groupId": "color", "valueId": "black" }]` |
Request
curl -X POST 'https://platform.hyax.com/hyax-api/v1/products/clx_example_id/variants' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"price": 34,
"inventory": 10,
"options": [
{
"group": "Color",
"value": "Black"
},
{
"group": "Size",
"value": "XL"
}
]
}'Response
{
"success": true,
"data": {
"id": "clx…",
"sku": "BLACK-XL",
"title": "Black / XL",
"price": 34,
"inventory": 10,
"isSoldOut": false,
"isRetired": false,
"variantRef": "BLACK-XL",
"buyUrl": "https://shop.example.com/buy/studio-tee?variant=BLACK-XL"
}
}