A product variant is a specific product version with a unique combination of product option values.
Sample variant [ JSON ]
{
"created_at": 1678887627,
"deleted": false,
"description": "T-shirt for men",
"external_name": "Red Small T-shirt1678887627471",
"id": "01GVJR0ASC2AB80F7KATTCMWFB",
"metadata": {
"brand": "HRX"
},
"name": "Red S T-shirt1678887627471",
"object": "variant",
"option_values": [
{
"name": "color",
"value": "red"
},
{
"name": "size",
"value": "s"
}
],
"product_id": "01GVJR0A1TZ5AMR6PPBEG85Q09",
"resource_version": 1678887627621,
"sku": "sku-12346780",
"status": "active",
"updated_at": 1678887627
}
API Index URL GET
https://{site}.chargebee.com/api/v2/variants
optional, string, max chars=100 The immutable unique identifier of a product variant.
string, max chars=100 This is a unique name that appears for each product variant to the end user.
optional, string, max chars=100 This is a unique name appears for each product variant to the end user.
optional, string, max chars=500 Description of the product variant.
optional, string, max chars=100 A unique identifier code a seller assigns to each product variant. Retailers and merchants use SKUs to keep track of inventory and sales data and help organize products within a store or warehouse. SKUs can include a combination of letters, numbers, and symbols and can vary in length depending on the seller's needs.
boolean, default=false Product variant is deleted or not. If the value is true
then the product variant has been deleted else it exists. Once the product variant is deleted, you can reuse the product variant id
and name
.
string, max chars=100 The unique identifier of the product that is associated with this variant.
optional, enumerated string Status of the product variant. Possible values are
activeThe active product variants are visible on the storefront, subscription, or checkout.inactiveThe inactive product variants are not visible on the storefront, subscription, or checkout.
Show all values[+]
timestamp(UTC) in seconds Timestamp when the product variant was created.
optional, long Version number of this resource. The resource_version
is updated with a new timestamp in milliseconds for every change made to the resource. This attribute will be present only if the resource has been updated after 2016-09-28.
optional, timestamp(UTC) in seconds Timestamp indicating when this product variant was last updated.
optional, jsonobject A collection of key-value pairs that provides extra information about the variant. Note: There's a character limit of 65,535.
Learn more. optional, list of option_value
List of product variants option values.
optional, string, max chars=100 Name of the option values.
optional, string, max chars=100 Pass values of the option_values
.
optional, string, max chars=100 The immutable unique identifier of a product variant.
string, max chars=100 This is a unique name that appears for each product variant to the end user.
optional, string, max chars=100 This is a unique name appears for each product variant to the end user.
optional, string, max chars=500 Description of the product variant.
optional, string, max chars=100 A unique identifier code a seller assigns to each product variant. Retailers and merchants use SKUs to keep track of inventory and sales data and help organize products within a store or warehouse. SKUs can include a combination of letters, numbers, and symbols and can vary in length depending on the seller's needs.
boolean, default=false Product variant is deleted or not. If the value is true
then the product variant has been deleted else it exists. Once the product variant is deleted, you can reuse the product variant id
and name
.
string, max chars=100 The unique identifier of the product that is associated with this variant.
optional, enumerated string Status of the product variant. Possible values are
activeThe active product variants are visible on the storefront, subscription, or checkout.inactiveThe inactive product variants are not visible on the storefront, subscription, or checkout.
Show all values[+]
timestamp(UTC) in seconds Timestamp when the product variant was created.
optional, long Version number of this resource. The resource_version
is updated with a new timestamp in milliseconds for every change made to the resource. This attribute will be present only if the resource has been updated after 2016-09-28.
optional, timestamp(UTC) in seconds Timestamp indicating when this product variant was last updated.
optional, jsonobject A collection of key-value pairs that provides extra information about the variant. Note: There's a character limit of 65,535.
Learn more.
optional, list of option_value List of product variants option values. This API is used for creating a new product variant.
The following table will help you to understand the state of the variant status
after passing status value during variant creation.
-
Parameter Value column holds possible inputs to the variant.status
.
-
Product Status column states the status of the associated product.
-
Variant Status column states the value of the variant status once the variant is created.
Parameter Value | Product Status | Variant Status |
No value passed | active | active |
No value passed | inactive | inactive |
Value passed as active | active | active |
Value passed as inactive | active | inactive |
Value passed as active | inactive | not allowed |
Value passed as inactive | inactive | inactive |
This API is not enabled for live sites by default. Please contact
support to get this enabled.
Sample Response [ JSON ]
Show more...
{
"variant": {
"created_at": 1678887627,
"deleted": false,
"description": "T-shirt for men",
"external_name": "Red Small T-shirt1678887627471",
"id": "01GVJR0ASC2AB80F7KATTCMWFB",
"metadata": {
"brand": "HRX"
},
"name": "Red S T-shirt1678887627471",
"object": "variant",
"option_values": [
{
"name": "color",
"value": "red"
},
{..}
],
"product_id": "01GVJR0A1TZ5AMR6PPBEG85Q09",
"resource_version": 1678887627621,
"sku": "sku-12346780",
"status": "active",
"updated_at": 1678887627
}
}
URL Format
POST
https://{site}.chargebee.com/api/v2/products/{product-id}/variants
optional, string, max chars=100 The immutable unique identifier of a product variant. If not passed, it will get autogenerated.
required, string, max chars=100 This is a unique name that appears for each product variant to the end user.
optional, string, max chars=100 The unique name that appears for each product variant to the end user.
optional, string, max chars=500 A detailed description of this product variant.
optional, string, max chars=100 A unique identifier code a seller assigns to each product variant. Retailers and merchants use SKUs to keep track of inventory and sales data and help organize products within a store or warehouse. SKUs can include a combination of letters, numbers, and symbols and can vary in length depending on the seller's needs.
optional, jsonobject A collection of key-value pairs that provides extra information about the product. Note: There's a character limit of 65,535.
Learn more.
optional, enumerated string Status of the product variant. Refer to the table for more information. Possible values are
activeThe active product variants are visible on the storefront, subscription, or checkout.inactiveThe inactive product variants are not visible on the storefront, subscription, or checkout.
Show all values[+] option_values[[0..n]][0..n]
optional, array Parameters for option_values. Multiple option_values can be passed by specifying unique indices.
Parameters for option_values. Multiple option_values can be passed by specifying unique indices.
pass parameters as option_values[<param name>][<idx:0..n>]
option_values[name][0..n] required, string, max chars=100 option_values[value][0..n] required, string, max chars=100
always returned required
Resource object representing variant
Sample admin console URL
https://{site}.chargebee.com/admin-console/variants/123x
This API is used to retrieve a product variant using variant_id
.
This API is not enabled for live sites by default. Please contact
support to get this enabled.
Sample Response [ JSON ]
Show more...
{
"variant": {
"created_at": 1678887632,
"deleted": false,
"description": "Red Medium T-shirt for men",
"external_name": "Red Medium T-shirt1678887631188",
"id": "01GVJR0EHF9X3RM1JHQYQBKYG7",
"name": "Red M T-shirt1678887631188",
"object": "variant",
"option_values": [
{
"name": "size",
"value": "m"
},
{..}
],
"product_id": "01GVJR0DS3VCGE3FMEH8WD5A42",
"resource_version": 1678887632000,
"sku": "sku-12346781",
"status": "active",
"updated_at": 1678887632
}
}
URL Format
GET
https://{site}.chargebee.com/api/v2/variants/{product-variant-id}
always returned required
Resource object representing variant
Sample admin console URL
https://{site}.chargebee.com/admin-console/variants/123x
This API is used to modify a product variant.
This API is not enabled for live sites by default. Please contact
support to get this enabled.
Sample Response [ JSON ]
Show more...
{
"variant": {
"created_at": 1678887633,
"deleted": false,
"description": "Blue XLarge T-shirt for men",
"external_name": "Blue XLarge T-shirt1678887632951",
"id": "01GVJR0FWF7HNWH93VD2QKC8P9",
"name": "Blue L T-shirt1678887632951",
"object": "variant",
"option_values": [
{
"name": "color",
"value": "red"
},
{..}
],
"product_id": "01GVJR0FC03W10PTT5Y5TYPTD8",
"resource_version": 1678887633036,
"sku": "sku-1234679",
"status": "active",
"updated_at": 1678887633
}
}
URL Format
POST
https://{site}.chargebee.com/api/v2/variants/{product-variant-id}
optional, string, max chars=100 This is a unique name that appears for each product variant to the end user.
optional, string, max chars=500 A detailed description of this product variant.
optional, enumerated string Status of the product variant. Possible values are
activeThe active product variants are visible on the storefront, subscription, or checkout.inactiveThe inactive product variants are not visible on the storefront, subscription, or checkout.
Show all values[+]
optional, string, max chars=100 The unique name that appears for each product variant to the end user.
optional, string, max chars=100 A unique identifier code a seller assigns to each product variant. Retailers and merchants use SKUs to keep track of inventory and sales data and help organize products within a store or warehouse. SKUs can include a combination of letters, numbers, and symbols and can vary in length depending on the seller's needs.
optional, jsonobject A collection of key-value pairs that provides extra information about the variant. Note: There's a character limit of 65,535.
Learn more.
always returned required
Resource object representing variant
Sample admin console URL
https://{site}.chargebee.com/admin-console/variants/123x
This API deletes a product variant and returns the delete attribute value as true
. Deletion of a product variant is not allowed if there are active
or archived
item_price_id
under the variant. Once the variant is deleted, the id
and name
of the product variant can be reused.
This API is not enabled for live sites by default. Please contact
support to get this enabled.
Sample Response [ JSON ]
Show more...
{
"variant": {
"created_at": 1678887629,
"deleted": true,
"description": "Red XLarge T-shirt for men",
"external_name": "Red XLarge T-shirt1678887628727",
"id": "01GVJR0BZWQNK469QKE05AEMC2",
"name": "Red XL T-shirt1678887628727",
"object": "variant",
"option_values": [
{
"name": "color",
"value": "red"
},
{..}
],
"product_id": "01GVJR0B9KF1BQE9GB19CNQFDR",
"resource_version": 1678887629125,
"sku": "sku-12346783",
"status": "active",
"updated_at": 1678887629
}
}
URL Format
POST
https://{site}.chargebee.com/api/v2/variants/{product-variant-id}/delete
always returned required
Resource object representing variant
Sample admin console URL
https://{site}.chargebee.com/admin-console/variants/123x
This API retrieves the list of product variants.
This API is not enabled for live sites by default. Please contact
support to get this enabled.
Sample Response [ JSON ]
Show more...
{
"list": [
{
"variant": {
"option_values": [
{
"name": "color",
"value": "red"
},
{..}
],
"created_at": 1677570619,
"deleted": false,
"description": "T-shirt for men",
"external_name": "Red XXLarge T-shirt1677570618284",
"id": "01GTBG0D29TMDZRGMFVRFY5X35",
"metadata": {
"brand": "HRX"
},
"name": "Red XXL T-shirt1677570618284",
"object": "variant",
"product_id": "01GTBG0C1BR59BY8ARK1640ZGT",
"resource_version": 1677570619000,
"sku": "sku-12346780",
"status": "active",
"updated_at": 1677570619
}
},
{..}
]
}
URL Format
GET
https://{site}.chargebee.com/api/v2/products/{product-id}/variants
optional, integer, default=10, min=1, max=100 The number of resources to be returned.
optional, string, max chars=1000 Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set offset
to the value of next_offset
obtained in the previous iteration of the API call.
optional, boolean, default=false If set to true
, it includes the deleted variants in the API response.
optional, string filter
Sorts based on the specified attribute.
Supported attributes : name, id, status, created_at, updated_at
Supported sort-orders : asc, desc
Example → sort_by[asc] = "name"
This will sort the result based on the 'name'
attribute in ascending(earliest first) order.
optional, string filter Filter variant based on their id. Possible values are : Supported operators : is, is_not, starts_with, in, not_in
Example → id[is] = "basic" Filter variant based on their id. pass parameters as id[<param name>][<operator>] optional, string, min chars=1 filter
Possible values are :
Supported operators :
Example →
optional, string, min chars=1 filter
Possible values are :
Supported operators :
Example →
id[starts_with][operator] id[starts_with][operator] optional, string, min chars=1 filter
Possible values are :
Supported operators :
Example →
optional, string filter
Possible values are :
Supported operators :
Example →
optional, string filter
Possible values are :
Supported operators :
Example →
optional, string filter
Filter variant based on their name
s. Possible values are :
Supported operators : is, is_not, starts_with, in, not_in
Example → name[is] = "basic"
Filter variant based on their name
s.
pass parameters as name[<param name>][<operator>]
optional, string, min chars=1 filter
Possible values are :
Supported operators :
Example →
optional, string, min chars=1 filter
Possible values are :
Supported operators :
Example →
name[starts_with][operator] name[starts_with][operator] optional, string, min chars=1 filter
Possible values are :
Supported operators :
Example →
optional, string filter
Possible values are :
Supported operators :
Example →
optional, string filter
Possible values are :
Supported operators :
Example →
optional, string filter
Filter variant based on their sku
. Possible values are :
Supported operators : is, is_not, starts_with, in, not_in
Example → sku[is] = "basic"
Filter variant based on their sku
.
pass parameters as sku[<param name>][<operator>]
optional, string, min chars=1 filter
Possible values are :
Supported operators :
Example →
optional, string, min chars=1 filter
Possible values are :
Supported operators :
Example →
sku[starts_with][operator] sku[starts_with][operator] optional, string, min chars=1 filter
Possible values are :
Supported operators :
Example →
optional, string filter
Possible values are :
Supported operators :
Example →
optional, string filter
Possible values are :
Supported operators :
Example →
optional, enumerated string filter
Filter variant based on their status
. Possible values are : active, inactive
Supported operators : is, is_not, in, not_in
Example → status[is] = "active"
Filter variant based on their status
.
pass parameters as status[<param name>][<operator>]
optional, enumerated string filter
Possible values are : active, inactive
Supported operators :
Example →
optional, enumerated string filter
Possible values are : active, inactive
Supported operators :
Example →
optional, string filter
Possible values are :
Supported operators :
Example →
optional, string filter
Possible values are :
Supported operators :
Example →
optional, timestamp(UTC) in seconds filter
Filter product based on their updated time
. Possible values are :
Supported operators : after, before, on, between
Example → updated_at[after] = "basic"
Filter product based on their updated time
.
pass parameters as updated_at[<param name>][<operator>]
updated_at[after][operator] updated_at[after][operator] optional, timestamp(UTC) in seconds filter
Possible values are :
Supported operators :
Example →
updated_at[before][operator] updated_at[before][operator] optional, timestamp(UTC) in seconds filter
Possible values are :
Supported operators :
Example →
optional, timestamp(UTC) in seconds filter
Possible values are :
Supported operators :
Example →
updated_at[between][operator] updated_at[between][operator] optional, string filter
Possible values are :
Supported operators :
Example →
optional, timestamp(UTC) in seconds filter
Filter product based on their created time
. Possible values are :
Supported operators : after, before, on, between
Example → created_at[after] = "basic"
Filter product based on their created time
.
pass parameters as created_at[<param name>][<operator>]
created_at[after][operator] created_at[after][operator] optional, timestamp(UTC) in seconds filter
Possible values are :
Supported operators :
Example →
created_at[before][operator] created_at[before][operator] optional, timestamp(UTC) in seconds filter
Possible values are :
Supported operators :
Example →
optional, timestamp(UTC) in seconds filter
Possible values are :
Supported operators :
Example →
created_at[between][operator] created_at[between][operator] optional, string filter
Possible values are :
Supported operators :
Example →
always returned required
Resource object representing variant
always returned optional, string, max chars=1000
This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`.
Sample admin console URL
https://{site}.chargebee.com/admin-console/variants/123x