Sifr Wahid Developers

API reference / Products

Create product

Create a product

POST https://s.zo.sa/api/public/v1/products
Scope products.read_writeIdempotency-Key supported

Request

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 product to create (POST, where name and variants are required) or to change (PATCH: only the keys sent change; name and description merge per language, so name.ar may be left out). Keys not listed here are ignored. On PATCH, options, variants and images each replace the whole set when sent (images when the background copy finishes: when at least one link copies, the pictures become the copies in the order sent; when none copies they stay as they were; an empty list removes them at once): an option or value sent with the same Arabic name as a saved one keeps it, and a variant whose values are all kept keeps its stock and id. Send options with variants when the product has options. Stock is never set here: a quantity key anywhere is refused with 422; use POST /inventory/adjustments. Prices are in halalas. A product without options has exactly one variant, whose price is the product's price. Dropping an option value on PATCH deletes the variants made with it, and their stock. A product with options cannot be turned back into one without options through the API in this version.

  • nameobjectrequired
    2 fields
    • arstringrequired
    • enstringnullable
  • descriptionobjectnullable
    HTML is cleaned to the storefront's safe subset.
    2 fields
    • arstringnullable
      Up to 10000 characters
    • enstringnullable
      Up to 10000 characters
  • typestring
    Types other than physical need the plan feature all_product_types (402 feature_locked without it).
    One of physical, service, food, digital, card, group, booking
  • statusstring
    Default draft. An active product that ships needs weight_grams.
    One of draft, active, hidden
  • slugstringnullable
    Letters of any language, digits and single dashes. Made unique in the store.
    Up to 120 characters
  • category_idsarray of integers
  • brand_idintegernullable
  • weight_gramsintegernullable
    The product's weight; every variant ships at it.
    0 to 1000000
  • track_stockboolean
    Default true. False makes every variant unlimited.
  • imagesarray of objects
    Up to 10 items
    1 field
    • urlstring (uri)required
      Up to 2000 characters
  • optionsarray of objects
    Up to 3 items
    2 fields
    • nameobjectrequired
      2 fields
      • arstringrequired
      • enstringnullable
    • valuesarray of objectsrequired
      1 to 30 items
      2 fields
      • keystringrequired
        Your own label for the value, unique in the body; variants refer to it.
        Up to 40 characters
      • nameobjectrequired
        2 fields
        • arstringrequired
        • enstringnullable
  • variantsarray of objectsrequired
    One per combination of option values (at most 100): each variant's values hold exactly one key of every option, and no two variants hold the same combination (422 on variants.N.values otherwise). A combination left out is created at the product's price; on PATCH a saved one left out keeps its details.
    1 to 100 items
    8 fields
    • valuesarray of strings
      The keys of this variant's option values, one per option. Required when options are sent.
    • skustringnullable
      Unique in the store.
      Up to 64 characters
    • barcodestringnullable
      Up to 64 characters
    • priceintegerrequired
      0 to 99999999
    • sale_priceintegernullable
      Below price.
      At least 0
    • weight_gramsintegernullable
      The product's weight_grams, given per variant: every variant must send the same value.
      At least 0
    • track_stockboolean
      The product's track_stock, given per variant: every variant must send the same value.
    • hiddenboolean
  • sale_starts_atstring (date-time)nullable
    A bare date is that whole day in Riyadh.
  • sale_ends_atstring (date-time)nullable

cURL

curl -sS -X POST "https://s.zo.sa/api/public/v1/products" \
  -H "Authorization: Bearer $ZO_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: erp-item-TSHIRT-BLUE-M" \
  -d '{
  "name": {
    "ar": "Blue T-shirt",
    "en": "Blue T-shirt"
  },
  "status": "active",
  "weight_grams": 250,
  "variants": [
    {
      "sku": "TSHIRT-BLUE-M",
      "price": 2500
    }
  ]
}'

JavaScript

