Create Variant

Create a new product variant with the specified details.

🔒

Requires write_product access scope. More access scope

The Create Variant API allows users to add a new product variant to an existing product by specifying details such as options, pricing, inventory, and wholesale information. This operation is used to expand a product’s available options by creating additional variants with unique attributes.This API is especially useful for:

1.Adding new variants to existing products with different options like size, color, or style.

2.Managing inventory and pricing for individual product variants.

3.Customizing product variants for wholesale or retail purposes.

Request Parameters

Request Parameters

Public Request Parameters

📘

Body Parameters

ParameterTypeRequiredDescriptionExample
variantobjectYesVariant configuration-
variant.option1stringNoFirst option value"Black"
variant.option2stringNoSecond option value"Large"
variant.option3stringNoThird option value""
variant.image_idstringNoAssociated image ID"img_987654"
variant. compare_at_pricefloatNoOriginal/compare price199.99
variant.pricefloatYesSelling price149.99
variant.skustringNoStock keeping unit"SKU123-BLK-L"
variant.barcodestringNoProduct barcode"123456789012"
variant.notestringNoInternal notes"Limited edition"
variant.inventory_quantitystringNoInitial stock quantity"100"
variant.weightfloatNoProduct weight0.75
variant.weight_unitstringNoWeight measurement unit"kg"
variant.cost_pricefloatNoCost price89.99
variant.wholesale_pricearray of objectsNoWholesale pricing tiers-
variant.wholesale_price. pricefloatYesWholesale price129.99
variant.wholesale_price. min_quantitystringYesMinimum order quantity"10"
variant.retail_pricefloatNoRetail price149.99
variant.positionstringYesDisplay position"2"
variant.extendobjectNoExtended properties-
variant.extend.lengthfloatNoProduct length25.5
variant.extend.widthfloatNoProduct width18.0
variant.extend.heightfloatNoProduct height8.5
variant.extend.dimension_unitstringNoDimension unit"cm"
variant.extend. origin_country_codestringNoCountry of origin"CN"
variant.extend.hs_codestringNoHS classification code"8518.29.00"

Response Explanation

Public Response Parameters

📘

Successful Response

ParameterTypeExampleDescription
codestring"200"HTTP status code
messagestring"Success"Operation result message
data.variantobjects-

Variant Object

ParameterTypeExampleDescription
idstring"var_987654321"Unique variant identifier
product_idstring"prod_123456789"Parent product ID
image_idstring"img_456789"Primary image reference
created_atstring"2025-01-15T09:00:00Z"Creation timestamp
updated_atstring"2025-06-15T14:30:00Z"Last update timestamp
titlestring"Large / Black"Variant display title
option1string"Black"First option value
option2string"Large"Second option value
option3string""Third option value
imageobject-Variant image details
image.srcstring"https://example. com/image.jpg"Image URL
image.widthint32800Image width in pixels
image.heightint32600Image height in pixels
image.altstring"Black variant"Image alt text
image.pathstring"/images/variants"Image storage path
positionstring"1"Display position
compare_at_pricefloat199.99Original/comparison price
pricefloat149.99Current selling price
skustring"SKU123-BLK-L"Stock keeping unit
barcodestring"123456789012"Product barcode
notestring"New stock"Internal notes
inventory_quantitystring"50"Current stock level
weightfloat0.75Product weight
weight_unitstring"kg"Weight measurement unit
cost_pricefloat89.99Cost/production price
whole_pricesarray of objects-Wholesale pricing tiers
whole_prices.pricefloat129.99Wholesale price
whole_prices. min_quantitystring"10"Minimum order quantity
retail_pricefloat149.99Retail price
is_discountbooleantrueDiscount status flag
origin_pricefloat179.99Original base price
extendobject-Extended properties
extend.lengthfloat25.5Product length
extend.widthfloat18.0Product width
extend.heightfloat8.5Product height
extend. dimension_unitstring"cm"Dimension unit
extend. origin_country_codestring"CN"Country of origin
extend.hs_codestring"8518.29.00"Harmonized System code

Error Response

FieldTypeExampleDescription
codestringInvalidParameterError http message
messagestring``Error message
Language
Credentials
Header
URL
Click Try It! to start a request and see the response here!