Download OpenAPI specification:Download
v2 APIs v2/spaces, v2/hives, v2/sensors, and all subresources of these 3 endpoints will reach its end-of-life on Friday, October 11th, 2024. PLEASE NOTE ALL LOGIN, REPORTING, and DETECTIONS endpoints will remain functional. All listed endpoints will continue to be supported!
Fixtures as an object and subresource of floors (formerly known as spaces) will reach its end-of-life on Friday, September 20th, 2024. There is no replacement functionality for this as it was a feature of our previous installation tool, also deprecated early in 2024.
Documentation: https://docs.butlr.io/graphql
We would like to inform you that a large portion of our APIs will eventually be deprecated in favor of Butlr's new GraphQL API. We kindly request you to please refer to the documentation available at https://docs.butlr.io/graphql for the GraphQL schema.
We believe that this transition to GraphQL will be a significant improvement for our users. GraphQL provides a more efficient and flexible way of querying data from the server compared to traditional REST APIs. With GraphQL, you can specify exactly what data you need and receive only that data, reducing the amount of data transfer and improving the overall performance of your application.
In addition, GraphQL allows for easier versioning of APIs. As your application evolves, you can modify the GraphQL schema without breaking existing client code, enabling you to make changes to your backend without disrupting your users.
We encourage you to start migrating to our new GraphQL API and explore the benefits it has to offer. If you have any questions or concerns, please don't hesitate to contact our support team.
The butlr API (v2) is organized around REST. The API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.
Resources always have a primary identifier which is the resource type followed by an underscore and a random alpha-numeric string generated by the API at creation time:
Examples:
sensor_1pSzBqzDXWA1W0orILZbfTA71Ak
hive_1pSzJPFUdkjraoJeqMz2wEWSfX8
space_1pSzKM2HKhSHsZ2vBclvMFrUKcZ
Some resource types have additional secondary identifiers. Sensors can also be looked up using their MAC Address, while Hives can be identified by their serial number (printed on the device).
Examples:
00-60-2F-57-04-BC
- sensor Address65fefe57f497d2f6
- hive serial numberThe Butlr Heatic Sesnor is a battery-powered unit which captures thermal data and sends it to the Hive via local wireless mesh network.
A Butlr Hive is the "base station" of our system. The Hive is the intermediary between the sensors (which communicate on a local mesh network) and Butlr services. Butlr Heatic Sensors connect to the Hive, which passes the sensor data via the internet to the Butlr ecosystem.
Authentication and authorization uses JWT's (https://jwt.io/introduction).
Learn about OAuth2.0 Client Credentials Grant
curl --location --request POST 'https://api.butlr.io/api/v2/clients/login' \
--header 'Content-Type: application/json' \
--data-raw '{
"client_id": "CLIENT_ID",
"client_secret": "CLIENT_SECRET",
"audience": "https://butlrauth/",
"grant_type": "client_credentials"
}'
NOTE: If you don't know your CLIENT_ID
and CLIENT_SECRET
, please reach out to support@butlr.io
access_token
field in the response to hit the Butlr API.curl --request GET \
--url https://api.butlr.io/api/v2/spaces \
--header 'Authorization: Bearer {access_token}'
For example, if the access token is abc.123.def
the request should be
curl --request GET \
--url https://api.butlr.io/api/v2/spaces \
--header 'Authorization: Bearer abc.123.def'
Unlike some other OAuth2.0 flows, the Client Credentials flow does not provide a refresh token. Simply repeat Step 1 and 2 to get a new token. We suggest you avoid doing this on every request to prevent performance issues and throttling.
Security Scheme Type | HTTP |
---|---|
HTTP Authorization Scheme | bearer |
Bearer format | "JWT" |
User login password
grant flow. This API will return the set of tokens (access_token
, id_token
, refresh_token
) given a proper username & password.
password required | string <password> |
username required | string <email> |
access_token | string |
expires_in | number |
id_token | string |
refresh_token | string |
scope | string |
token_type | string |
{- "username": "your_email@butlr.io",
- "password": "123!"
}
{- "access_token": "adksiek******.***********.********",
- "refresh_token": "v1.************",
- "id_token": "3904fjkd********.******.*****",
- "scope": "openid email profile offline_access",
- "expires_in": 86400,
- "token_type": "Bearer"
}
Given a proper refresh_token
and client_id
, you will get back an new set of access_token
/ refresh_token
/ id_token
. Call this API when your access_token
has expired.
The client_id
can be found inside the access_token.azp
claim.
client_id required | string |
refresh_token required | string |
access_token | string |
expires_in | integer |
id_token | string |
refresh_token | string |
scope | string |
token_type | string |
{- "refresh_token": "v1.MlbvM7oBuuAlsbsaf23asdfasdf234asdfgk-ggae89oikjasdfLFKJDFH",
- "client_id": "c9023dlDKLFJKPdckspoek229KJD"
}
{- "access_token": "adksiek******.***********.********",
- "refresh_token": "v1.************",
- "id_token": "3904fjkd********.******.*****",
- "scope": "openid email profile offline_access",
- "expires_in": 86400,
- "token_type": "Bearer"
}
M2M Client Authentication Endpoint
Accepts ClientID, Client Secret, Audience, and GrantType exactly as auth0's oauth/token endpoint does.
Returns AccessToken, ExpiresIn, Scope, and Token Type
POST /clients/login Request Body
audience | string |
client_id | string |
client_secret | string |
grant_type | string |
access_token | string |
expires_in | integer |
scope | string |
token_type | string |
{- "client_id": "string",
- "client_secret": "string",
- "audience": "string",
- "grant_type": "string"
}
{- "access_token": "string",
- "scope": "string",
- "expires_in": 0,
- "token_type": "string"
}
The /reporting
endpoint is only accessible via api/v3
.
Customize data aggregation by filtering (filter), grouping order (group_by) and results aggregation time window (window).
required | object |
object | |
object | |
object |
data | object |
Array of objects |
{- "group_by": {
- "order": [
- "space_id",
- "field"
]
}, - "window": {
- "every": "5m",
- "function": "max"
}, - "filter": {
- "start": "-1d"
}
}
{- "data": {
- "occupancy": {
- "sum": 26,
- "min": 1,
- "max": 3,
- "count": 12,
- "mean": 2.1666666666666665,
- "median": 3,
- "stddev": 0.7993052538854533
}
}
}
Returns historical detection points per sensor mac_address given a period of time and an interval window. Within an interval window, a data point will be returned based on specified function.
/streams
api that has been deprecated/v3
data_types required | Array of strings Items Enum: "detections_local" "detections_world" "heatmap" |
required | object |
object |
{- "data_types": [
- "detections_local"
], - "filter": {
- "start": "string",
- "stop": "string",
- "omit_empty_value": true,
- "space_id": "string",
- "room_id": "string",
- "mac_addresses": [
- "string"
]
}, - "window": {
- "every": "string",
- "function": "string"
}
}
{- "detections_local": [
- {
- "start_time": 1667888615000,
- "sample_time": 1667888615900,
- "mac_address": "00-17-0d-00-00-xx-xx-xx",
- "value": [
- [
- 0.38257575757575757,
- 0.4242424242424242
], - [
- 0.5625,
- 0.9375
]
]
}, - {
- "start_time": 1667888615000,
- "sample_time": 1667888615900,
- "mac_address": "00-17-0d-11-11-xx-xx-xx",
- "value": [
- [
- 0.345,
- 0.678
]
]
}
]
}