Sifr Wahid Developers

Get started

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.

  1. 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.created needs orders.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:

    Shell
    export ZO_API_KEY='zo_live_...'

    More on the choices: Getting a key.

  2. Make your first call

    Shell
    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" -i

    The 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.

  3. List the products

    Shell
    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 in data and, in meta, per_page and next_cursor: pass next_cursor as cursor to read the next page, until it is null. See Lists and pagination and List products.

  4. Receive one webhook

    Your receiver needs an https address on a public host. Create the webhook with signature version 2:

    Shell
    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, in data.secret: keep it in your receiver's settings. Put the webhook's id from data.id in a variable:

    Shell
    export WEBHOOK_ID=7   # data.id from the answer above

    Then ask for a test delivery now:

    Shell
    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-Timestamp and X-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-Key and 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.