curl --request PATCH \
--url https://api.example.com/v1/products/bulk \
--header 'Content-Type: application/json' \
--data '
{
"items": [
{
"current_price": 0,
"item_id": "price"
},
{
"item_id": "supplier",
"supplier": "New supplier"
},
{
"custom_fields": {
"featured": false
},
"item_id": "custom"
},
{
"item_id": "clear"
},
{
"current_price": 5,
"item_id": "missing"
},
{
"item_id": "invalid"
},
{
"current_price": 10,
"item_id": "duplicate"
},
{
"item_id": "duplicate",
"supplier": "Other supplier"
}
]
}
'import requests
url = "https://api.example.com/v1/products/bulk"
payload = { "items": [
{
"current_price": 0,
"item_id": "price"
},
{
"item_id": "supplier",
"supplier": "New supplier"
},
{
"custom_fields": { "featured": False },
"item_id": "custom"
},
{ "item_id": "clear" },
{
"current_price": 5,
"item_id": "missing"
},
{ "item_id": "invalid" },
{
"current_price": 10,
"item_id": "duplicate"
},
{
"item_id": "duplicate",
"supplier": "Other supplier"
}
] }
headers = {"Content-Type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
items: [
{current_price: 0, item_id: 'price'},
{item_id: 'supplier', supplier: 'New supplier'},
{custom_fields: {featured: false}, item_id: 'custom'},
{item_id: 'clear'},
{current_price: 5, item_id: 'missing'},
{item_id: 'invalid'},
{current_price: 10, item_id: 'duplicate'},
{item_id: 'duplicate', supplier: 'Other supplier'}
]
})
};
fetch('https://api.example.com/v1/products/bulk', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/products/bulk",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'items' => [
[
'current_price' => 0,
'item_id' => 'price'
],
[
'item_id' => 'supplier',
'supplier' => 'New supplier'
],
[
'custom_fields' => [
'featured' => false
],
'item_id' => 'custom'
],
[
'item_id' => 'clear'
],
[
'current_price' => 5,
'item_id' => 'missing'
],
[
'item_id' => 'invalid'
],
[
'current_price' => 10,
'item_id' => 'duplicate'
],
[
'item_id' => 'duplicate',
'supplier' => 'Other supplier'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/products/bulk"
payload := strings.NewReader("{\n \"items\": [\n {\n \"current_price\": 0,\n \"item_id\": \"price\"\n },\n {\n \"item_id\": \"supplier\",\n \"supplier\": \"New supplier\"\n },\n {\n \"custom_fields\": {\n \"featured\": false\n },\n \"item_id\": \"custom\"\n },\n {\n \"item_id\": \"clear\"\n },\n {\n \"current_price\": 5,\n \"item_id\": \"missing\"\n },\n {\n \"item_id\": \"invalid\"\n },\n {\n \"current_price\": 10,\n \"item_id\": \"duplicate\"\n },\n {\n \"item_id\": \"duplicate\",\n \"supplier\": \"Other supplier\"\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.example.com/v1/products/bulk")
.header("Content-Type", "application/json")
.body("{\n \"items\": [\n {\n \"current_price\": 0,\n \"item_id\": \"price\"\n },\n {\n \"item_id\": \"supplier\",\n \"supplier\": \"New supplier\"\n },\n {\n \"custom_fields\": {\n \"featured\": false\n },\n \"item_id\": \"custom\"\n },\n {\n \"item_id\": \"clear\"\n },\n {\n \"current_price\": 5,\n \"item_id\": \"missing\"\n },\n {\n \"item_id\": \"invalid\"\n },\n {\n \"current_price\": 10,\n \"item_id\": \"duplicate\"\n },\n {\n \"item_id\": \"duplicate\",\n \"supplier\": \"Other supplier\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/products/bulk")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"items\": [\n {\n \"current_price\": 0,\n \"item_id\": \"price\"\n },\n {\n \"item_id\": \"supplier\",\n \"supplier\": \"New supplier\"\n },\n {\n \"custom_fields\": {\n \"featured\": false\n },\n \"item_id\": \"custom\"\n },\n {\n \"item_id\": \"clear\"\n },\n {\n \"current_price\": 5,\n \"item_id\": \"missing\"\n },\n {\n \"item_id\": \"invalid\"\n },\n {\n \"current_price\": 10,\n \"item_id\": \"duplicate\"\n },\n {\n \"item_id\": \"duplicate\",\n \"supplier\": \"Other supplier\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"id": "00000000-0000-4000-8000-000000000001",
"index": 0,
"ok": true
},
{
"id": "00000000-0000-4000-8000-000000000002",
"index": 1,
"ok": true
},
{
"id": "00000000-0000-4000-8000-000000000003",
"index": 2,
"ok": true
},
{
"id": "00000000-0000-4000-8000-000000000004",
"index": 3,
"ok": true
},
{
"code": "not_found",
"index": 4,
"message": "Product not found",
"ok": false
},
{
"code": "validation_error",
"index": 5,
"message": "sku cannot be null or blank",
"ok": false
},
{
"code": "conflict",
"index": 6,
"message": "Duplicate item_id in this batch",
"ok": false
},
{
"code": "conflict",
"index": 7,
"message": "Duplicate item_id in this batch",
"ok": false
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Bulk Patch Products
Update existing products by item_id with independent partial changes.
Omitted fields stay unchanged; zero/false are preserved. Null clears nullable fields, but sku/sku_name cannot be null or blank. Custom fields merge by normalized key; a null value clears that key, custom_fields=null clears all values, and is a no-op. Every occurrence of a duplicate trimmed item_id fails with conflict. HTTP 200 contains ordered indexed success/not_found/validation_error/conflict results. At most 10,000 items, 25 MiB actual body bytes, and 1 MiB encoded provider request per item. Writes commit in sequential chunks of at most 500 items; the request is not atomic. Retry corrected failed entries. After timeout or unknown completion, absolute changes can be replayed safely (updated_at may advance); reread if intervening writers matter. Honor Retry-After for 429/503. Missing products are never created and item_id cannot be renamed. Existing POST bulk and single-product PATCH contracts are unchanged.
curl --request PATCH \
--url https://api.example.com/v1/products/bulk \
--header 'Content-Type: application/json' \
--data '
{
"items": [
{
"current_price": 0,
"item_id": "price"
},
{
"item_id": "supplier",
"supplier": "New supplier"
},
{
"custom_fields": {
"featured": false
},
"item_id": "custom"
},
{
"item_id": "clear"
},
{
"current_price": 5,
"item_id": "missing"
},
{
"item_id": "invalid"
},
{
"current_price": 10,
"item_id": "duplicate"
},
{
"item_id": "duplicate",
"supplier": "Other supplier"
}
]
}
'import requests
url = "https://api.example.com/v1/products/bulk"
payload = { "items": [
{
"current_price": 0,
"item_id": "price"
},
{
"item_id": "supplier",
"supplier": "New supplier"
},
{
"custom_fields": { "featured": False },
"item_id": "custom"
},
{ "item_id": "clear" },
{
"current_price": 5,
"item_id": "missing"
},
{ "item_id": "invalid" },
{
"current_price": 10,
"item_id": "duplicate"
},
{
"item_id": "duplicate",
"supplier": "Other supplier"
}
] }
headers = {"Content-Type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
items: [
{current_price: 0, item_id: 'price'},
{item_id: 'supplier', supplier: 'New supplier'},
{custom_fields: {featured: false}, item_id: 'custom'},
{item_id: 'clear'},
{current_price: 5, item_id: 'missing'},
{item_id: 'invalid'},
{current_price: 10, item_id: 'duplicate'},
{item_id: 'duplicate', supplier: 'Other supplier'}
]
})
};
fetch('https://api.example.com/v1/products/bulk', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/products/bulk",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'items' => [
[
'current_price' => 0,
'item_id' => 'price'
],
[
'item_id' => 'supplier',
'supplier' => 'New supplier'
],
[
'custom_fields' => [
'featured' => false
],
'item_id' => 'custom'
],
[
'item_id' => 'clear'
],
[
'current_price' => 5,
'item_id' => 'missing'
],
[
'item_id' => 'invalid'
],
[
'current_price' => 10,
'item_id' => 'duplicate'
],
[
'item_id' => 'duplicate',
'supplier' => 'Other supplier'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/products/bulk"
payload := strings.NewReader("{\n \"items\": [\n {\n \"current_price\": 0,\n \"item_id\": \"price\"\n },\n {\n \"item_id\": \"supplier\",\n \"supplier\": \"New supplier\"\n },\n {\n \"custom_fields\": {\n \"featured\": false\n },\n \"item_id\": \"custom\"\n },\n {\n \"item_id\": \"clear\"\n },\n {\n \"current_price\": 5,\n \"item_id\": \"missing\"\n },\n {\n \"item_id\": \"invalid\"\n },\n {\n \"current_price\": 10,\n \"item_id\": \"duplicate\"\n },\n {\n \"item_id\": \"duplicate\",\n \"supplier\": \"Other supplier\"\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.example.com/v1/products/bulk")
.header("Content-Type", "application/json")
.body("{\n \"items\": [\n {\n \"current_price\": 0,\n \"item_id\": \"price\"\n },\n {\n \"item_id\": \"supplier\",\n \"supplier\": \"New supplier\"\n },\n {\n \"custom_fields\": {\n \"featured\": false\n },\n \"item_id\": \"custom\"\n },\n {\n \"item_id\": \"clear\"\n },\n {\n \"current_price\": 5,\n \"item_id\": \"missing\"\n },\n {\n \"item_id\": \"invalid\"\n },\n {\n \"current_price\": 10,\n \"item_id\": \"duplicate\"\n },\n {\n \"item_id\": \"duplicate\",\n \"supplier\": \"Other supplier\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/products/bulk")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"items\": [\n {\n \"current_price\": 0,\n \"item_id\": \"price\"\n },\n {\n \"item_id\": \"supplier\",\n \"supplier\": \"New supplier\"\n },\n {\n \"custom_fields\": {\n \"featured\": false\n },\n \"item_id\": \"custom\"\n },\n {\n \"item_id\": \"clear\"\n },\n {\n \"current_price\": 5,\n \"item_id\": \"missing\"\n },\n {\n \"item_id\": \"invalid\"\n },\n {\n \"current_price\": 10,\n \"item_id\": \"duplicate\"\n },\n {\n \"item_id\": \"duplicate\",\n \"supplier\": \"Other supplier\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"id": "00000000-0000-4000-8000-000000000001",
"index": 0,
"ok": true
},
{
"id": "00000000-0000-4000-8000-000000000002",
"index": 1,
"ok": true
},
{
"id": "00000000-0000-4000-8000-000000000003",
"index": 2,
"ok": true
},
{
"id": "00000000-0000-4000-8000-000000000004",
"index": 3,
"ok": true
},
{
"code": "not_found",
"index": 4,
"message": "Product not found",
"ok": false
},
{
"code": "validation_error",
"index": 5,
"message": "sku cannot be null or blank",
"ok": false
},
{
"code": "conflict",
"index": 6,
"message": "Duplicate item_id in this batch",
"ok": false
},
{
"code": "conflict",
"index": 7,
"message": "Duplicate item_id in this batch",
"ok": false
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}
