Skip to content
GbàlejòDocs

API key

Check your key

GET/api/v1/key
Scope: any key

Which 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
curl https://api.gbalejo.com/api/v1/key \
  -H "Authorization: Bearer $GBALEJO_API_KEY"
JavaScript
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
JSON
{
  "organisation": {
    "name": "Lagoon Point Holdings",
    "slug": "lagoon-point"
  },
  "name": "HR sync",
  "scopes": [
    "visits:read",
    "visits:write"
  ],
  "expiresAt": "2027-12-04T23:59:59.000Z"
}

Responses

200 OK

The key’s organisation, name, scopes and expiry.

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

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).