Sifr Wahid Developers

API reference / Webhooks

Create webhook

Add a webhook (the secret is shown once)

POST https://s.zo.sa/api/public/v1/webhooks
Scope webhooks.read_write

Not idempotent: an Idempotency-Key is ignored, because a stored answer would keep the secret. A retry after a lost answer makes a second webhook; list GET /webhooks and delete the extra one.

Request

Request body

application/json required

A webhook to create (POST: name, event and url required) or change (PATCH: only the keys sent change). The same rules as the dashboard form. Subscribing to an event needs the read scope of its resource (GET /webhooks/events names it); without it the answer is 403 insufficient_scope.

  • namestringrequired
    Up to 120 characters
  • eventstringrequired
    One of GET /webhooks/events.
  • urlstringrequired
    https only, a public address (never the server, a LAN or a metadata range).
    Up to 2000 characters
  • rulestringnullable
    Up to 500 characters
  • headersarray of objectsnullable
    Custom headers sent with every delivery. Host, Authorization, Content-Type, User-Agent and X-Zo-* are refused.
    Up to 10 items
    2 fields
    • keystringrequired
      Up to 64 characters Pattern ^[A-Za-z0-9-]+$
    • valuestringrequired
      Masked (••••••) on every read; shown only in the answer to the POST or PATCH that sent it. Sending the mask back in a PATCH keeps the stored value.
      Up to 500 characters
  • security_strategystring
    One of signature, token, none Default signature
  • secretstringnullable
    Generated when left out and the strategy is signature or token.
    16 to 200 characters
  • signature_versioninteger
    One of 1, 2 Default 1
  • is_activeboolean
    Switching a webhook back on clears its failure count.

cURL

curl -sS -X POST "https://s.zo.sa/api/public/v1/webhooks" \
  -H "Authorization: Bearer $ZO_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "ERP orders",
  "event": "order.created",
  "url": "https://erp.example.com/zo/hooks",
  "security_strategy": "signature",
  "signature_version": 2
}'

JavaScript

const response = await fetch('https://s.zo.sa/api/public/v1/webhooks', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.ZO_API_KEY}`,
    Accept: 'application/json',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "name": "ERP orders",
    "event": "order.created",
    "url": "https://erp.example.com/zo/hooks",
    "security_strategy": "signature",
    "signature_version": 2
  }),
});
console.log(response.status, await response.json());

PHP

<?php

$ch = curl_init('https://s.zo.sa/api/public/v1/webhooks');
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',
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'name' => 'ERP orders',
        'event' => 'order.created',
        'url' => 'https://erp.example.com/zo/hooks',
        'security_strategy' => 'signature',
        'signature_version' => 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.post(
    "https://s.zo.sa/api/public/v1/webhooks",
    headers={
        "Authorization": f"Bearer {os.environ['ZO_API_KEY']}",
        "Accept": "application/json",
    },
    json={
        "name": "ERP orders",
        "event": "order.created",
        "url": "https://erp.example.com/zo/hooks",
        "security_strategy": "signature",
        "signature_version": 2,
    },
    timeout=30,
)
print(response.status_code, response.json())

The body the integrator guide uses: signature version 2, recommended.

Response 201
{
  "data": {
    "id": 7,
    "name": "ERP orders",
    "event": "order.created",
    "url": "https://erp.example.com/zo/hooks",
    "rule": null,
    "headers": [],
    "security_strategy": "signature",
    "signature_version": 2,
    "is_active": true,
    "disabled_reason": null,
    "failures": 0,
    "last_status": null,
    "last_delivered_at": null,
    "created_at": "2026-11-22T10:00:00Z",
    "updated_at": "2026-11-22T10:00:00Z",
    "secret": "kq9X2mVb7LcT4wRz8NfP1sJd6HgY3eUa5QoK0iMn"
  }
}

Example. secret is shown only in this answer: keep it now. An example value; a real one is 40 random characters.

Responses

201The new webhook with its secret. Keep the secret; it is not shown again.
Response schema
  • dataobjectrequired
    A webhook this key created. The secret is never shown here; it comes back once, on create and on rotate.
    16 fields
    • idintegerrequired
    • namestringrequired
    • eventstringrequired
    • urlstring (uri)required
    • rulestringrequirednullable
      A rule on the payload attributes, such as total > 100 AND payment_method = `cod`.
    • headersarray of objectsrequired
      2 fields
      • keystringrequired
        Up to 64 characters Pattern ^[A-Za-z0-9-]+$
      • valuestringrequired
        Masked (••••••) on every read; shown only in the answer to the POST or PATCH that sent it. Sending the mask back in a PATCH keeps the stored value.
        Up to 500 characters
    • security_strategystringrequired
      One of signature, token, none
    • signature_versionintegerrequired
      1 signs the raw body; 2 signs "{X-Zo-Timestamp}.{raw body}" and sends X-Zo-Timestamp.
      One of 1, 2
    • is_activebooleanrequired
    • disabled_reasonstringrequirednullable
      failures when the webhook switched itself off.
    • failuresintegerrequired
      Failed deliveries in a row.
    • last_statusintegerrequirednullable
      The HTTP status of the last delivery.
    • last_delivered_atstring (date-time)requirednullable
    • created_atstring (date-time)required
    • updated_atstring (date-time)required
    • secretstringrequirednullable
      Shown only in this answer; null with security_strategy none.
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"}}.

403insufficient_scope, naming the read scope the event needs.

An error object: {"error": {"code", "message", "fields"}}.

422validation_failed (fields names the input), or plan_limit (the store has as many webhooks as its plan allows).

An error object: {"error": {"code", "message", "fields"}}.

429Too many requests (code rate_limited); see Retry-After.

An error object: {"error": {"code", "message", "fields"}}.