Sifr Wahid Developers

Architecture (HLD)

Key and security model

Who can create a key, what a key can reach, and what every call is checked against.

Creating a key (once, by the store owner) Store owner the owner only, never from a support session API keys page name and scopes, IP addresses, expiry /settings/api-keys Verification a 4-digit code to the owner's verified mobile The key zo_live_... shown once, then prefix and last use Using a key (every call) Your system Authorization: Bearer zo_live_... never in the URL Every call is checked, in this order 1. a known key, not revoked or expired 401 2. the caller's address is in the key's list 403 3. writes: the store is not suspended 403 4. the store is on the Pro plan 402 5. the key's 360 calls a minute 429 6. the key holds the route's scope 403 1 to 4 are refused before the rate count One store every answer is about the key's store
Top: the owner creates a key once, confirmed by a code to their mobile, and sees it once. Bottom: every call is checked in this order, and the first check that fails answers with its code. The first four are refused before the rate count, so they carry no rate headers; a missing scope is found after the count.

Who creates a key

  • The store owner only, in the dashboard, and never from a support session.
  • Only stores on the Pro plan can create keys. A store on Basic or Plus cannot, and a key of a store that moved to another plan is answered 402 feature_locked.
  • Creating a key is confirmed by a 4-digit code sent to the owner's verified mobile.
  • The owner may ask for a code 10 times and create 20 keys every 10 minutes, and the codes for one mobile are capped (5 an hour and 10 a day by default). A store holds at most 20 live keys.

What a key holds

PartWhat it does
One storeEach key is bound to one store, and every answer is about that store only.
NameThe system that uses it, such as "Odoo main warehouse". One key per system, so you know who did what and can revoke one without the others.
ScopesFor each resource none, read, or read and write: {resource}.read or {resource}.read_write, where read_write includes read. A call without the route's scope gets 403 insufficient_scope. See the scope table.
IP addressesOptional: up to 20 addresses or ranges, IPv4 or IPv6. A call from any other address is answered 403 ip_not_allowed.
ExpiryOptional: the key stops at the end of that day, Riyadh time.
The key itselfzo_live_…, shown once. The list then shows only its prefix and its last use.

IP allow-list

A key may hold up to 20 IP addresses or ranges, IPv4 or IPv6, such as 203.0.113.7 or 203.0.113.0/24. A call from any other address is answered 403 ip_not_allowed, before the rate count. Leave the list empty to accept calls from any address. Put your servers' addresses in it, and update it before you move a server.

Sensitive scopes

customers.read, customers.read_write (shoppers' data), payments.read_write and shipments.read_write (they move money: a carrier label is paid from the store wallet). The dashboard warns when one is picked. Without customers.read, contact data is taken out of every answer and every webhook.

Revocation and rotation

  • Revoking a key on the API keys page stops it at once: the next call with it is answered 401 invalid_token, and the webhooks it created stop.
  • To rotate: create a new key, move your system to it, then revoke the old one.
  • A suspended store keeps answering reads; every write answers 403 store_suspended.

Handling the key in your system

  • Keep it in an environment variable or a secrets store, never in code, a repository, logs or an emailed file.
  • Send it in Authorization: Bearer zo_live_… only. A key in the query string is refused: it ends up in logs and browser history.
  • Add your servers' addresses to the key's list, and an expiry date for a temporary integration.
  • Alert on 401, 402 or 403: a revoked key, a plan change, a new address.