Authentication and scopes
One header authenticates every call; the key's scopes decide what it may read and change.
The key in the header
- Send the key only in
Authorization: Bearer zo_live_…. A key in the query string is refused: it ends up in logs and browser history. - Scopes are
{resource}.reador{resource}.read_write;read_writeincludesread. The store itself isstore.readonly. - A key without the route's scope gets 403
insufficient_scope, naming the missing scope.
GET /api/public/v1/store HTTP/1.1
Host: s.zo.sa
Authorization: Bearer zo_live_...
Accept: application/jsonScopes
| Scope | What it unlocks |
|---|---|
store.read | The store's data (GET /store) |
products.read / products.read_write | Products, categories and brands: read, then create, update and delete |
inventory.read / inventory.read_write | Stock per branch, its movements and the branches, then adjusting quantities |
orders.read / orders.read_write | Orders, their history and the statuses, then creating an order and changing its status |
customers.read / customers.read_write | Customers, and contact data everywhere, then adding and updating a customer |
carts.read / carts.read_write | Abandoned carts (needs the abandoned_carts feature); no write endpoint in v1 |
marketing.read / marketing.read_write | Coupons: read, then create, update and delete |
shipments.read / shipments.read_write | Shipments, then shipping an order and cancelling a shipment |
payments.read / payments.read_write | An order's payments and the payment methods; no write endpoint in v1 |
reviews.read / reviews.read_write | Reviews, then the store's reply |
webhooks.read / webhooks.read_write | The key's own webhooks (Webhooks) |
Customer data
Without customers.read, contact data is taken out of every answer and every webhook: an order's customer is {id, name} with no mobile, email or shipping address, customer_note is absent (free text that may hold a number), an abandoned cart's customer is {id, name} with no customer.mobile or customer.email (in the cart webhook payload the field is customer_mobile, dropped the same way).
- Creating an order for a
customerby mobile needscustomers.readas well; without it the call is 422customers_scope_required. Acustomer_idworks withorders.read_writealone. - A shipment's label (
GET /shipments/{id}/label) needscustomers.readtoo, because the label carries the shopper's address and mobile.
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.
Scopes for webhooks
Subscribing to an event needs the read scope of the event's resource, else 403 insufficient_scope: order.* needs orders.read, product.* needs products.read, customer.* needs customers.read, and so on (GET /webhooks/events names the scope of each event). The stock events product.quantity.low and product.available need inventory.read or products.read. Scopes are checked again at every send. Every event and its scope: Webhook events.
Operations per scope
Each operation names the scope it needs in the OpenAPI file (x-scope). A key with {resource}.read_write also holds {resource}.read.