API and developers

Create variant

post/v1/products/{product_id}/variants

Add a new variant to an existing product.

Example

curl -X POST "https://api.ya.onl/v1/products/{product_id}/variants" \
  -H "X-API-Key: yv_live_v1_…" \
  -H "Content-Type: application/json" \
  -d '{"name":"…","base_price":"…","currency":"…","option_values":"…"}'

Parameters

product_idintegerpathrequired

Product identifier

Request body

namestringrequired

Variant display name

skustring | null

Product variant SKU code

base_pricenumber | stringrequired

Original price before discounts

currencySupportedCurrencyrequired

Currency code (ISO 4217)

statusVariantStatusdefault: "available"

Variant availability status

option_valuesinteger[]required

List of option value IDs to associate with this variant. These IDs are returned when creating options via POST /products/{product_id}/options. At least one option value is required.

Responses

201
Successful Response
401
Invalid or missing API key
403
API key lacks the products:write scope
404
Product not found
422
Validation Error
429
Rate limit exceeded
Need help?