Authentication
API keys, scopes, location limits and how to revoke a key.
Every call needs an API key. A key belongs to one company. Ajour reads the company from the key, so you never send a company id.
Create a key
- Sign in to the Ajour back office.
- Go to Settings → API keys.
- Select Create key.
- Enter a name that says who uses the key, for example "Power BI" or "Accounting partner".
- Choose the scopes and the locations.
- Optional: set an expiry date.
- Copy the key and keep it in a safe place, such as a password manager.
All users of your company can create, see and revoke your company's keys. Ajour support can also do this for you.
The key is shown one time
Ajour stores only a hash of the key. If you lose the key, revoke it and create a new one.
Key format
ajr_live_7Kq2Vx9b_Q3n8...
│ │ │ └ secret
│ │ └ key id (shown in the API keys list)
│ └ live
└ prefixThe ajr_ prefix lets secret scanners find a key that was shared by mistake.
Send the key
Send the key in the Authorization header as a bearer token:
curl https://api.ajour.dk/v1/company \
-H "Authorization: Bearer $AJOUR_API_KEY"The API does not accept keys in the URL, because URLs are saved in logs.
Scopes
A scope gives the key access to a group of endpoints. Give each key only the scopes it needs.
| Scope | Gives access to |
|---|---|
catalog:read | Locations, product groups and products |
sales:read | Sales lines, key figures, breakdowns and salesperson names |
reports:read | Report files (PDF and Excel) |
customers:read | Reports with customer card holders' names, addresses and balances. Off by default. |
GET /v1/company works with any scope.
If the key does not have the scope that a call needs, the API returns 403.
Location limits
You can limit a key to some of your locations. For example, a chain can give a franchise partner a key that sees only that partner's shop.
- Lists and figures include only the key's locations.
- If you ask for a location outside the key, the API returns
404. It does not show that the location exists. GET /v1/companyshows the key's locations inkey.locationIds.nullmeans all locations.
Revoke a key
Go to Settings → API keys and select Revoke next to the key. The key stops working at once. Calls with it return 401.
The API keys list shows when each key was last used. Revoke keys that nobody uses.
Keep keys safe
- Keep keys on a server or in a password manager. Never put a key in a web page or a mobile app.
- Use one key per system or partner, so you can revoke one without stopping the others.
- Revoke a key at once if you think someone else has it.