API key
Check your key
/api/v1/keyWhich organisation the key acts for, with its name, scopes and expiry: a first call to check a key works. Any key may call it, whatever its scopes.
Responses
| Name | Type | Description |
|---|---|---|
organisation | object | The organisation the key acts for. |
organisation.name | string | Its name. |
organisation.slug | string | Its short name, as in the app’s addresses (gbalejo.com/o/<slug>). |
name | string | The key’s name, given when it was created. |
scopes | array of strings | What the key may do: each route needs one of these.visits:readvisits:writesites:reademployees:reademployees:write |
expiresAt | string or null | When the key stops working (ISO 8601), or null if it never expires. |
Errors
| Status | Type | When |
|---|---|---|
| 401 | api-key-invalid | No key was sent, or it is mistyped or unknown. |
| 401 | api-key-revoked | The key has been revoked. |
| 401 | api-key-expired | The key has passed its expiry date. |
| 402 | plan-feature | The organisation’s plan does not include the API (feature: "api"). |
| 403 | organisation-suspended | Gbàlejò has suspended the organisation. |
| 429 | rate-limited | The key has made its requests for this minute (Retry-After says when). |
API key
Check your key
/api/v1/keyWhich organisation the key acts for, with its name, scopes and expiry: a first call to check a key works. Any key may call it, whatever its scopes.
Example request
curl https://api.gbalejo.com/api/v1/key \
-H "Authorization: Bearer $GBALEJO_API_KEY"const response = await fetch('https://api.gbalejo.com/api/v1/key', {
headers: {
Authorization: `Bearer ${process.env.GBALEJO_API_KEY}`,
},
});
// Problems come back as application/problem+json: type, title, status, detail.
if (!response.ok) throw new Error((await response.json()).detail);
const result = await response.json();Example response
200 OK{
"organisation": {
"name": "Lagoon Point Holdings",
"slug": "lagoon-point"
},
"name": "HR sync",
"scopes": [
"visits:read",
"visits:write"
],
"expiresAt": "2027-12-04T23:59:59.000Z"
}Responses
The key’s organisation, name, scopes and expiry.
organisationobject
The organisation the key acts for.
organisation.namestring
Its name.
organisation.slugstring
Its short name, as in the app’s addresses (gbalejo.com/o/<slug>).
namestring
The key’s name, given when it was created.
scopesarray of strings
What the key may do: each route needs one of these.
expiresAtstring or null
When the key stops working (ISO 8601), or null if it never expires.
Errors
No key was sent, or it is mistyped or unknown.
The key has been revoked.
The key has passed its expiry date.
The organisation’s plan does not include the API (feature: "api").
Gbàlejò has suspended the organisation.
The key has made its requests for this minute (Retry-After says when).