const response = await fetch('https://s.zo.sa/api/public/v1/products', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.ZO_API_KEY}`,
    Accept: 'application/json',
    'Content-Type': 'application/json',
    'Idempotency-Key': 'erp-item-TSHIRT-BLUE-M',
  },
  body: JSON.stringify({
    "name": {
      "ar": "Blue T-shirt",
      "en": "Blue T-shirt"
    },
    "status": "active",
    "weight_grams": 250,
    "variants": [
      {
        "sku": "TSHIRT-BLUE-M",
        "price": 2500
      }
    ]
  }),
});
console.log(response.status, await response.json());

PHP

<?php

$ch = curl_init('https://s.zo.sa/api/public/v1/products');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('ZO_API_KEY'),
        'Accept: application/json',
        'Content-Type: application/json',
        'Idempotency-Key: erp-item-TSHIRT-BLUE-M',
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'name' => [
            'ar' => 'Blue T-shirt',
            'en' => 'Blue T-shirt',
        ],
        'status' => 'active',
        'weight_grams' => 250,
        'variants' => [
            [
                'sku' => 'TSHIRT-BLUE-M',
                'price' => 2500,
            ],
        ],
    ]),
]);
$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.post(
    "https://s.zo.sa/api/public/v1/products",
    headers={
        "Authorization": f"Bearer {os.environ['ZO_API_KEY']}",
        "Accept": "application/json",
        "Idempotency-Key": "erp-item-TSHIRT-BLUE-M",
    },
    json={
        "name": {
            "ar": "Blue T-shirt",
            "en": "Blue T-shirt",
        },
        "status": "active",
        "weight_grams": 250,
        "variants": [
            {
                "sku": "TSHIRT-BLUE-M",
                "price": 2500,
            },
        ],
    },
    timeout=30,
)
print(response.status_code, response.json())

A product without options has one variant: its SKU and its price in halalas (2500 is 25.00 SAR). name.ar holds the Arabic name; the example puts the English name in both because these docs are English only.

Response 201
{
  "data": {
    "id": 501,
    "type": "physical",
    "status": "active",
    "name": {
      "ar": "Blue T-shirt",
      "en": "Blue T-shirt"
    },
    "description": {
      "ar": null,
      "en": null
    },
    "slug": "blue-t-shirt",
    "url": "https://s.zo.sa/my-store/p/blue-t-shirt",
    "images": [],
    "images_pending": [],
    "categories": [],
    "brand": null,
    "variants": [
      {
        "id": 811,
        "sku": "TSHIRT-BLUE-M",
        "barcode": null,
        "price": 2500,
        "sale_price": null,
        "quantity": 0,
        "unlimited": false,
        "hidden": false,
        "weight_grams": 250,
        "options": []
      }
    ],
    "sale_starts_at": null,
    "sale_ends_at": null,
    "created_at": "2026-11-23T08:10:00Z",
    "updated_at": "2026-11-23T08:10:00Z"
  }
}

Example. A new product has no stock yet: move it in with POST /inventory/adjustments.

Responses

201The new product.
Response schema
  • dataobjectrequired
    A product has at least one variant (a product without options has exactly one), and prices live on its variants.
    16 fields
    • idintegerrequired
    • typestringrequired
      One of physical, service, food, digital, card, group, booking
    • statusstringrequired
      One of draft, active, hidden
    • nameobjectrequired
      2 fields
      • arstringrequirednullable
      • enstringrequirednullable
    • descriptionobjectrequired
      2 fields
      • arstringrequirednullable
      • enstringrequirednullable
    • slugstringrequired
    • urlstring (uri)required
      The product page on the storefront.
    • imagesarray of objectsrequired
      4 fields
      • idintegerrequired
      • urlstring (uri)required
      • altstringrequirednullable
        Reserved; null until images carry alt text.
      • sortintegerrequired
    • images_pendingarray of objectsrequired
      Picture links sent in a write that are copied in the background, usually within seconds. A link stays here with status pending until its copy joins images (and product.updated is sent), or with status failed when it could not be copied; failed links stay until the next picture write. Empty when nothing waits.
      3 fields
      • source_urlstring (uri)required
        The link as it was sent.
      • statusstringrequired
        One of pending, failed
      • errorstringrequirednullable
        Why a failed link was not copied; null while pending. too_many_images when the product already had 10 pictures by the time the copy finished; copy_failed when the copy job itself stopped, or ran out of time before this link (a job downloads for 60 seconds at most, 10 per link), so send it again in a new write.
        One of image_unreachable, too_many_images, copy_failed
    • categoriesarray of objectsrequired
      3 fields
      • idintegerrequired
      • nameobjectrequired
        2 fields
        • arstringrequirednullable
        • enstringrequirednullable
      • slugstringrequired
    • brandobjectrequirednullable
      3 fields
      • idintegerrequired
      • nameobjectrequired
        2 fields
        • arstringrequirednullable
        • enstringrequirednullable
      • slugstringrequirednullable
        Reserved; null until brands carry slugs.
    • variantsarray of objectsrequired
      10 fields
      • idintegerrequired
      • skustringrequirednullable
      • barcodestringrequirednullable
      • priceintegerrequired
        Halalas.
      • sale_priceintegerrequirednullable
        Halalas. Applies only between the product's sale_starts_at and sale_ends_at (a null end is open, so both null means always); outside that window the variant sells at price.
      • quantityintegerrequired
        Stock across all branches.
      • unlimitedbooleanrequired
        True when stock is not tracked; quantity is then no limit.
      • hiddenbooleanrequired
        Hidden from shoppers by the merchant; still part of the catalogue.
      • weight_gramsintegerrequirednullable
      • optionsarray of objectsrequired
        2 fields
        • nameobjectrequired
          2 fields
          • arstringrequirednullable
          • enstringrequirednullable
        • valueobjectrequired
          2 fields
          • arstringrequirednullable
          • enstringrequirednullable
    • sale_starts_atstring (date-time)requirednullable
      When the variants' sale_price starts to apply; null means from any time.
    • sale_ends_atstring (date-time)requirednullable
      When the variants' sale_price stops applying; null means no end.
    • 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"}}.

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"}}.