Skip to content

Patch a variant

PATCH
/stores/{storeRef}/products/{productId}/variants/{variantId}
curl --request PATCH \
--url https://apibase.ecomweb.app/api/v1/stores/example/products/1/variants/1 \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '{ "seller_sku": "example", "external_id": "example", "price": 1, "inventory": 1, "min_stock_alert": 1, "weight": 1, "dimensions": { "length": 1, "width": 1, "height": 1, "unit": "example" }, "status": "active", "is_default": true, "track_inventory": true, "inventory_policy": "deny", "cost_per_item": 125000, "images": [ { "id": "b1f0…", "url": "https://cdn.ecomweb.app/stores/1/red.jpg" } ], "combinations": [ { "option_id": 1, "option_value_id": 5 } ] }'

Writes only the keys present in the body and leaves everything else unchanged. Send an explicit null to clear a nullable column. A change to inventory is recorded as a stock adjustment. Variant cost_per_item is returned only when the key holds the read:inventory scope.

Required scopes: write:products

productId
required
integer

The product ID.

variantId
required
integer

The variant ID.

storeRef
required
string

The store’s ref, as returned by GET /stores.

Media typeapplication/json
object
seller_sku

Seller SKU

string
nullable
external_id

External integration id

string
nullable
price

Price

number
inventory

Absolute inventory count

number
min_stock_alert

Low-stock alert threshold

number
nullable
weight

Weight

number
nullable
dimensions
object
length

Length in specified unit

number
width

Width in specified unit

number
height

Height in specified unit

number
unit

Unit of measurement

string
status
string
Allowed values: active inactive out_of_stock
is_default

Whether this variant is the product’s default

boolean
track_inventory

Track stock for this variant. An untracked variant is never reserved and never blocked at checkout.

boolean
default: true

Example

true
inventory_policy

Deny: checkout rejects an order this variant cannot cover. continue: keep selling past zero.

string
default: deny
Allowed values: deny continue

Example

deny
cost_per_item

What the store pays per unit. null clears it. Never returned to storefront callers.

number
nullable

Example

125000
images
Array<object>
object
id
required

Asset id

string

Example

b1f0…
url
required

Public asset URL

string

Example

https://cdn.ecomweb.app/stores/1/red.jpg
combinations

Option pairs for this variant. Omit to leave unchanged; send [] to clear (retires the variation axis); send a set to replace.

Array<object>
object
option_id
required

Variant option ID

number
>= 1

Example

1
option_value_id
required

Variant option value ID

number
>= 1

Example

5
Media typeapplication/json
object
inventory_policy
required

deny rejects checkout when stock is short; continue lets stock go negative.

string
Allowed values: deny continue
dimensions
required

Package dimensions, or null.

object
key
additional properties
any
images
required

Images for this variant.

Array<object>
object
id

Asset ID of the image. Omit it to have the asset looked up from url, which must then be a URL of an asset uploaded to this store.

string
url
required

Image URL: the asset’s public_url or cdn_url

string
design_id

Canva design ID

string
design_edit_url

Canva design edit URL

string
canva_asset_id

Canva asset ID

string
alt

Image alt text

string
caption

Image caption

string
sort_order

Sort order for image display

number
is_primary

Whether this is the primary image

boolean
combinations

Attribute values that define this variant. Present only when combinations are requested.

Array<object>
object
attributes
required

The attribute (axis), or null when it no longer exists.

object
id
required

Attribute ID.

number
name
required

Attribute name, such as “Color”.

string
slug
required

URL-safe identifier of the attribute, unique within the store.

string
type
required

How values are chosen, such as select.

string
order_by
required

How the values are ordered, such as manual.

string
sort_order
required

Position of the attribute among the store’s attributes.

number
nullable
created_at
required

When the attribute was created, as an ISO 8601 timestamp.

string
updated_at
required

When the attribute was last updated, as an ISO 8601 timestamp.

string
taxonomy_attribute_code
required

Code of the global taxonomy attribute this one maps to, or null for a local attribute.

string
nullable
attribute_values
required

The chosen value, or null when it no longer exists.

object
id
required

Attribute value ID.

number
attribute_id
required

ID of the attribute this value belongs to.

number
value
required

Stored value, such as “red”.

string
display_value
required

Value as shown to shoppers, such as “Red”.

string
swatch_type
required

Swatch kind: none, color or image.

string
swatch_value
required

