← Home
POST/hyax-api/v1/products/:id/variants/generate

Generate variants

Creates one variant per combination of the product's options. Safe to re-run: existing rows are adopted and keep their price, stock and imagery, combinations that disappeared are retired (not deleted, so past orders still resolve), and previously retired combinations come back if they reappear.

Base URL: https://platform.hyax.com · Replace YOUR_API_KEY with your team API key.

Request body

FieldRequiredDescription
defaultPriceNoSeeds newly created combinations only. Existing rows keep their price
defaultInventoryNoStock for new combinations; `null` is unlimited. Omit to let the type decide — 0 for `PHYSICAL`, unlimited otherwise
retireMissingNoBoolean, default `true`. Set false to leave stale combinations alone

Request

curl -X POST 'https://platform.hyax.com/hyax-api/v1/products/clx_example_id/variants/generate' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "defaultPrice": 29,
    "defaultInventory": 25
  }'

Response

{
  "success": true,
  "summary": { "created": 6, "updated": 0, "retired": 0 },
  "data": [
    {
      "id": "clx…",
      "sku": "BLACK-XS",
      "title": "Black / XS",
      "price": 29,
      "inventory": 25,
      "isSoldOut": false,
      "isRetired": false,
      "options": [
        { "group": "Color", "value": "Black" },
        { "group": "Size", "value": "XS" }
      ],
      "variantRef": "BLACK-XS",
      "buyUrl": "https://shop.example.com/buy/studio-tee?variant=BLACK-XS"
    }
  ]
}