Sifr Wahid Developers

API reference / Webhooks

Update webhook

Change a webhook (only the keys sent)

PATCH https://s.zo.sa/api/public/v1/webhooks/{id}
Scope webhooks.read_write

Not idempotent (an Idempotency-Key is ignored). The answer shows the values of the headers this request sent, and the secret only when this change made one (security_strategy set to signature or token on a webhook without a secret, and no secret sent).

headers replaces the saved list when sent: send every header you keep, with the mask •••••• as the value of one whose value should stay. Every other key you do not send stays.

Request

Path parameters

NameTypeRequiredDescription
idintegerrequiredAt least 1

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.

  • namestring
    Up to 120 characters
  • eventstring
    One of GET /webhooks/events.
  • urlstring
    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 PATCH "https://s.zo.sa/api/public/v1/webhooks/7" \
  -H "Authorization: Bearer $ZO_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
  "is_active": true
}'

JavaScript

const response = await fetch('https://s.zo.sa/api/public/v1/webhooks/7', {
  method: 'PATCH',
  headers: {
    Authorization: `Bearer ${process.env.ZO_API_KEY}`,
    Accept: 'application/json',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "is_active": true
  }),
});
console.log(response.status, await response.json());

PHP

<?php

$ch = curl_init('https://s.zo.sa/api/public/v1/webhooks/7');
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',
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'is_active' => true,
    ]),
]);
$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/webhooks/7",
    headers={
        "Authorization": f"Bearer {os.environ['ZO_API_KEY']}",
        "Accept": "application/json",
    },
    json={
        "is_active": True,
    },
    timeout=30,
)
print(response.status_code, response.json())

Switches the webhook back on after the receiver is fixed; this also clears its failure count.

Response 200
{
  "data": {
    "id": 1,
    "name": "string",
    "event": "string",
    "url": "https://example.com",
    "rule": null,
    "headers": [
      {
        "key": "string",
        "value": "string"
      }
    ],
    "security_strategy": "signature",
    "signature_version": 1,
    "is_active": true,
    "disabled_reason": null,
    "failures": 1,
    "last_status": null,
    "last_delivered_at": null,
    "created_at": "2026-11-23T06:01:53Z",
    "updated_at": "2026-11-23T06:01:53Z",
    "secret": "string"
  }
}

Example generated from the schema.

Responses

200The webhook as saved; with secret only when this change made one.
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
    • secretstring
      Present only when this change made a new secret.
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 a new event needs.

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

404No such row in this store (code not_found).

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