Swatch content: a color code or an image URL. Empty when there is no swatch.

string
sort_order
required

Position of the value within its attribute.

number
nullable
created_at
required

When the value was created, as an ISO 8601 timestamp.

string
updated_at
required

When the value was last updated, as an ISO 8601 timestamp.

string
taxonomy_value_code
required

Code of the global taxonomy value this one maps to, or null.

string
nullable
promotions

Active promotions on this variant. Present only when promotions are requested on a single product.

Array<object>
object
id
required

Promotion ID.

number
name
required

Promotion name.

string
description

Promotion description.

string
mode
required

How the promotion is applied, such as automatic or code.

string
code

Discount code, for code promotions.

string
type
required

Promotion type.

string
condition_type
required

What the promotion targets, such as product or variant.

string
discount_method

How the discount is computed, such as PERCENTAGE or FIXED_AMOUNT.

string
discount_value

Discount amount or percentage.

number
max_discount_amount

Upper bound on the discount amount.

number
fixed_price

Fixed price the item is sold at, for fixed-price promotions.

number
min_amount

Minimum order amount for the promotion to apply.

number
min_quantity

Minimum quantity for the promotion to apply.

number
start_at
required

When the promotion starts, as an ISO 8601 timestamp.

string
end_at

When the promotion ends, as an ISO 8601 timestamp.

string
promotion_price
required

Price after the promotion.

number
original_price
required

Price before the promotion.

number
discount_amount
required

Amount taken off the original price.

number
best_promotion

The promotion giving the lowest price, or null. Present only when promotions are requested on a single product.

object
id
required

Promotion ID.

number
name
required

Promotion name.

string
description

Promotion description.

string
mode
required

How the promotion is applied, such as automatic or code.

string
code

Discount code, for code promotions.

string
type
required

Promotion type.

string
condition_type
required

What the promotion targets, such as product or variant.

string
discount_method

How the discount is computed, such as PERCENTAGE or FIXED_AMOUNT.

string
discount_value

Discount amount or percentage.

number
max_discount_amount

Upper bound on the discount amount.

number
fixed_price

Fixed price the item is sold at, for fixed-price promotions.

number
min_amount

Minimum order amount for the promotion to apply.

number
min_quantity

Minimum quantity for the promotion to apply.

number
start_at
required

When the promotion starts, as an ISO 8601 timestamp.

string
end_at

When the promotion ends, as an ISO 8601 timestamp.

string
promotion_price
required

Price after the promotion.

number
original_price
required

Price before the promotion.

number
discount_amount
required

Amount taken off the original price.

number
id
required

Variant ID.

number
product_id
required

ID of the product this variant belongs to.

number
sku_id
required

Store-wide numeric SKU identifier, assigned automatically.

number
seller_sku
required

Merchant-assigned SKU, or null.

string
nullable
external_id
required

The variant’s ID in an external system, or null.

string
nullable
price
required

Selling price in the store’s currency.

number
inventory
required

Units available across all locations.

number
nullable
inventory_version
required

Counter that increases on every stock change.

number
min_stock_alert
required

Stock level at or below which the variant counts as low stock.

number
nullable
track_inventory
required

Whether stock is tracked. When false the variant never runs out.

boolean
cost_per_item

Unit cost to the store. Present only when the key holds the read:inventory scope. Null when no cost is recorded.

number
nullable
weight
required

Weight, in the store’s weight unit, or null.

number
nullable
is_default
required

Whether this is the product’s default variant.

boolean
nullable
status
required

Variant status, such as active or inactive.

string
nullable
created_at
required

When the variant was created, as an ISO 8601 timestamp.

string
updated_at
required

When the variant was last updated, as an ISO 8601 timestamp.

string
promotion_price

Price after the best active promotion. Present only when promotions are requested; null when none applies.

number
nullable

Example

{
"inventory_policy": "deny",
"images": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"url": "https://example.com/image.jpg",
"design_id": "DABCdefg123",
"design_edit_url": "https://canva.com/design/edit/123",
"canva_asset_id": "asset123",
"alt": "Product image",
"caption": "Main product view",
"sort_order": 1,
"is_primary": true
}
]
}

The request is malformed or failed validation.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}

The key is missing, invalid, revoked or expired.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}

The key may not do this: a missing scope, a readonly key, a publishable key on a Store API route, or a disallowed origin.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}

The resource does not exist in this store.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}

The request conflicts with the resource’s current state.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}