---
agentTools:
  projectIndex: https://lambent.readme.io/llms.txt
---

# Zone Occupancy v1

Mean and peak occupancy and utilization for all zones in a tenant within a time range from start (inclusive) to end (exclusive) using a provided resolution. 

Results include only the zones in buildings your credentials have been granted occupancy access to.

Resolution can be set to `5m`, `10m`, `15m`, `30m`, `1h`, `6h` and `1d` and determines the size of time intervals between the start and end (i.e., resolution set to `30m` between 8:30 AM and 10:30 AM would produce occupancy estimates for intervals 8:30 AM, 9:00 AM, 9:30 AM, and 10:00 AM). Larger resolutions are preferred to reduce the size of the result set and the impact of outliers.

Result sets will include one row per interval per zone, and are ordered by the `start_timestamp` of the interval. Given a resolution of `15m` and an interval timestamp of 3:00 PM, the `mean_occupancy` and `peak_occupancy` is the average and maximum occupancy from 3:00 PM (inclusive) to 3:15 PM (exclusive). 

The `mean_utilization` and `peak_utilization` fields are derived from the respective occupancy values divided by the asset's `capacity`. Both fields are `null` when capacity is not configured for the asset. `capacity` and both utilization fields are also `null` on rows in buildings your credentials have not been granted capacity access to.

Currently all results are returned in a single page. The API rejects requests if the time range is too large for the selected resolution. Valid time ranges based on resolution are:
- 4 days at `5m`
- 10 days at `10m`
- 2 weeks at `15m`
- 1 month at `30m`
- 2 months at `1h`
- 1 year at `6h`
- 4 years at `1d`

Intervals are aligned to a fixed grid rather than to `start` — to the Unix epoch in UTC by default, or to local midnight when `bucket_timezone` is given. `start` is floored to the interval boundary at or before it, so a request beginning at 8:00 AM with `1d` resolution reports an interval stamped 12:00 AM. At the other end, the last interval reported is the last one ending at or before `end`; an interval that would run past `end` is dropped by default, with one exception described below. `partial_buckets` changes this: see that parameter.

Occupancy is aggregated only over data from `start` (inclusive) to `end` (exclusive). Combined with that alignment, this means the first interval of the series covers only the part of itself inside the requested range whenever `start` does not fall on an interval boundary. Such an interval is *partial*, and nothing in the row says so — `start_timestamp`, the occupancy and utilization fields, and the row shape are identical to a whole interval's. Treating one as representing its full labelled period, by averaging it in with whole intervals or reporting it as a whole day or hour, misstates the result. Compare `start` and `end` against the resolution to identify it, or pass `partial_buckets=none` to receive whole intervals only.

A time range narrower than the resolution is answered rather than rejected. Where the whole range falls inside a single interval — `1d` resolution from 8:00 AM to 12:00 PM, or from 12:00 AM to 11:59:59 PM — the response is one row, stamped at that interval's start, aggregating only the hours requested (with `partial_buckets=none` it is an empty `results` array). It is the caller's responsibility to recognise that such a row does not cover the period its `start_timestamp` names. To obtain a whole interval instead, use a resolution no longer than the range, or move `end` past the next interval boundary — bearing in mind that an interval still in progress is itself partial until it closes, and that occupancy lags real time (see below).

In addition to the resolution/time range constraints, responses are limited to a maximum of 3 million rows. Response bodies larger than the row limit are truncated, dropping more recent data (based on ordering).

HTTP compression is enabled for responses larger than 500 bytes when the request includes `"gzip"` in the `Accept-Encoding` header.

Please note that Lambent Spaces does not produce occupancy in real time. Occupancies for a given time period may be delayed from 30 minutes to an hour, and this may be further increased due to ingestion lag or data availability from Wi-Fi source systems.

