Quickstart in 5 minutes
Four steps from no key to a signed webhook arriving at your server. You need a store on the Pro plan and its owner's mobile.
Labels below are the dashboard's English labels. Switch the dashboard language to English to see them.
-
Create a key
The store owner opens All → Developer tools → API keys (
/settings/api-keys) → New key, and picks these scopes for this quickstart:- Store: Read.
- Products: Read.
- Orders: Read (subscribing to
order.createdneedsorders.read). - Webhooks: Read and write.
Then Next, Send verification code, type the 4-digit code from the owner's mobile, and Create. The key (
zo_live_…) is shown once. Keep it in an environment variable:export ZO_API_KEY='zo_live_...'More on the choices: Getting a key.
-
Make your first call
export ZO_API_KEY='zo_live_...' curl -sS https://s.zo.sa/api/public/v1/store \ -H "Authorization: Bearer $ZO_API_KEY" \ -H "Accept: application/json" -iThe answer is 200 with the store and the rate headers (
X-RateLimit-Limit: 360). Every amount in the API is an integer in halalas (100 halalas = 1 SAR), and dates are ISO 8601 in UTC. The full answer is on Your first call. -
List the products
curl -sS "https://s.zo.sa/api/public/v1/products?per_page=5" \ -H "Authorization: Bearer $ZO_API_KEY" \ -H "Accept: application/json"This one needs
products.read. The answer is a page of products indataand, inmeta,per_pageandnext_cursor: passnext_cursorascursorto read the next page, until it isnull. See Lists and pagination and List products. -
Receive one webhook
Your receiver needs an
httpsaddress on a public host. Create the webhook with signature version 2:curl -sS https://s.zo.sa/api/public/v1/webhooks -H "Authorization: Bearer $ZO_API_KEY" \ -H "Content-Type: application/json" -H "Accept: application/json" \ -d '{"name":"ERP orders","event":"order.created","url":"https://erp.example.com/zo/hooks","security_strategy":"signature","signature_version":2}'The answer is 201 with the webhook in
data. The secret is shown once, indata.secret: keep it in your receiver's settings. Put the webhook's id fromdata.idin a variable:export WEBHOOK_ID=7 # data.id from the answer aboveThen ask for a test delivery now:
curl -sS -X POST "https://s.zo.sa/api/public/v1/webhooks/$WEBHOOK_ID/test" \ -H "Authorization: Bearer $ZO_API_KEY" \ -H "Accept: application/json"The test sends a sample now and answers its result; your receiver has 5 seconds (1 to connect). The delivery carries
X-Zo-Event,X-Zo-Delivery,X-Zo-TimestampandX-Zo-Signature: verify the signature on the raw body with the code on Webhooks, and answer 2xx.
Next
- The sample app on GitHub does all of this in one small Node app with no packages to install, and also places an order with an
Idempotency-Keyand adjusts stock. - Architecture (HLD): how the pieces fit together before you build the sync.
- Go-live checklist: before you connect the merchant's real store.