Update category
Change a category (only the keys sent)
PATCH
https://s.zo.sa/api/public/v1 /categories/{id} Scope
products.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
A category to create (POST, name required) or change (PATCH, only the keys sent change; name merges per language).
nameobject2 fields
arstringrequiredenstringnullable
slugstringnullableMade unique in the store; from the name when left out.parent_idintegernullableNull for a top-level category. Categories nest at most 3 levels.sortintegerPosition among its siblings; after the last when left out.is_activeboolean
cURL
curl -sS -X PATCH "https://s.zo.sa/api/public/v1/categories/12" \
-H "Authorization: Bearer $ZO_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: erp-category-12-sort" \
-d '{
"sort": 2
}'JavaScript
const response = await fetch('https://s.zo.sa/api/public/v1/categories/12', {
method: 'PATCH',
headers: {
Authorization: `Bearer ${process.env.ZO_API_KEY}`,
Accept: 'application/json',
'Content-Type': 'application/json',
'Idempotency-Key': 'erp-category-12-sort',
},
body: JSON.stringify({
"sort": 2
}),
});
console.log(response.status, await response.json());PHP
<?php
$ch = curl_init('https://s.zo.sa/api/public/v1/categories/12');
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-category-12-sort',
],
CURLOPT_POSTFIELDS => json_encode([
'sort' => 2,
]),
]);
$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/categories/12",
headers={
"Authorization": f"Bearer {os.environ['ZO_API_KEY']}",
"Accept": "application/json",
"Idempotency-Key": "erp-category-12-sort",
},
json={
"sort": 2,
},
timeout=30,
)
print(response.status_code, response.json())Moves the category among its siblings; nothing else changes.
{
"data": {
"id": 1,
"name": {
"ar": null,
"en": null
},
"slug": "string",
"parent_id": null,
"sort": 1,
"is_active": true,
"products_count": 1,
"created_at": "2026-11-23T06:01:53Z",
"updated_at": "2026-11-23T06:01:53Z"
}
}Example generated from the schema.
Responses
200The category as saved.
Response schema
dataobjectrequired9 fields
idintegerrequirednameobjectrequired2 fields
arstringrequirednullableenstringrequirednullable
slugstringrequiredparent_idintegerrequirednullablesortintegerrequiredis_activebooleanrequiredFalse when the merchant hid the category from the storefront.products_countintegerrequiredProducts in this category itself (not its subcategories).created_atstring (date-time)requiredupdated_atstring (date-time)required
401Missing, unknown, revoked or expired key.
An error object: {"error": {"code", "message", "fields"}}.
402The store's plan does not include this feature (error code feature_locked, with the feature and the plan that has it). Every operation answers it with feature public_api when the key's store is not on the Pro plan.
An error object: {"error": {"code", "message", "fields"}}.
403The key lacks the scope (code insufficient_scope, naming it in scope), the caller's address is not allowed (ip_not_allowed), or the store is suspended (store_suspended: reads stay allowed, every write answers this).
An error object: {"error": {"code", "message", "fields"}}.
404No such row in this store (code not_found).
An error object: {"error": {"code", "message", "fields"}}.
409A write with the same Idempotency-Key is still running (code duplicate_request); retry shortly.
An error object: {"error": {"code", "message", "fields"}}.
422The body is invalid (code validation_failed). fields names each invalid input by its path in the body, such as variants.0.sku or images.1.url.
An error object: {"error": {"code", "message", "fields"}}.
429Too many requests (code rate_limited); see Retry-After.
An error object: {"error": {"code", "message", "fields"}}.