Skip to main content
POST
Create Variant
There is no variant endpoint on the OAuth App API (/api/v1/). This is the merchant Admin API route, authenticated with a merchant access token (not an app OAuth access token). To create variants from an app, send them in the variants[] array of Create Product.

Create Variant

There is no OAuth App API route for creating variants individually. Variants are created in one of two ways:
  1. Merchant dashboard APIPOST /variants/bulk-add-variant/{product_id} adds one or more variants to an existing product (described below).
  2. App API product create — pass a nested variants array inside the body of POST /api/v1/products.json (Create Product).
This page documents the merchant bulk-add-variant route. It requires a merchant (or staff) JWT and accepts a multipart/form-data body (so an optional mainImage file can be attached). The variants field is a JSON array of variant objects.

Path Parameters

product_id
string
required
The product ID to add variants to.

Body Parameters

variants
array
required
Array of variant objects. Each object accepts the fields below.
append
boolean
default:"false"
When true, append the supplied variants to the product’s existing set. When false (default), the supplied set replaces the product’s variants.
mainImage
file
Optional variant image (multipart file part).

Variant object fields

name
string
required
Option name (e.g. "Size").
value
string
Option value (e.g. "Medium").
price
number
required
Variant price.
discountPrice
number
Discounted / compare-at price.
stock
number
Stock quantity.
stockStatus
string
Stock status (e.g. in_stock).
skuId
string
Stock keeping unit.
weight
number
Variant weight.
weightUnit
string
Weight unit (e.g. kg).

Request

Response

Responses use the platform response envelope: status, state, message, data.