API y desarrolladores

Create variant

post/v1/products/{product_id}/variants

Add a new variant to an existing product.

Ejemplo

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":"…"}'

Parámetros

product_idintegerpathrequerido

Product identifier

Cuerpo de la petición

namestringrequerido

Variant display name

skustring | null

Product variant SKU code

base_pricenumber | stringrequerido

Original price before discounts

currencySupportedCurrencyrequerido

Currency code (ISO 4217)

statusVariantStatuspor defecto: "available"

Variant availability status

option_valuesinteger[]requerido

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.

Respuestas

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
¿Necesitas ayuda?