Rotate webhook secret
A new secret (the old one stops working at once; the new one is shown once)
POST
https://s.zo.sa/api/public/v1 /webhooks/{id}/secret Scope
webhooks.read_writeRequest
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | integer | required | At least 1 |
cURL
curl -sS -X POST "https://s.zo.sa/api/public/v1/webhooks/7/secret" \
-H "Authorization: Bearer $ZO_API_KEY" \
-H "Accept: application/json"JavaScript
const response = await fetch('https://s.zo.sa/api/public/v1/webhooks/7/secret', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.ZO_API_KEY}`,
Accept: 'application/json',
},
});
console.log(response.status, await response.json());PHP
<?php
$ch = curl_init('https://s.zo.sa/api/public/v1/webhooks/7/secret');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('ZO_API_KEY'),
'Accept: application/json',
],
]);
$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/7/secret",
headers={
"Authorization": f"Bearer {os.environ['ZO_API_KEY']}",
"Accept": "application/json",
},
timeout=30,
)
print(response.status_code, response.json()){
"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": null
}
}Example generated from the schema.
Responses
200The webhook with its new secret.
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.
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"}}.
404No such row in this store (code not_found).
An error object: {"error": {"code", "message", "fields"}}.
429Too many requests (code rate_limited); see Retry-After.
An error object: {"error": {"code", "message", "fields"}}.