Create webhook
Add a webhook (the secret is shown once)
https://s.zo.sa/api/public/v1 /webhooks webhooks.read_writeNot 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
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.
namestringrequiredeventstringrequiredOne of GET /webhooks/events.urlstringrequiredhttps only, a public address (never the server, a LAN or a metadata range).rulestringnullableheadersarray of objectsnullableCustom headers sent with every delivery. Host, Authorization, Content-Type, User-Agent and X-Zo-* are refused.2 fields
keystringrequiredvaluestringrequiredMasked (••••••) 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.
security_strategystringsecretstringnullableGenerated when left out and the strategy is signature or token.signature_versionintegeris_activebooleanSwitching 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.
{
"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
Response schema
dataobjectrequiredA webhook this key created. The secret is never shown here; it comes back once, on create and on rotate.16 fields
idintegerrequirednamestringrequiredeventstringrequiredurlstring (uri)requiredrulestringrequirednullableA rule on the payload attributes, such as total > 100 AND payment_method = `cod`.headersarray of objectsrequired2 fields
keystringrequiredvaluestringrequiredMasked (••••••) 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.
security_strategystringrequiredsignature_versionintegerrequired1 signs the raw body; 2 signs "{X-Zo-Timestamp}.{raw body}" and sends X-Zo-Timestamp.is_activebooleanrequireddisabled_reasonstringrequirednullablefailures when the webhook switched itself off.failuresintegerrequiredFailed deliveries in a row.last_statusintegerrequirednullableThe HTTP status of the last delivery.last_delivered_atstring (date-time)requirednullablecreated_atstring (date-time)requiredupdated_atstring (date-time)requiredsecretstringrequirednullableShown only in this answer; null with security_strategy none.
An error object: {"error": {"code", "message", "fields"}}.
An error object: {"error": {"code", "message", "fields"}}.
An error object: {"error": {"code", "message", "fields"}}.
An error object: {"error": {"code", "message", "fields"}}.
An error object: {"error": {"code", "message", "fields"}}.