Skip to main content
POST
/
api
/
products
/
{product_key}
/
variants
/
Create Variant
curl --request POST \
  --url https://api.merchantops.ai/api/products/{product_key}/variants/ \
  --header 'Content-Type: application/json' \
  --data '
{
  "key": "<string>",
  "isPublished": false,
  "properties": {},
  "properties_metadata": {}
}
'
{
  "id": "<string>",
  "key": "<string>",
  "productType": {},
  "product_key": "<string>",
  "createdAt": "<string>",
  "createdBy": "<string>",
  "isPublished": false,
  "lastModifiedAt": "<string>",
  "lastModifiedBy": "<string>",
  "properties": {},
  "properties_metadata": {},
  "propertyCount": 0
}

Headers

authorization
string | null
X-Organization-ID
string | null

Path Parameters

product_key
string
required

Cookies

stytch_session
string | null

Body

application/json

Request model for creating a Variant.

key
string
required

Variant key (lowercase alphanumeric + underscores)

isPublished
boolean
default:false
properties
Properties · object

Variant properties dict

properties_metadata
Properties Metadata · object

Response

Successful Response

Response model for a single Variant.

id
string
required

MongoDB ObjectId as string

key
string
required

Variant key, unique within a product

productType
Producttype · object
required

Product type reference

product_key
string
required

Key of the parent Product

createdAt
string | null

Creation timestamp

createdBy
string | null

User who created this

isPublished
boolean
default:false

Published status

lastModifiedAt
string | null

Last modification timestamp

lastModifiedBy
string | null

User who last modified this

properties
Properties · object

Variant data keyed by PropertyDefinition key

properties_metadata
Properties Metadata · object

Per-property metadata

propertyCount
integer
default:0

Number of properties with values