Skip to main content
Every purchasable item in the catalog is represented by a variant. A variant belongs to a product and carries its own SKU, pricing, discount, physical dimensions, and lifecycle status. Use this API to build out your product’s size and color matrix, set prices, manage stock readiness via status flags, and soft-delete discontinued options while retaining order history integrity.
All variant endpoints require an authenticated session with the ADMIN or SUPER_ADMIN role. Call GET /auth/csrf-token before every POST, PATCH, or DELETE request and supply the token in the x-csrf-token header.

Variant Status Reference

A variant’s status field controls its visibility and purchase eligibility on the storefront. The default status when creating a variant is DRAFT. Transition a variant to ACTIVE once it is ready for sale and has an inventory record.

List Variants

Retrieve a paginated list of variants for a given product. Filter by status, include soft-deleted entries, and sort across multiple fields.

Path Parameters

string
required
The parent product’s public ID, prefixed prd_.

Query Parameters

integer
default:"1"
Page number (1-based).
integer
default:"20"
Items per page. Accepted range: 1–100.
string
Filter by variant status. One of ACTIVE, DRAFT, INACTIVE, or ARCHIVED.
string
default:"false"
Pass "true" to include soft-deleted variants. Must be the string "true" or "false".
string
default:"created_at"
Sort field. Prefix with - for descending order. Accepted values: sku, -sku, price, -price, created_at, -created_at, updated_at, -updated_at.

Response

array
Array of variant objects.
object

Create Variant

Add a new variant to a product. sku and price are the only required fields. All other fields are optional and can be set now or updated later via PATCH.

Path Parameters

string
required
The parent product’s public ID, prefixed prd_.

Request Body

string
required
Stock-keeping unit identifier. Must be unique across all variants platform-wide. Between 1 and 80 characters.
string
required
Retail price as a decimal string matching ^\d{1,10}(\.\d{1,2})?$. Example: "99.99". Never use a float.
string
Barcode or UPC. Maximum 255 characters.
string
Color label, e.g. "Black". Maximum 50 characters.
string
Size label, e.g. "42" or "XL". Maximum 50 characters.
string
Cost price as a decimal string. Used for margin calculations; not exposed to customers.
string
Discount applied to price when computing final_price. Decimal string between "0.00" and "100.00".
string
Weight as a decimal string. Unit determined by your store configuration.
string
Length dimension as a decimal string.
string
Width dimension as a decimal string.
string
Height dimension as a decimal string.
string
default:"DRAFT"
Initial lifecycle status. One of ACTIVE, DRAFT, INACTIVE, ARCHIVED. Defaults to DRAFT.

Example

201 Response

SKU values must be unique across all variants in the entire platform, not just within a single product. Attempting to create a variant with a duplicate SKU returns a 409 Conflict. Plan your SKU naming scheme (e.g. BRAND-MODEL-COLOR-SIZE) to avoid collisions.

Error Responses


Get Variant

Fetch a single variant by its public ID within a product.

Path Parameters

string
required
The parent product’s public ID, prefixed prd_.
string
required
The variant’s public ID, prefixed var_.
Returns the full variant object. Responds with 404 if the product or variant does not exist.

Update Variant

Partially update a variant’s fields. Only the fields you supply are changed. Pass null for any nullable optional field — barcode, color, size, cost_price, weight, length, width, height — to explicitly clear it.

Path Parameters

string
required
The parent product’s public ID, prefixed prd_.
string
required
The variant’s public ID, prefixed var_.

Request Body

At least one field is required. All fields from the create request are accepted, plus all nullable fields can be set to null to clear them.

Example


Delete Variant

Soft-delete a variant. The variant is immediately hidden from customer views but is retained in the database so that existing order line items continue to reference the correct SKU and price snapshots. Returns 204 No Content on success.

Path Parameters

string
required
The parent product’s public ID, prefixed prd_.
string
required
The variant’s public ID, prefixed var_.

Example

Error Responses