Update customer
Change a customer (only the keys sent)
https://s.zo.sa/api/public/v1 /customers/{id} customers.read_writeIdempotency-Key supportedRequest
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | integer | required | At least 1 |
Headers
| Name | Type | Required | Description |
|---|---|---|---|
Idempotency-Key | string | 1 to 120 visible ASCII characters. A write sent again with the same key runs once; the retry gets the first answer back with the header Idempotent-Replayed: true. Use a new key for each new write. 1 to 120 characters |
Request body
Only the keys sent change. The mobile is the customer's identity in the store and cannot be changed here: a body with mobile is refused (422, fields.mobile). Blocking is done from the dashboard: a body with is_blocked is refused (422).
namestringemailstring (email)nullablenotestringnullable
cURL
curl -sS -X PATCH "https://s.zo.sa/api/public/v1/customers/2187" \
-H "Authorization: Bearer $ZO_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: erp-customer-C2187-note" \
-d '{
"note": "Prefers evening delivery"
}'JavaScript
const response = await fetch('https://s.zo.sa/api/public/v1/customers/2187', {
method: 'PATCH',
headers: {
Authorization: `Bearer ${process.env.ZO_API_KEY}`,
Accept: 'application/json',
'Content-Type': 'application/json',
'Idempotency-Key': 'erp-customer-C2187-note',
},
body: JSON.stringify({
"note": "Prefers evening delivery"
}),
});
console.log(response.status, await response.json());PHP
<?php
$ch = curl_init('https://s.zo.sa/api/public/v1/customers/2187');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('ZO_API_KEY'),
'Accept: application/json',
'Content-Type: application/json',
'Idempotency-Key: erp-customer-C2187-note',
],
CURLOPT_POSTFIELDS => json_encode([
'note' => 'Prefers evening delivery',
]),
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
echo $status, PHP_EOL, $body, PHP_EOL;Python
import os
import requests
response = requests.patch(
"https://s.zo.sa/api/public/v1/customers/2187",
headers={
"Authorization": f"Bearer {os.environ['ZO_API_KEY']}",
"Accept": "application/json",
"Idempotency-Key": "erp-customer-C2187-note",
},
json={
"note": "Prefers evening delivery",
},
timeout=30,
)
print(response.status_code, response.json())The merchant's own note on the customer: it stays inside the store and is never shown back by the API.
{
"data": {
"id": 1,
"name": "string",
"mobile": null,
"email": null,
"orders_count": 1,
"created_at": "2026-11-23T06:01:53Z",
"updated_at": "2026-11-23T06:01:53Z"
}
}Example generated from the schema.
Responses
Response schema
dataobjectrequired7 fields
idintegerrequirednamestringrequiredmobilestringrequirednullableE.164 for Saudi numbers.emailstringrequirednullableorders_countintegerrequiredThe customer's orders in this store (deleted orders not counted).created_atstring (date-time)requiredupdated_atstring (date-time)required
An error object: {"error": {"code", "message", "fields"}}.
An error object: {"error": {"code", "message", "fields"}}.
An error object: {"error": {"code", "message", "fields"}}.
An error object: {"error": {"code", "message", "fields"}}.
An error object: {"error": {"code", "message", "fields"}}.
An error object: {"error": {"code", "message", "fields"}}.
An error object: {"error": {"code", "message", "fields"}}.