Skip to content
thebuilding.cloud DEVELOPERS
Get an API key

Developers / Guides

Quickstart

View as Markdown Open in Claude Open in ChatGPT

Make your first request and open a door in about five minutes. You need a TheBuilding.Cloud account with at least one entrance.

1. Get an API key

Sign in to the dashboard, open your Profile, choose Manage Api and press Generate Token. Name it after the system that will use it (for example "Reception kiosk"), then copy the token. It is shown only once.

Keep the key secret: anyone with it can act as you. Store it in your system's secret settings, never in an app people download or in a public repository.

export TBC_KEY="paste-your-token-here"

Prefer to get a token from code? See Authentication and API keys.

2. Check the key works

Every request sends the key in the Authorization header and asks for JSON:

curl https://go.thebuilding.cloud/api/user \
  -H "Authorization: Bearer $TBC_KEY" \
  -H "Accept: application/json"

You get your own profile back. A 401 means the key is wrong or was deleted.

3. List your entrances

curl "https://go.thebuilding.cloud/api/entrances?per_page=20" \
  -H "Authorization: Bearer $TBC_KEY" \
  -H "Accept: application/json"

The rows are in data. Note the id of the door you want: that is what you open.

{
  "data": [
    { "id": 42, "name": "Main Entrance", "building_id": 7, "status": 1 }
  ],
  "meta": { "current_page": 1, "per_page": 20, "total": 1 }
}

4. Open the door

curl -X POST https://go.thebuilding.cloud/api/entrances/42/unlock \
  -H "Authorization: Bearer $TBC_KEY" \
  -H "Accept: application/json"

A 200 means the door was told to open, and the opening is in the access log under your name. Other answers:

Status Meaning
403 You can't open this door, the entrance is turned off, or (for doors that only open nearby) you are too far away. The message says which.
404 No entrance with that ID in your organisation.
422 This door only opens near the building and no position was sent: send lat and lng.
429 Too many requests. Wait the seconds in Retry-After.

Next steps