Guides
Authentication
Every request carries one of your organisation’s API keys as a bearer token. A key has a name, scopes, an expiry, and acts for the organisation at every site.
Create a key
- Sign in as an owner or an organisation admin and open Settings → API keys.
- Choose Create API key, name it after what will use it ("HR sync"), tick its scopes and choose when it expires.
- Copy the key: it starts with
gbj_live_and is shown once. Gbàlejò keeps only a hash of it, so nobody can show it again.
Keys are part of the Business and Enterprise plans. On another plan every call is refused with 402 plan-feature.
Send it
Send the key in the Authorization header of every request, over HTTPS:
GET /api/v1/key HTTP/1.1
Host: api.gbalejo.com
Authorization: Bearer gbj_live_…Check your key answers with the organisation, the key’s name, scopes and expiry: a first call to check a key works. The examples here read the key from the GBALEJO_API_KEY environment variable.
Scopes
A key may call only the operations its scopes allow; any other is refused with 403 api-key-scope. An operation that takes several scopes needs any one of them. Give each key the fewest scopes its job needs.
| Scope | Lets the key |
|---|---|
visits:read | Read the visit log and single visits. List visits, Get a visit, List visitor types |
visits:write | Invite visitors and cancel visits. Invite visitors, Cancel a visit, List visitor types |
sites:read | Read the sites and their entrances. List sites |
employees:read | Read the employee directory. List employees |
employees:write | Add employees, change them and deactivate them. Add an employee, Change an employee |
Expiry and revoking
- A key works until the end of the day it expires (UTC). A new key expires a year from the day it is made unless you choose another day, or no end.
- Revoke a key in Settings → API keys. It stops working at once; calls with it are refused with
401 api-key-revoked, and with an expired key401 api-key-expired. - Revoked and expired keys stay listed, with when each was last used and from which address.
- To replace a key, create the new one, move your system to it, then revoke the old one.
What a key can do
A key acts as its organisation, at every site, through the same rules as the app: plan limits, a read-only account, and the steps a visit goes through. Every change it makes is recorded in the organisation’s audit log as made by the key.
Keep keys on your servers. A key is a password for your organisation’s data. Never put one in a web page, a mobile app or a repository, where anyone could read it: call the API from your own servers. If a key leaks, revoke it. Keys start with gbj_live_ so secret scanners can spot them.