Skip to content
thebuilding.cloud DEVELOPERS
Get an API key

Developers / Guides

Lists, paging and limits

View as Markdown Open in Claude Open in ChatGPT

Paging

Lists come one page at a time. Most list endpoints accept:

Parameter Default What it does
per_page 10 Rows per page. Keep it at 100 or less.
page 1 Which page.
column_name id Column to sort by.
order DESC ASC or DESC.
search — Free text, on endpoints that support it.

The rows are in data. The page details (current_page, last_page, per_page, total) are next to them, or inside meta on some endpoints. Keep asking for the next page until current_page equals last_page.

curl "https://go.thebuilding.cloud/api/users?per_page=50&page=2" \
  -H "Authorization: Bearer $TBC_KEY" \
  -H "Accept: application/json"

Endpoints can have their own filters too (for example building_id on the entrance list, or from_date and to_date on the access log). The API reference lists them for each endpoint.

Limits

  • 300 requests a minute for each person (each key's person). Requests without a key get 300 a minute per internet address.
  • Getting an API token from an email and password allows 10 tries a minute per email and address.
  • Over the limit you get 429 Too Many Requests and a Retry-After header with the seconds to wait.

Every reply includes X-RateLimit-Limit and X-RateLimit-Remaining, so you can slow down before you hit the limit.

Staying under the limit

  • Ask for bigger pages (per_page=100) instead of many small ones.
  • Cache lists that rarely change, such as sites, buildings and entrances.
  • For big reports use exports: they run in the background and don't count against your limit while they run. See Read the access log.
  • Spread scheduled jobs out; don't start them all on the hour.