Product Variants | Smartbills API Documentation

Product Variants

This object represents a variant of a product in your business. Use it to manage different versions of products (like sizes, colors, etc.).

Scopes

products.read products.write

Core principles

A variant belongs to a product and can have its own price, SKU, and other attributes.

Create a product variant

Create a new variant for a product. Requires scope products.write

POST https://api.smartbills.io/v1/products/{productId}/variants

Path Parameters

ParameterDescriptionTypeRequired
productIdProduct IDlongtrue

Request Body

Requires body of type ProductVariantCreateRequest

ParameterDescriptionTypeRequired
initialPriceInitial pricedecimal
priceCurrent pricedecimaltrue
weightUnitWeight unitstring
weightWeight valuedecimal
taxableIs taxableboolean
nameVariant namestring
imageIdsAssociated imageslong[]
skuSKUstring
upcUPC codestring
ProductVariantCreateRequest
{
  "initialPrice": 0,
  "price": 0,
  "weightUnit": "string",
  "weight": 0,
  "taxable": true,
  "name": "string",
  "imageIds": [],
  "sku": "string",
  "upc": "string"
}

Get a product variant

Retrieve a specific variant of a product. Requires scope products.read

GET https://api.smartbills.io/v1/products/{productId}/variants/{variantId}

Path Parameters

ParameterDescriptionTypeRequired
productIdProduct IDlongtrue
variantIdVariant IDlongtrue

Response

Returns a ProductVariantResponse object.

Update a product variant

Update an existing product variant. Requires scope products.write

PUT https://api.smartbills.io/v1/products/{productId}/variants/{variantId}

Path Parameters

ParameterDescriptionTypeRequired
productIdProduct IDlongtrue
variantIdVariant IDlongtrue

Request Body

Same as create request (ProductVariantCreateRequest)

Delete a product variant

Delete a product variant. Requires scope products.write

DELETE https://api.smartbills.io/v1/products/{productId}/variants/{variantId}

Path Parameters

ParameterDescriptionTypeRequired
productIdProduct IDlongtrue
variantIdVariant IDlongtrue

Response Codes

CodeDescription
200Variant deleted successfully
404Variant not found