Reporting API Overview
The Butlr Reporting API is a RESTful API designed to provide time-series occupancy data, making it ideal for analyzing historical trends in space utilization. This API is optimized for standardized reporting, enabling users to aggregate data across floors, rooms, or zones to manage and optimize physical spaces efficiently. Use this API to track occupancy patterns over time or analyze historical trends, enabling data-driven decisions that enhance space management strategies.

Best Practices for Using Reporting API v3
When using the Reporting API v3, adhering to the recommended practices ensures data accuracy and provides meaningful insights. Proper configuration of parameters such as windowing functions, timezones, and filters directly impacts the granularity and relevance of your results.
Example Query
The following example demonstrates how to retrieve traffic-based floor occupancy data using the Reporting API.
POST https://api.butlr.io/api/v3/reporting
Key Parameters
Window Parameters:
"every": "1h": Specifies a 1-hour window size."function": "sum": Aggregates the total entries and exits during each 1-hour window."timezone": "America/New_York": Local timezone of the space."fill": { "value": 0 }: Returns 0 for periods with no data instead of omitting them. Fill applies once the query returns at least one data point for the series — a range with no data at all returns an empty response. (create_emptyon its own has no effect.)
Filter Parameters:
"start": "2024-01-01T04:00:00": The start time of the query period in the specified timezone."stop": "2024-01-02T04:00:00": The end time of the query period."measurements": ["traffic_floor_occupancy"]: Specifies the metric to retrieve."spaces": {"eq": ["space_XXXX"]}: Filters the query to the specific floor (replacespace_XXXXwith the floor ID)."value": { "gte": 0 }: Ensures zero values are included in the results.
Group By:
"order": ["time"]: Groups and orders results by the specified time intervals.
Customizing Your Queries
Window Size: Adjust
"every": "1h"to smaller intervals like"5m"or"1m"for more granular data.Aggregation Function:
Use
"max"for occupancy metrics to capture peak values within a time range.Use
"mean"for average occupancy within a time range.Use
"sum"for traffic metrics to calculate total flow within a time range.
Measurements: Replace
"traffic_floor_occupancy"with other metrics, such as"room_occupancy"or"zone_occupancy", depending on the desired level of granularity and deployed sensor mode.Time Range: Modify
"start"and"stop"to align with your analysis period.
Pagination
Add a top-level paginate object to receive the result in pages. page starts at 1; limit is the number of rows per page.
The response carries a page_info object alongside data:
To fetch the rest, send the same request body again with page incremented until page equals total_pages. A page past total_pages returns an empty data array. Without paginate, the whole result is returned at once and page_info reports total_pages: 1.
Each page re-runs the full query on the server, so pagination keeps each response small but does not make the query cheaper. Narrowing the time range or the spatial filter is still the first choice. See Query Limits for the per-response size limit that pagination helps you stay under.
Last updated