List a product's variants
const url = 'https://apibase.ecomweb.app/api/v1/stores/example/products/1/variants?attribute_value_ids=3%2C4';const options = {method: 'GET', headers: {'x-api-key': '<x-api-key>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://apibase.ecomweb.app/api/v1/stores/example/products/1/variants?attribute_value_ids=3%2C4' \ --header 'x-api-key: <x-api-key>'Returns every variant of the product, ordered by ID, with its option values. Filter by SKU text with search, or by option values with attribute_value_ids. Variant cost_per_item is returned only when the key holds the read:inventory scope.
Required scopes: read:products
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The product ID.
The store’s ref, as returned by GET /stores.
Query Parameters
Section titled “Query Parameters”Return only variants whose SKU contains this text, ignoring case.
Example
3,4Comma-separated attribute value IDs. Returns variants that use at least one of them.
Responses
Section titled “Responses”object
Variant images.
object
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.
Image URL: the asset’s public_url or cdn_url
Canva design ID
Canva design edit URL
Canva asset ID
Image alt text
Image caption
Sort order for image display
Whether this is the primary image
Attribute values that define the variant.
object
Attribute ID.
Attribute name.
Attribute value ID.
Value as shown to shoppers.
Variant ID.
Merchant-assigned SKU, or null.
Selling price.
Units in stock.
Whether stock is tracked.
deny or continue.
Unit cost. Present only when the key holds the read:inventory scope; null when no cost is recorded.
Variant status.
Example
[ { "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 key is missing, invalid, revoked or expired.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
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.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}The resource does not exist in this store.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}