Variations & Translations
When creating or updating a product you can send multi-language
translations and a variations array for SKUs
(size, color, and similar options).
Translations
Pass an object keyed by language code (tr, en, …).
Typical fields per language: name, slug,
description_html, short_description.
If you omit translations, a top-level name (and related fields) is enough for a single language.
Variations
Each variation row commonly includes:
| Field | Type | Description |
|---|---|---|
sku | string | Variant stock code |
barcode | string | Variant barcode |
options | object | e.g. {"Color":"Red","Size":"M"} |
price | float | Variant sale price |
stock | integer | Variant stock quantity |
active | bool / int | Whether the variant is sellable |
Parent vs variation stock:
If the product has variations, sellable stock is usually tracked per variation.
The parent
stock may still be sent for simple products without variants.
Prefer updating variant rows when has_variations is true.
Example request body
{
"translations": {
"tr": {
"name": "Pamuklu Tişört",
"slug": "pamuklu-tisort",
"description_html": "<p>Yumuşak kumaş</p>",
"short_description": "Günlük kullanım"
},
"en": {
"name": "Cotton T-Shirt",
"slug": "cotton-t-shirt",
"description_html": "<p>Soft fabric</p>",
"short_description": "Everyday wear"
}
},
"category": "Test Category",
"brand": "Test Brand",
"price": 199.99,
"stock": 15,
"active": 1,
"variations": [
{
"sku": "TSH-RED-M",
"barcode": "8690000001001",
"options": { "Color": "Red", "Size": "M" },
"price": 249.90,
"stock": 12,
"active": true
}
]
}
Best practice for updates:
Full product
PATCH expects required fields (name, category, brand).
There is no true partial update on the full product endpoint —
GET /products/{id}, merge your changes, then
PATCH the full body.
For price/stock only, prefer
Update Stock And Price
(PATCH /products/{id}/quick).
Related pages
PHP
<?php
$baseUrl = 'https://example.com/api/v1';
$apiKey = 'YOUR_API_KEY';
$payload = [
'translations' => [
'tr' => [
'name' => 'Pamuklu Tişört',
'slug' => 'pamuklu-tisort',
'description_html' => '<p>Yumuşak kumaş</p>',
'short_description' => 'Günlük kullanım',
],
'en' => [
'name' => 'Cotton T-Shirt',
'slug' => 'cotton-t-shirt',
'description_html' => '<p>Soft fabric</p>',
'short_description' => 'Everyday wear',
],
],
'category' => 'Test Category',
'brand' => 'Test Brand',
'cost' => 50,
'price' => 199.99,
'stock' => 15,
'active' => 1,
'barcode' => '86991233322',
'stock_code' => 'fs123',
'variations' => [
[
'sku' => 'TSH-RED-M',
'barcode' => '8690000001001',
'options' => [
'Color' => 'Red',
'Size' => 'M',
],
'price' => 249.90,
'stock' => 12,
'active' => true,
],
[
'sku' => 'TSH-RED-L',
'barcode' => '8690000001002',
'options' => [
'Color' => 'Red',
'Size' => 'L',
],
'price' => 249.90,
'stock' => 8,
'active' => true,
],
],
];
$ch = curl_init($baseUrl . '/products');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'X-API-Key: ' . trim($apiKey),
'Content-Type: application/json',
'Accept: application/json',
],
CURLOPT_POSTFIELDS => json_encode($payload, JSON_UNESCAPED_UNICODE),
CURLOPT_SSL_VERIFYPEER => true,
]);
$response = curl_exec($ch);
$httpCode = (int) curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $httpCode . PHP_EOL;
echo $response;
cURL
curl -s -X POST \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"translations": {
"tr": {
"name": "Pamuklu Tişört",
"slug": "pamuklu-tisort",
"description_html": "<p>Yumuşak kumaş</p>",
"short_description": "Günlük kullanım"
},
"en": {
"name": "Cotton T-Shirt",
"slug": "cotton-t-shirt",
"description_html": "<p>Soft fabric</p>",
"short_description": "Everyday wear"
}
},
"category": "Test Category",
"brand": "Test Brand",
"cost": 50,
"price": 199.99,
"stock": 15,
"active": 1,
"barcode": "86991233322",
"stock_code": "fs123",
"variations": [
{
"sku": "TSH-RED-M",
"barcode": "8690000001001",
"options": { "Color": "Red", "Size": "M" },
"price": 249.90,
"stock": 12,
"active": true
},
{
"sku": "TSH-RED-L",
"barcode": "8690000001002",
"options": { "Color": "Red", "Size": "L" },
"price": 249.90,
"stock": 8,
"active": true
}
]
}' \
"https://example.com/api/v1/products"
Sample Response (JSON)
{
"success": true,
"message": "Ürün eklendi",
"lang": "tr",
"data": {
"id": 6,
"name": "Pamuklu Tişört",
"slug": "pamuklu-tisort",
"price": 199.99,
"stock": 15,
"active": 1,
"barcode": "86991233322",
"stock_code": "fs123",
"category_name": "Test Category",
"brand_name": "Test Brand",
"has_variations": true
}
}