Preview Variant Combinations
POST/api/v2/products/:product/variants/preview
Returns one row per combination of the given attribute values, with the SKU each new variant would get. Nothing is written.
products:writeGrant this scope to your token under Settings → Developer → Personal Access Tokens.
Each row reports exists (a variant with that combination already exists and will be skipped), duplicate_sku (two combinations produce the same SKU — fix the pattern), sku_taken (another product, archived ones included, already holds the SKU; sku_conflict explains and sku_holder_id names that product) and combo_key, the stable key used for exclusions and per-row pricing.
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 out
Authentication: Requires Bearer token.
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
- 200
- 401
- 403
- 404
- 422
- 429
OK
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.