The zone occupancy endpoint is rate-limited to 60 requests per minute.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Analyze",
    "version": "2026-10-16",
    "description": "Occupancy estimates for your Lambent Spaces buildings and their levels and zones, how long visits to them last, when people's days there start and end, and how often occupants come and stay.\n\nEvery request is authenticated with either a bearer token (`Authorization: Bearer <token>`) or an API key (`X-API-Key: <key>`), never both. See **Authenticating** for how to obtain each. Results include only the buildings your credentials have been granted.\n"
  },
  "servers": [
    {
      "url": "https://prod-api-ag.lambentspaces.app/analyze",
      "description": "Production"
    }
  ],
  "paths": {
    "/v1/occupancy/zone": {
      "get": {
        "summary": "Zone Occupancy v1",
        "description": "Mean and peak occupancy and utilization for all zones in a tenant within a time range from start (inclusive) to end (exclusive) using a provided resolution. \n\nResults include only the zones in buildings your credentials have been granted occupancy access to.\n\nResolution can be set to `5m`, `10m`, `15m`, `30m`, `1h`, `6h` and `1d` and determines the size of time intervals between the start and end (i.e., resolution set to `30m` between 8:30 AM and 10:30 AM would produce occupancy estimates for intervals 8:30 AM, 9:00 AM, 9:30 AM, and 10:00 AM). Larger resolutions are preferred to reduce the size of the result set and the impact of outliers.\n\nResult sets will include one row per interval per zone, and are ordered by the `start_timestamp` of the interval. Given a resolution of `15m` and an interval timestamp of 3:00 PM, the `mean_occupancy` and `peak_occupancy` is the average and maximum occupancy from 3:00 PM (inclusive) to 3:15 PM (exclusive). \n\nThe `mean_utilization` and `peak_utilization` fields are derived from the respective occupancy values divided by the asset's `capacity`. Both fields are `null` when capacity is not configured for the asset. `capacity` and both utilization fields are also `null` on rows in buildings your credentials have not been granted capacity access to.\n\nCurrently all results are returned in a single page. The API rejects requests if the time range is too large for the selected resolution. Valid time ranges based on resolution are:\n- 4 days at `5m`\n- 10 days at `10m`\n- 2 weeks at `15m`\n- 1 month at `30m`\n- 2 months at `1h`\n- 1 year at `6h`\n- 4 years at `1d`\n\nIntervals are aligned to a fixed grid rather than to `start` — to the Unix epoch in UTC by default, or to local midnight when `bucket_timezone` is given. `start` is floored to the interval boundary at or before it, so a request beginning at 8:00 AM with `1d` resolution reports an interval stamped 12:00 AM. At the other end, the last interval reported is the last one ending at or before `end`; an interval that would run past `end` is dropped by default, with one exception described below. `partial_buckets` changes this: see that parameter.\n\nOccupancy is aggregated only over data from `start` (inclusive) to `end` (exclusive). Combined with that alignment, this means the first interval of the series covers only the part of itself inside the requested range whenever `start` does not fall on an interval boundary. Such an interval is *partial*, and nothing in the row says so — `start_timestamp`, the occupancy and utilization fields, and the row shape are identical to a whole interval's. Treating one as representing its full labelled period, by averaging it in with whole intervals or reporting it as a whole day or hour, misstates the result. Compare `start` and `end` against the resolution to identify it, or pass `partial_buckets=none` to receive whole intervals only.\n\nA time range narrower than the resolution is answered rather than rejected. Where the whole range falls inside a single interval — `1d` resolution from 8:00 AM to 12:00 PM, or from 12:00 AM to 11:59:59 PM — the response is one row, stamped at that interval's start, aggregating only the hours requested (with `partial_buckets=none` it is an empty `results` array). It is the caller's responsibility to recognise that such a row does not cover the period its `start_timestamp` names. To obtain a whole interval instead, use a resolution no longer than the range, or move `end` past the next interval boundary — bearing in mind that an interval still in progress is itself partial until it closes, and that occupancy lags real time (see below).\n\nIn addition to the resolution/time range constraints, responses are limited to a maximum of 3 million rows. Response bodies larger than the row limit are truncated, dropping more recent data (based on ordering).\n\nHTTP compression is enabled for responses larger than 500 bytes when the request includes `\"gzip\"` in the `Accept-Encoding` header.\n\nPlease note that Lambent Spaces does not produce occupancy in real time. Occupancies for a given time period may be delayed from 30 minutes to an hour, and this may be further increased due to ingestion lag or data availability from Wi-Fi source systems.\n\nThe zone occupancy endpoint is rate-limited to 60 requests per minute.\n",
        "operationId": "v1_zone_occupancy_v1_occupancy_zone_get",
        "security": [
          {
            "HTTPBearer": []
          },
          {
            "APIKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "start",
            "description": "The beginning of the queried interval (inclusive). An absolute timestamp in ISO 8601 format, a relative duration from now (e.g., '-3h'), or 'now'.\n",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "-3.5h"
            },
            "examples": {
              "relative_minutes": {
                "value": "-60min"
              },
              "relative_hours": {
                "value": "-3.5h"
              },
              "iso8601": {
                "value": "2024-02-22T14:30:00Z"
              },
              "now": {
                "value": "now"
              }
            }
          },
          {
            "name": "end",
            "description": "The end of the queried interval (exclusive). An absolute timestamp in ISO 8601 format, a relative duration from now (e.g., '-3h'), or 'now'. Only intervals ending at or before this value are reported, except where the range is narrower than one interval — see the endpoint description.\n",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "-30min"
            },
            "examples": {
              "relative_minutes": {
                "value": "-30min"
              },
              "relative_hours": {
                "value": "-3.5h"
              },
              "iso8601": {
                "value": "2024-02-22T14:30:00Z"
              },
              "now": {
                "value": "now"
              }
            }
          },
          {
            "name": "tenant_id",
            "description": "ID of tenant (customer account) to query. A string in UUID format. If available, the Tenant ID associated with your API credentials is used by default.",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Tenant ID"
            }
          },
          {
            "name": "resolution",
            "description": "The size of the time intervals within the provided time range",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/Resolution",
              "default": "30m",
              "title": "Resolution"
            },
            "example": "15m"
          },
          {
            "name": "bucket_timezone",
            "description": "Optional IANA time zone name. When omitted, intervals are aligned to the Unix epoch in UTC. When given, intervals are aligned to that zone's local clock instead, so a `1d` interval starts at local midnight rather than UTC midnight. The value is applied to every asset in the request, so a request spanning buildings in different zones should be split into one request per zone.\n",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "America/New_York"
          },
          {
            "name": "partial_buckets",
            "description": "Which intervals cut by the ends of the range are reported. Every interval is labelled with its grid-aligned start but aggregates only the data inside `[start, end)`, so an interval at either end of the range can cover less time than its label says. `leading` (the default) reports the interval containing `start` and drops the one containing `end`. `both` also reports the interval containing the last instant before `end`, so the caller receives every interval the range touches and nothing outside it; both edge intervals may then be partial. `none` reports only intervals lying wholly inside the range; a range too short to hold one returns an empty `results` array.\n",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "leading",
                "both",
                "none"
              ],
              "default": "leading"
            },
            "example": "both"
          },
          {
            "name": "zone_ids",
            "description": "List of zone IDs to filter for, if none are passed, endpoint queries for all zone IDs in tenant. A list of strings in UUID format.",
            "in": "query",
            "required": false,
            "schema": {
              "items": {
                "type": "string"
              },
              "type": "array",
              "title": "Zone IDs"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ZoneOccupancyResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request: no tenant ID could be determined from the request or the credentials, or both an `Authorization` header and an `X-API-Key` header were sent. Send one or the other.\n"
          },
          "401": {
            "description": "Missing or invalid credentials: no token or key, an invalid or expired token, or an API key that isn't recognised or has been revoked (`Invalid API key`) or is past its expiration date (`API key has expired`).\n"
          },
          "403": {
            "description": "The credentials are valid but don't grant this data: a tenant ID other than your organization's, or no access to the Analyze API or to occupancy data for any building. Contact Lambent to change what your credentials can access.\n"
          },
          "422": {
            "description": "Invalid parameters: for example an unparseable time, a time range too long for the resolution, or an unrecognised `bucket_timezone`.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. The limit is 60 per minute; wait before retrying."
          },
          "500": {
            "description": "An unexpected error on our side. Retry, and contact Lambent if it persists."
          },
          "503": {
            "description": "The credentials couldn't be verified right now (`Unable to verify token`, `Unable to verify access` or `Unable to verify API key`). They may well be valid, so retry after the number of seconds in the `Retry-After` header rather than requesting new ones.\n"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "ZoneOccupancyResponse": {
        "properties": {
          "results": {
            "items": {
              "$ref": "#/components/schemas/ZoneOccupancyRow"
            },
            "type": "array",
            "title": "Results"
          }
        },
        "type": "object",
        "required": [
          "results"
        ],
        "title": "ZoneOccupancyResponse"
      },
      "ZoneOccupancyRow": {
        "properties": {
          "tenant_id": {
            "type": "string",
            "format": "uuid",
            "title": "Tenant Id"
          },
          "level_id": {
            "type": "string",
            "format": "uuid",
            "title": "Level Id"
          },
          "level_name": {
            "type": "string",
            "title": "Level Name"
          },
          "zone_id": {
            "type": "string",
            "format": "uuid",
            "title": "Zone Id"
          },
          "zone_name": {
            "type": "string",
            "title": "Zone Name"
          },
          "building_id": {
            "type": "string",
            "format": "uuid",
            "title": "Building Id"
          },
          "building_name": {
            "type": "string",
            "title": "Building Name"
          },
          "start_timestamp": {
            "type": "string",
            "format": "date-time",
            "title": "Start Timestamp"
          },
          "mean_occupancy": {
            "type": "number",
            "title": "Mean Occupancy",
            "description": "Mean occupancy over the time interval"
          },
          "mean_utilization": {
            "type": "number",
            "title": "Mean Utilization",
            "description": "Mean occupancy divided by capacity over the time interval. Null if capacity is not set or not visible to the caller."
          },
          "peak_occupancy": {
            "type": "number",
            "title": "Peak Occupancy",
            "description": "Maximum occupancy over the time interval"
          },
          "peak_utilization": {
            "type": "number",
            "title": "Peak Utilization",
            "description": "Peak occupancy divided by capacity over the time interval. Null if capacity is not set or not visible to the caller."
          },
          "capacity": {
            "type": "number",
            "title": "Zone Capacity",
            "description": "The zone's capacity. Null if not set or not visible to the caller."
          }
        },
        "type": "object",
        "required": [
          "tenant_id",
          "level_id",
          "level_name",
          "zone_id",
          "zone_name",
          "building_id",
          "building_name",
          "start_timestamp"
        ],
        "title": "ZoneOccupancyRow"
      },
      "Resolution": {
        "type": "string",
        "description": "Interval size. Where bucket boundaries fall depends on `bucket_timezone`: with it omitted, buckets are aligned to the Unix epoch in UTC, so `1d` runs from UTC midnight rather than local midnight; use the coarse values to compare one period with another, not for questions about a particular local day, since the offset moves hours between days. With `bucket_timezone` set, buckets follow that zone's local clock and `1d` is a local day. Either way a coarse interval cannot answer a question about time of day; use `1h` or finer.\n\nA time range narrower than one interval is not rejected. It is answered with a single interval, stamped at that interval's start, covering only the requested part of it.\n",
        "enum": [
          "5m",
          "10m",
          "15m",
          "30m",
          "1h",
          "6h",
          "1d"
        ],
        "title": "Resolution"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      }
    },
    "securitySchemes": {
      "HTTPBearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "An access token for the Lambent Spaces API, sent as `Authorization: Bearer <token>`. See Authenticating for how to obtain one.\n"
      },
      "APIKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key",
        "description": "An API key issued by Lambent for your organization, sent as `X-API-Key: <key>`. A key can read only the buildings and data it has been granted, and stops working at its expiration date, or within a minute of being revoked. Send either an API key or a bearer token, not both.\n"
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "_id": {
    "buffer": {
      "0": 101,
      "1": 215,
      "2": 96,
      "3": 42,
      "4": 26,
      "5": 127,
      "6": 152,
      "7": 0,
      "8": 98,
      "9": 160,
      "10": 213,
      "11": 54
    }
  }
}
```