API reference

Sizes (variants)

On this page

A size (a variant) is a version of a product with its own price, MRP, SKU and weight, for example 250 g or 500 g. A new size starts with 0 in stock; stock changes only through stock adjustments. A size cannot be deleted through the API.

The size object#

FieldTypeMeaning
idintegerThe size id.
product_idintegerThe id of the product the size belongs to.
skustring or nullThe SKU of this size. null when it has none.
labelstringThe size label, for example "250 g".
priceintegerSelling price, in whole units of the store's currency.
mrpintegerMRP, in whole units of the store's currency.
weight_gramsinteger or nullShipping weight in grams.
sortintegerPosition among the sizes of the product.
stockintegerUnits available to sell. Read only: use POST /inventory/adjustments to change it.
created_atstringWhen the size was created (ISO 8601, UTC).
updated_atstringWhen the size was last changed (ISO 8601, UTC).

List the sizes of a product#

GET/api/v1/products/{id}/variantsread:products

Every size of the product with price, MRP, SKU, weight and the current stock (read only).

This list is not paged: it returns every size of the product. meta is empty.

Address parameters

NameTypeMeaning
idintegerThe product id (a whole number).

Example request

curl -s "https://yourstore.example.com/api/v1/products/7/variants" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example answer (200 OK)

{
    "data": [
        {
            "id": 31,
            "product_id": 7,
            "sku": "SAMPLE-001-250",
            "label": "250 g",
            "price": 399,
            "mrp": 449,
            "weight_grams": 250,
            "sort": 0,
            "stock": 120,
            "created_at": "2026-11-01T09:00:00Z",
            "updated_at": "2026-11-21T10:00:00Z"
        }
    ],
    "meta": {}
}

Errors

StatusCodeWhen
401missing_api_key, invalid_api_key, revoked_api_key, expired_api_keyThe key is missing, not valid, revoked or expired.
403insufficient_scopeThe key does not have the read:products scope. error.required_scope names it. (api_key_disabled and ip_not_allowed also give 403.)
404not_foundThat product does not exist.
429rate_limitedMore requests than the key's limit in a minute. Wait for Retry-After.

Example error answer (403):

{
    "error": {
        "code": "insufficient_scope",
        "message": "This API key does not have the \"read:products\" scope. Add it to the key in the admin (API & webhooks > API keys), or use a key that has it.",
        "required_scope": "read:products"
    }
}

Add a size#

POST/api/v1/products/{id}/variantswrite:products

Adds a size to a product. It starts with 0 in stock: use POST /inventory/adjustments to add stock.

The size starts with 0 in stock. Add stock with POST /inventory/adjustments.

Address parameters

NameTypeMeaning
idintegerThe product id (a whole number).

Request body (JSON)

FieldTypeRequiredLimitsMeaning
labelstringYesat most 100 charactersSize label, for example "250 g".
Example: 250 g
priceintegerYesat least 0Selling price in whole units of the store's currency.
Example: 399
mrpintegerYesat least 0MRP (the printed maximum price) in whole units of the store's currency.
Example: 449
skustring or nullNoat most 100 charactersSKU of this size (unique). Used by POST /inventory/adjustments.
Example: SAMPLE-001-250
weight_gramsinteger or nullNo0 to 1000000Shipping weight in grams.
Example: 250

Any field not listed here is refused with 422. Send an Idempotency-Key header so a retry is safe (see Requests).

Example request

curl -s -X POST "https://yourstore.example.com/api/v1/products/7/variants" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 6f1c0b3e-0d5a-4a52-9d5e-1f6c2a7b9e10" \
  -d '{
    "label": "500 g",
    "price": 749,
    "mrp": 849,
    "sku": "SAMPLE-001-500",
    "weight_grams": 500
}'

Example answer (201 Created)

{
    "data": {
        "id": 31,
        "product_id": 7,
        "sku": "SAMPLE-001-250",
        "label": "250 g",
        "price": 399,
        "mrp": 449,
        "weight_grams": 250,
        "sort": 0,
        "stock": 120,
        "created_at": "2026-11-01T09:00:00Z",
        "updated_at": "2026-11-21T10:00:00Z"
    },
    "meta": {}
}

Errors

StatusCodeWhen
401missing_api_key, invalid_api_key, revoked_api_key, expired_api_keyThe key is missing, not valid, revoked or expired.
403insufficient_scopeThe key does not have the write:products scope. error.required_scope names it. (api_key_disabled and ip_not_allowed also give 403.)
404not_foundThat product does not exist.
422validation_failedA field is missing or wrong. error.fields says which and why.
409idempotency_key_reuse, idempotency_in_progressThe Idempotency-Key was used for a different request, or the first request with it is still running.
429rate_limitedMore requests than the key's limit in a minute. Wait for Retry-After.

Example error answer (422):

{
    "error": {
        "code": "validation_failed",
        "message": "The request could not be accepted. See \"fields\" for what to fix.",
        "fields": {
            "label": [
                "The label field is required."
            ]
        }
    }
}

Update a size#

PATCH/api/v1/products/{id}/variants/{variantId}write:products

Changes label, price, MRP, SKU or weight of one size. Stock is not accepted here. A size cannot be deleted through the API.

Address parameters

NameTypeMeaning
idintegerThe product id (a whole number).
variantIdintegerThe size id (a whole number).

Request body (JSON)

FieldTypeRequiredLimitsMeaning
labelstringNoat most 100 charactersSize label, for example "250 g".
Example: 250 g
priceintegerNoat least 0Selling price in whole units of the store's currency.
Example: 399
mrpintegerNoat least 0MRP (the printed maximum price) in whole units of the store's currency.
Example: 449
skustring or nullNoat most 100 charactersSKU of this size (unique). Used by POST /inventory/adjustments.
Example: SAMPLE-001-250
weight_gramsinteger or nullNo0 to 1000000Shipping weight in grams.
Example: 250

Any field not listed here is refused with 422. Send an Idempotency-Key header so a retry is safe (see Requests).

Example request

curl -s -X PATCH "https://yourstore.example.com/api/v1/products/7/variants/31" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 6f1c0b3e-0d5a-4a52-9d5e-1f6c2a7b9e10" \
  -d '{
    "price": 389,
    "mrp": 449
}'

Example answer (200 OK)

{
    "data": {
        "id": 31,
        "product_id": 7,
        "sku": "SAMPLE-001-250",
        "label": "250 g",
        "price": 399,
        "mrp": 449,
        "weight_grams": 250,
        "sort": 0,
        "stock": 120,
        "created_at": "2026-11-01T09:00:00Z",
        "updated_at": "2026-11-21T10:00:00Z"
    },
    "meta": {}
}

Errors

StatusCodeWhen
401missing_api_key, invalid_api_key, revoked_api_key, expired_api_keyThe key is missing, not valid, revoked or expired.
403insufficient_scopeThe key does not have the write:products scope. error.required_scope names it. (api_key_disabled and ip_not_allowed also give 403.)
404not_foundThat product or size does not exist.
422validation_failedA field is missing or wrong. error.fields says which and why.
409idempotency_key_reuse, idempotency_in_progressThe Idempotency-Key was used for a different request, or the first request with it is still running.
429rate_limitedMore requests than the key's limit in a minute. Wait for Retry-After.

Example error answer (422):

{
    "error": {
        "code": "validation_failed",
        "message": "The request could not be accepted. See \"fields\" for what to fix.",
        "fields": {
            "label": [
                "The label field is required."
            ]
        }
    }
}