Search Documentation

Search for a documentation page...

Variants API

REST API endpoints for managing product variants (SKU, price, stock, options).

Product variants represent the purchasable versions of a product — different sizes, colors, or configurations. Each variant has its own SKU, price, stock level, and optional image.

Get Variant

GET /api/v1/variants/:idOrSku

Returns a variant by UUID or SKU code, including product info, price, stock level, and option combinations.

{
"id": "0191abc0-0000-7000-8000-000000000100",
"sku": "CT-SM-BLK",
"price": "2500",
"stock": 42,
"imageUrl": "https://cdn.example.com/tee-black.jpg",
"productId": "0191abc0-1234-7def-8000-000000000001",
"product": {
"name": "Classic Tee",
"slug": "classic-tee"
},
"combinations": {
"size": "Small",
"color": "Black"
}
}

Update Variant

PATCH /api/v1/variants/:idOrSku

Partially updates a variant by UUID or SKU. Only the provided fields are changed.

Request Body

FieldTypeDescription
skustringNew SKU code
titlestringVariant display name (e.g. Large / Red)
priceCentsnumberPrice in cents (e.g. 2999 = $29.99)
imageUrlstring | nullVariant image URL (null to remove)
stocknumberInventory quantity
curl -X PATCH \
-H "Authorization: Bearer your_api_key" \
-H "Content-Type: application/json" \
-d '{
"priceCents": 2999,
"stock": 100,
"sku": "CT-SM-BLK-V2"
}' \
https://your-store.yns.store/api/v1/variants/CT-SM-BLK

Delete Variant

DELETE /api/v1/variants/:idOrSku

Permanently deletes a variant by UUID or SKU. Cannot delete the last variant of a product.

Returns 204 No Content on success.