REST API basics

Authentication, pagination, rate limiting, and error handling - the mechanics shared by every AssetLab API endpoint.

The AssetLab REST API exposes your organization's data for integrations, BI, and automation. Every endpoint shares the mechanics on this page; per-endpoint schemas live in the interactive API reference.

Base URL and versioning

The API is served under a versioned base path (.../v1). The exact base URL for your organization is shown in Settings → API Keys. Breaking changes get a new version; v1 stays stable.

Authentication

Every request carries an API key as a Bearer token:

curl -H "Authorization: Bearer al_live_xxxxx" \
  "https://<api-base>/v1/assets"

The key determines the organization (permanently bound) and the scopes (list). There is no other tenancy mechanism - no header, no parameter.

Requests and responses

Pagination

List endpoints paginate with page and per_page:

ParameterDefaultMax
page1-
per_page251000

Every list response carries a pagination object:

{
  "data": [ ... ],
  "pagination": { "page": 1, "per_page": 25, "total": 142, "total_pages": 6 }
}

Iterate until page == total_pages. For large syncs, prefer big per_page values over many small pages - friendlier to your rate limit.

Rate limiting

Each key has a per-minute limit (default 60 req/min), reported on every response:

HeaderMeaning
X-RateLimit-LimitRequests allowed per window
X-RateLimit-RemainingLeft in the current window
X-RateLimit-ResetUnix time the window resets

On 429, back off until the reset time. Well-behaved clients watch Remaining and pace proactively.

Errors

Errors return a JSON body with an error string and a conventional status:

StatusMeaning
400Bad request - malformed UUID, invalid payload
401Missing or invalid API key
403Key inactive, expired, or missing the required scope
404Resource not found (in your organization - IDs from elsewhere 404)
429Rate limit exceeded
500Server error - safe to retry with backoff

Handle 403 specially in integrations: it usually means a scope gap, which is a configuration fix, not a retry.

Writing data well

  1. Look up before you link. Creating an asset means first fetching real site/building/system IDs from their list endpoints.
  2. Don't send tenant identifiers. They're ignored; the key decides.
  3. Use bulk endpoints for migrations - hundreds of records per call instead of hundreds of calls.
  4. Idempotency by design - on retryable failures, re-query before re-creating to avoid duplicates.