Sifr Wahid Developers

API reference / Customers

Create customer

Add a customer

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

The mobile is normalised as the storefront does; a customer with that mobile already in the store is answered 409.

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

  • namestringrequired
    Up to 100 characters
  • mobilestringrequired
    Any common form (0501234567, 966501234567, +966501234567); stored as E.164, as the storefront stores it.
    Up to 20 characters
  • emailstring (email)nullable
    Up to 190 characters
  • notestringnullable
    The merchant's own note on the customer. Kept inside the store; never shown back by the API.
    Up to 1000 characters

cURL

curl -sS -X POST "https://s.zo.sa/api/public/v1/customers" \
  -H "Authorization: Bearer $ZO_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: erp-customer-C2187" \
  -d '{
  "name": "Sara Ahmed",
  "mobile": "0501234567",
  "email": "sara@example.com"
}'

JavaScript

const response = await fetch('https://s.zo.sa/api/public/v1/customers', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.ZO_API_KEY}`,
    Accept: 'application/json',
    'Content-Type': 'application/json',
    'Idempotency-Key': 'erp-customer-C2187',
  },
  body: JSON.stringify({
    "name": "Sara Ahmed",
    "mobile": "0501234567",
    "email": "sara@example.com"
  }),
});
console.log(response.status, await response.json());

PHP

<?php

$ch = curl_init('https://s.zo.sa/api/public/v1/customers');
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-customer-C2187',
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'name' => 'Sara Ahmed',
        'mobile' => '0501234567',
        'email' => 'sara@example.com',
    ]),
]);
$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/customers",
    headers={
        "Authorization": f"Bearer {os.environ['ZO_API_KEY']}",
        "Accept": "application/json",
        "Idempotency-Key": "erp-customer-C2187",
    },
    json={
        "name": "Sara Ahmed",
        "mobile": "0501234567",
        "email": "sara@example.com",
    },
    timeout=30,
)
print(response.status_code, response.json())

A Saudi mobile in any common form; it is stored as +966501234567.

Response 201
{
  "data": {
    "id": 2187,
    "name": "Sara Ahmed",
    "mobile": "+966501234567",
    "email": "sara@example.com",
    "orders_count": 0,
    "created_at": "2026-10-02T14:20:11Z",
    "updated_at": "2026-10-02T14:20:11Z"
  }
}

Example.

Responses

201The new customer.
Response schema
  • dataobjectrequired
    7 fields
    • idintegerrequired
    • namestringrequired
    • mobilestringrequirednullable
      E.164 for Saudi numbers.
    • emailstringrequirednullable
    • orders_countintegerrequired
      The customer's orders in this store (deleted orders not counted).
    • 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"}}.

409customer_exists (the store already has a customer with this mobile; customer_id names it), or duplicate_request (the same Idempotency-Key is still running).

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