Generate Variants
POST/api/v2/products/:product/variants/generate
Creates a variant (child product) under the parent for every combination that does not already exist, and records the attributes used on the parent as its variation axes. Each variant is created on its own, so one failure does not stop the rest; the response counts created, skipped and failed variants.
products:writeGrant this scope to your token under Settings → Developer → Personal Access Tokens.
Optional pricing: default_price is set on the default pricing tier of every new variant and default_unit_cost becomes its unit cost. row_pricing overrides either value for single combinations — a null value inherits the default. Leave all three out and the variants are created without a price or cost. Prices are recorded in price history and reach listings and derived pricing tiers like any other price change. Existing variants are never repriced.
Body fields
attributes(array, required, 1–3 items) — the matrix to combineattributes[].attribute_id(integer, required) — an existing attribute IDattributes[].values(array of strings, required, each ≤120 chars) — the values to combinesku_pattern(string, required, ≤120 chars) — placeholders{parent_sku},{v1},{v2},{v3}(or{value1}…). Values keep their case; spaces and punctuation are removed.exclusions(array of strings, optional) —combo_keyvalues to leave outdefault_price(number, optional, 0–99999.99)default_unit_cost(number, optional, 0–99999.99)row_pricing(array, optional)row_pricing[].combo_key(string, required) — from the previewrow_pricing[].price(number|null, optional, 0–99999.99)row_pricing[].unit_cost(number|null, optional, 0–99999.99)
Returns 422 when duplicate SKUs are in the grid, when a value is out of range, or when a price is sent but no pricing tier is marked as the default.
Authentication: Requires Bearer token.
Copy from parent: every new variant inherits what siblings share from the parent, per group in copy_from_parent.groups: suppliers (supplier links, default supplier, supplier costs, lead time, minimum order quantity; the supplier SKU from supplier_sku_pattern), pricing (every pricing tier price, quantity breaks, unit cost), classification (brand, product type, categories, seasons, HTS and tariff codes, country of origin), physical (weight, dimensions, case quantity/dimensions/weight with units), media (images linked to the parent's files, non-variant attributes such as the description, tags, custom fields), tax_accounting (taxable, default tax rate, sales tax category, nominal code overrides), inventory (backorders, negative inventory, lot and serial tracking, shelf life, minimum stock level, dropship, preferred bins) and channels (not for sale on channels, channel exclusions). A price or unit cost in default_price / default_unit_cost / row_pricing wins over the copied value. Never copied: SKU, name, barcode, MPN, the variant's own attribute values, stock and listings.
copy_from_parent(object, optional) — leave it out to copy every groupcopy_from_parent.groups(array of strings, required withcopy_from_parent) — any ofsuppliers,pricing,classification,physical,media,tax_accounting,inventory,channels; an empty array copies nothingcopy_from_parent.supplier_sku_pattern(string, optional, ≤120 chars) — placeholders{parent_supplier_sku},{parent_sku},{v1}…; default{parent_supplier_sku}-{v1}. Blank, or a parent link without a supplier SKU, leaves the variant's supplier SKU empty.
A product that is itself a variant (it has a parent) cannot have variants: the request is refused with 422 on product. Generate variants on its parent instead.
Request
Responses
- 201
- 401
- 403
- 404
- 422
- 429
Created
Response Headers
Unauthenticated — the bearer token is missing, revoked, expired, or malformed. Never retry automatically; fix the credential. See the Errors guide.
Forbidden — the token lacks a required scope, the endpoint is not available to API tokens, or the user behind the token lacks the permission. A human must adjust the token scopes or user permissions; do not retry.
Not found — no record with the given identifier (or the route does not exist). Verify the ID before retrying.
Unprocessable Entity
Response Headers
Rate limited — platform limit is 1,000 requests/min; individual tokens may carry lower limits. Honor the Retry-After header before retrying. See the Rate Limits guide.