PATCH https://example.com/api/v1/products/{id}

Update Product

Full product update. Required fields (name, category, brand) must be present — missing values are filled from the existing product when omitted in some cases, but best practice is to GET /products/{id} first, merge changes, then PATCH.

For price / stock / active only, use Update Stock And Price (PATCH /products/{id}/quick) instead.

URL Parameters

ParameterTypeDescription
idintegerProduct ID

Body Parameters

Same fields as Add Product (including translations and variations).

PHP
<?php

$baseUrl = 'https://example.com/api/v1';
$apiKey  = 'YOUR_API_KEY';
$productId = 6;

function apiRequest(string $method, string $url, string $apiKey, ?array $data = null): array
{
    $ch = curl_init();
    $headers = [
        'X-API-Key: ' . trim($apiKey),
        'Accept: application/json',
    ];
    if ($data !== null) {
        $headers[] = 'Content-Type: application/json';
    }
    curl_setopt_array($ch, [
        CURLOPT_URL => $url,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_CUSTOMREQUEST => $method,
        CURLOPT_HTTPHEADER => $headers,
        CURLOPT_SSL_VERIFYPEER => true,
    ]);
    if ($data !== null) {
        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data, JSON_UNESCAPED_UNICODE));
    }
    $response = curl_exec($ch);
    $httpCode = (int) curl_getinfo($ch, CURLINFO_HTTP_CODE);
    $error = curl_error($ch);
    curl_close($ch);
    $decoded = json_decode((string) $response, true);
    return [
        'http_code' => $httpCode,
        'curl_error' => $error,
        'response' => is_array($decoded) ? $decoded : $response,
    ];
}

$payload = [
    'name' => 'Test Name',
    'category' => 'Category Name',
    'brand' => 'Test',
    'cost' => 100,
    'price' => 299.51,
    'stock' => 1,
    'active' => 1,
    'barcode' => 'AS85551212',
    'stock_code' => 'fs123',
    'description_html' => '<p>Test</p><p>Test 2</p>',
];

$result = apiRequest('PATCH', $baseUrl . '/products/' . (int) $productId, $apiKey, $payload);
print_r($result);
cURL
curl -s -X PATCH \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "name": "Test Name",
    "category": "Category Name",
    "brand": "Test",
    "cost": 100,
    "price": 299.51,
    "stock": 1,
    "active": 1,
    "barcode": "AS85551212",
    "stock_code": "fs123",
    "description_html": "<p>Test</p><p>Test 2</p>"
  }' \
  "https://example.com/api/v1/products/6"
Sample Response (JSON)
{
  "success": true,
  "message": "Ürün güncellendi",
  "data": {
    "id": 6,
    "name": "Test Name",
    "slug": "test-name",
    "price": 299.51,
    "stock": 1,
    "active": 1,
    "barcode": "AS85551212",
    "stock_code": "fs123",
    "category_name": "Category Name",
    "brand_name": "Test",
    "description_html": "<p>Test</p><p>Test 2</p>"
  }
}