KWNDevelopersالعربيةOpen KWN

Get started

Scopes

A key does only what its scopes allow, inside the company’s plan.

A scope is an app and a level. A higher level includes the lower one: sales:approve can also write and read. Each operation in the reference lists the capability it needs and the scopes that carry it.

ScopeAllows
sales:readQuotations, sales orders, invoices, credit notes and e-invoices; contacts and products.
sales:writeAlso create and edit drafts, confirm, invoice orders, cancel, and issue an invoice already approved; create contacts and products.
sales:approveAlso approve invoices and credit notes, and issue a draft in one step. POST /einvoices needs it.
purchase:readRequests for quotation, purchase orders, bills and refunds; contacts and products.
purchase:writeAlso create and edit them, confirm, bill orders and cancel; create contacts and products.
purchase:approveAlso post bills and refunds into the accounts.
contacts:read · contacts:writeThe contact book on its own, without sales or purchases.
reports:readThe VAT 201 return (with sales:read or purchase:read) and aged receivable (with sales:read).
accounting:readAged payable and the trial balance. Offered only while Accounting is in the company’s plan.

The limits on any key

  • A key is never more than the person who creates it: a scope above theirs is refused (API_SCOPE_ABOVE_YOURS), and so is an app outside the plan (API_SCOPE_NOT_IN_PLAN).
  • A key never manages users, keys, billing or the company’s settings, whatever its scopes.
  • An app the company’s plan does not hold is refused even to a key that names it (APP_LOCKED).
  • GET /me answers what the key may do right now — use it rather than tracking scopes yourself.

Give each key the least it needs. A shop that only sends invoices needs sales:approve; a reporting tool needs reports:read and sales:read.