Sifr Wahid Developers

API reference / Categories

Update category

Change a category (only the keys sent)

PATCH https://s.zo.sa/api/public/v1/categories/{id}
Scope products.read_writeIdempotency-Key supported

Request

Path parameters

NameTypeRequiredDescription
idintegerrequiredAt least 1

Headers

NameTypeRequiredDescription
Idempotency-Keystring1 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

application/json required

A category to create (POST, name required) or change (PATCH, only the keys sent change; name merges per language).

  • nameobject
    2 fields
    • arstringrequired
    • enstringnullable
  • slugstringnullable
    Made unique in the store; from the name when left out.
    Up to 120 characters
  • parent_idintegernullable
    Null for a top-level category. Categories nest at most 3 levels.
  • sortinteger
    Position among its siblings; after the last when left out.
    At least 0
  • 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.

Response 200
{
  "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
  • dataobjectrequired
    9 fields
    • idintegerrequired
    • nameobjectrequired
      2 fields
      • arstringrequirednullable
      • enstringrequirednullable
    • slugstringrequired
    • parent_idintegerrequirednullable
    • sortintegerrequired
    • is_activebooleanrequired
      False when the merchant hid the category from the storefront.
    • products_countintegerrequired
      Products in this category itself (not its subcategories).
    • created_atstring (date-time)required
    • updated_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"}}.