Skip to main content

API Keys

Avatar › Developer

An API key lets an external system (ERP, BI, your own integration) query the INSSACS API without using your session.

API keys are their own permission resource: View API keys shows the section in the avatar menu, Create API keys enables the Add button, Edit API keys lets you change their permissions and see their secret, and Delete API keys enables Revoke.

The API contract

Which endpoints exist, what body each one expects and what it returns is in API for integrations.

API key listAPI key list
API Keys

What a key reaches​

The key is used on the public API, https://back.inssacs.com/api/v1, sending the secret in the x-api-key header. It only works there: outside /api/v1 it is rejected.

Every key belongs to a single account and only works inside it:

  • It reads its account, operations, devices (with their planogram and selection movements), deliveries, returns, recharges and balances.
  • It reads and writes users and their codes, products and categories, profiles, tickets and stock orders. A device's inventory only changes through stock orders.
  • Only in what its permission list grants (see Key permissions).
  • It does not see other accounts. If an integration works with several accounts, issue one key for each.

Creating a key​

Add opens the Create API key dialog:

FieldNote
NameRequired, max 60 characters. To recognise it later (ERP integration).
AccountRequired. The key is bound to that account. If your operator belongs to an account, the key is created in yours and the field does not appear.
Business lineNot chosen: it is the account's, shown once you pick it.
PermissionsWhat the key can do. It starts with everything you can grant and you trim from there.
ExpirationOptional. Without a date, it never expires.

Save issues it and shows the secret.

Copy the secret

On creation the app shows the full secret with the notice Copy the secret now. Store it in your system's secret manager. Afterwards, whoever can edit keys can show or copy it again from the table. If a key does not store its secret, the table says so: it was only shown when created; if it is lost, you have to revoke the key and create another.

Key permissions​

A key has no role: the list you leave checked is everything it can do. That is the difference with an operator, where the role is the floor and granular permissions add on top.

Uncheck everything the integration does not need. A typical example: a BI that only reads movements needs Reports › View and nothing else.

You can never grant a permission you do not have: the server answers You cannot grant permissions you do not have. The matrix never offers API keys, Clients or AI assistant: issuing, editing or revoking keys is always done by hand from the app, and the client and the assistant sit above the key's account.

The permissions of an issued key are changed with Edit permissions (the shield in its row), without revoking it or handing out the secret again.

API key permissions dialogAPI key permissions dialog
API key permissions

The table​

Name, prefix (the first characters, to identify it; with permission to edit keys, also Show the secret and Copy the secret), account, business line, status (Active, Revoked, Expired), limit/min, last used and expiration. The ID and creation date can be shown from the column picker, and Export to Excel downloads the table as you see it. The search narrows by name, prefix or account.

Row actions:

ActionWhat it does
Usage (📊)The last 30 days: requests and bandwidth, broken down by day, endpoint and response status. Useful to see whether an integration is retrying too much or getting errors.
Edit permissions (shield)Changes what the key can do. Not shown on revoked keys.
RevokeMakes the key unusable immediately, after you confirm. Not shown on revoked keys.

Revoking​

Revoke cannot be undone. Do it if the secret leaked, if the integration is retired or if you see usage you do not recognise. The revocation is recorded in Audit.

If a key's account is deleted, the key is revoked with it: it stops authenticating from the next request. It is not deleted: it stays as history.

Good practices​

  • One key per integration, never shared: that way you can revoke one without breaking the rest.
  • One key per account: if an integration consolidates several accounts, give each one a key.
  • Set an expiration on temporary ones (tests, a one-off vendor).
  • Review Usage now and then: an unused key is a key you can revoke.

Common errors​

MessageMeaning
Invalid or revoked API keySecret mistyped, key revoked or expired.
The API key has no scope for this actionWhat was asked is outside the key's account or its permissions.
The API key cannot modify this fieldThe key is not allowed to write there.
That business line is not available…You picked an account of a line you do not handle.
An API key cannot hold permissions over API keys…The API keys resource was granted to it. That management is always manual.
Too many requestsIt exceeded its per-minute limit.