Density Public API (beta)

Download OpenAPI specification:Download

This service provides a layer of abstraction on top of the Density data API's.

It is intended for use by the general public.

Metrics

Floor Data Completion Status

Lists the percentage of completeness of floor data over the specified time period from [0-1]. Data Status API is available for floors with Open Area Sensors. With this information, you can determine whether historical metric data is ready to pull for the floor and spaces on the floor during the requested time period. For more information on how to interpret this data see: https://developers.density.io/understand_historical_data.

Request
Request Body schema: application/json
required

Request body input.

end_date
required
string

end of the query date range, inclusive. Must be after 2024-06-01T00:00:00Z.

floor_ids
Array of strings
start_date
required
string

start of the query date range, max range is 10 days, min range is 5 minutes.

Responses
200

success

post/v3/analytics/data-status
Request samples
application/json
{
  • "end_date": "2024-06-28T23:59:59Z",
  • "floor_ids": [
    ],
  • "start_date": "2024-06-28T00:00:00Z"
}
Response samples
application/json
{
  • "spc_10987654321": {
    },
  • "spc_12345678901": {
    }
}

Occupancy

Calculates the occupancy for a set of spaces or for all spaces in a portfolio.

SecurityapiKey or application
Request
Request Body schema: application/json
required

request body input

end_date
required
string

end of the query date range, inclusive

space_ids
Array of strings

specific spaces to query

start_date
required
string

start of the query date range

time_resolution
string
Default: "total"

time resolution for the query results

Enum: "total" "hour" "day" "week" "month" "year" "weekday" "hour_of_day" "minute" "10minute"
Responses
200

success

400

request data was missing or invalid

401

unable to authorize the given bearer token

403

access to this api is not allowed

404

resource not found

500

unexpected error

post/v3/analytics/occupancy
Request samples
application/json
{
  • "end_date": "2024-02-28T23:59:59Z",
  • "space_ids": [
    ],
  • "start_date": "2024-02-28T00:00:00Z",
  • "time_resolution": "total"
}
Response samples
application/json
{
  • "spc_10987654321": {
    },
  • "spc_12345678901": {
    }
}

Time Used

Calculates the time used for a set of spaces or for all spaces in a portfolio.

SecurityapiKey or application
Request
Request Body schema: application/json
required

request body input

end_date
required
string

end of the query date range, inclusive

space_ids
Array of strings

specific spaces to query

start_date
required
string

start of the query date range

time_resolution
string
Default: "total"

time resolution for the query results

Enum: "total" "hour" "day" "week" "month" "year" "weekday" "hour_of_day" "minute" "10minute"
Responses
200

success

400

request data was missing or invalid

401

unable to authorize the given bearer token

403

access to this api is not allowed

404

resource not found

500

unexpected error

post/v3/analytics/time-used
Request samples
application/json
{
  • "end_date": "2024-02-28T23:59:59Z",
  • "space_ids": [
    ],
  • "start_date": "2024-02-28T00:00:00Z",
  • "time_resolution": "total"
}
Response samples
application/json
{
  • "spc_10987654321": {
    },
  • "spc_12345678901": {
    }
}

Utilization

Calculates the utilization for a set of spaces or for all spaces in a portfolio.

SecurityapiKey or application
Request
Request Body schema: application/json
required

request body input

end_date
required
string

end of the query date range, inclusive

space_ids
Array of strings

specific spaces to query

start_date
required
string

start of the query date range

time_resolution
string
Default: "total"

time resolution for the query results

Enum: "total" "hour" "day" "week" "month" "year" "weekday" "hour_of_day" "minute" "10minute"
Responses
200

success

400

request data was missing or invalid

401

unable to authorize the given bearer token

403

access to this api is not allowed

404

resource not found

500

unexpected error

post/v3/analytics/utilization
Request samples
application/json
{
  • "end_date": "2024-02-28T23:59:59Z",
  • "space_ids": [
    ],
  • "start_date": "2024-02-28T00:00:00Z",
  • "time_resolution": "total"
}
Response samples
application/json
{
  • "spc_10987654321": {
    },
  • "spc_12345678901": {
    }
}

Live

Current Occupancy

Returns the most current occupancy for a set of spaces or for all spaces in a portfolio. Only entry spaces are supported.

SecurityapiKey or application
Request
Request Body schema: application/json
required

request body input

space_ids
Array of strings

specific spaces to query

Responses
200

success

401

unable to authorize the given bearer token

403

access to this api is not allowed

500

unexpected error

post/v3/analytics/occupancy/current
Request samples
application/json
{
  • "space_ids": [
    ]
}
Response samples
application/json
{
  • "spc_10987654321": {
    },
  • "spc_12345678901": {
    }
}

Presence

Returns the current occupied status for a set of spaces or for all spaces in a portfolio.

SecurityapiKey or application
Request
Request Body schema: application/json
required

request body input

space_ids
Array of strings

specific spaces to query

Responses
200

success

401

unable to authorize the given bearer token

403

access to this api is not allowed

500

unexpected error

post/v3/analytics/presence
Request samples
application/json
{
  • "space_ids": [
    ]
}
Response samples
application/json
{
  • "spc_10987654321": false,
  • "spc_12345678901": true
}

Health Aware Presence

Returns the current occupied and space health status for a set of spaces or for all spaces in a portfolio.

SecurityapiKey or application
Request
Request Body schema: application/json
required

request body input

space_ids
Array of strings

specific spaces to query

Responses
200

success

401

unable to authorize the given bearer token

403

access to this api is not allowed

500

unexpected error

post/v3/analytics/presence-health
Request samples
application/json
{
  • "space_ids": [
    ]
}
Response samples
application/json
{
  • "spc_10987654321": {
    },
  • "spc_12345678901": {
    }
}

Short-Term Analytics

Determines short-term Presence for a set of spaces or for all spaces in an organization. Only OA spaces and floors are supported.

SecurityapiKey or application
Request
Request Body schema: application/json
required

request body input

minutes_lookback
integer <uint32>
Default: 0

the length of time in minutes for which historical presence information will be fetched. 0 value will return the current minute. 5 will return the current minute, plus 5 mins before. Max value is 240 minutes.

space_ids
Array of strings

specific spaces to query. Only areas and floors will be processed.

Responses
200

success

400

request data was missing or invalid

401

unable to authorize the given bearer token

403

access to this api is not allowed

404

resource not found

500

unexpected error

post/v3/analytics/short-term
Request samples
application/json
{
  • "minutes_lookback": 60,
  • "space_ids": [
    ]
}
Response samples
application/json
{
  • "data": [
    ]
}

Create Presence WebSocket

Returns a WebSocket endpoint to receive presence messages for spaces on a floor. See https://developers.density.io/websockets for websocket payload details.

SecurityapiKey or application
Request
path Parameters
floor_id
required
string

space id for a floor.

Responses
200

success

400

BadRequestError is an error returned when the request is malformed or invalid.

401

UnauthorizedError is an error returned when the request is unauthorized.

403

ForbiddenError is an error returned when the request is forbidden.

404

NotFoundError is an error returned when the requested resource is not found.

500

InternalServerError is an error returned when the server encounters an error.

post/v3/analytics/ws/floor/{floor_id}/presence
Request samples
Response samples
application/json
{
  • "ws_url": "string"
}

Create Entry occupancy WebSocket

Returns a WebSocket endpoint to receive count updates for a space and its children with entry sensors. See https://developers.density.io/websockets for websocket payload details.

SecurityapiKey or application
Request
path Parameters
space_id
required
string

space id of a space node to query.

Responses
200

success

400

BadRequestError is an error returned when the request is malformed or invalid.

401

UnauthorizedError is an error returned when the request is unauthorized.

403

ForbiddenError is an error returned when the request is forbidden.

404

NotFoundError is an error returned when the requested resource is not found.

500

InternalServerError is an error returned when the server encounters an error.

post/v3/analytics/ws/space/{space_id}/occupancy
Request samples
Response samples
application/json
{
  • "ws_url": "string"
}

Info

Hello World

Validate your access to the Density public API.

Responses
200

success

401

unable to authorize the given bearer token

403

access to this api is not allowed

get/v3/hello-world
Request samples
Response samples
text/plain
Do… or do not. There is no try. - Yoda

API Version

API version.

Responses
200

success

401

unable to authorize the given bearer token

403

access to this api is not allowed

get/version
Request samples
Response samples
text/plain
1.0.2

Auth

Density Access Token

OAuth token flow for machine-to-machine users. Generate an access token using client credentials.

Request
Request Body schema: application/json
required

request body input

client_id
required
string
client_secret
required
string
grant_type
required
string
Value: "client_credentials"
Responses
200

success

400

bad request

401

unable to authorize client

500

unexpected error

post/v3/oauth/token
Request samples
application/json
{
  • "client_id": "string",
  • "client_secret": "string",
  • "grant_type": "client_credentials"
}
Response samples
application/json
{
  • "access_token": "string",
  • "expires_in": "string",
  • "token_type": "string"
}

Sensors

Sensors

Lists sensors

Request
Request Body schema: application/json
required

Request body input. Can filter by either serial numbers or space ids.

serial_numbers
Array of strings
space_ids
Array of strings
Responses
200

success

400

BadRequestError is an error returned when the request is malformed or invalid.

401

UnauthorizedError is an error returned when the request is unauthorized.

403

ForbiddenError is an error returned when the request is forbidden.

404

NotFoundError is an error returned when the requested resource is not found.

500

InternalServerError is an error returned when the server encounters an error.

post/v3/sensors
Request samples
application/json
{
  • "serial_numbers": [
    ],
  • "space_ids": [
    ]
}
Response samples
application/json
[
  • {
    }
]

Historical Sensor Health

Lists sensor health changes over the requested period of time.

Request
Request Body schema: application/json
required

Request body input. Can filter by either serial numbers or space ids.

end_date
required
string

end of the query date range, inclusive

serial_numbers
Array of strings
space_ids
Array of strings
start_date
required
string

start of the query date range, max range is 10 days

Responses
200

success

post/v3/sensors/health
Request samples
application/json
{
  • "end_date": "2024-02-28T23:59:59Z",
  • "serial_numbers": [
    ],
  • "space_ids": [
    ],
  • "start_date": "2024-02-28T00:00:00Z"
}
Response samples
application/json
{
  • "A1B6Z10": [
    ]
}

Current Sensor Health

Lists sensor current health

Request
Request Body schema: application/json
required

Request body input. Can filter by either serial numbers or space ids.

serial_numbers
Array of strings
space_ids
Array of strings
Responses
200

success

400

BadRequestError is an error returned when the request is malformed or invalid.

401

UnauthorizedError is an error returned when the request is unauthorized.

403

ForbiddenError is an error returned when the request is forbidden.

404

NotFoundError is an error returned when the requested resource is not found.

500

InternalServerError is an error returned when the server encounters an error.

post/v3/sensors/health/current
Request samples
application/json
{
  • "serial_numbers": [
    ],
  • "space_ids": [
    ]
}
Response samples
application/json
{
  • "data": [
    ]
}

Spaces

Spaces

Get all spaces for an organization.

SecurityapiKey or application
Responses
200

success

401

unable to authorize the given bearer token

403

access to this api is not allowed

500

unexpected error

get/v3/spaces
Request samples
Response samples
application/json
[
  • {
    }
]

Users

Read Users

Read a list of users in your organization. Only available for Machine to Machine tokens with correct permissions.

SecurityapiKey or application
Responses
200

success

400

bad request

401

unable to authorize client

403

forbidden

500

unexpected error

get/v3/users
Request samples
Response samples
application/json
[
  • {
    }
]

Create User

Create a user. Only available for Machine to Machine tokens with correct permissions.

SecurityapiKey or application
Request
Request Body schema: application/json
required

request body input

email
string
full_name
string
role
string

role for the user

Enum: "owner" "admin" "editor" "readonly"
spaces
Array of strings
Responses
201

success

400

bad request

401

unable to authorize client

403

forbidden

500

unexpected error

post/v3/users
Request samples
application/json
{
  • "email": "string",
  • "full_name": "string",
  • "role": "owner",
  • "spaces": [
    ]
}
Response samples
application/json
{
  • "created_at": "2019-08-24T14:15:22Z",
  • "email": "string",
  • "full_name": "string",
  • "id": "string",
  • "role": "owner",
  • "spaces": [
    ]
}

Delete User

Delete user. Only available for Machine to Machine tokens with correct permissions.

SecurityapiKey or application
Responses
204

success

400

bad request

401

unable to authorize client

403

forbidden

500

unexpected error

delete/v3/users/:user_id
Request samples
Response samples
application/json
{
  • "code": 0,
  • "message": "string"
}

Read User

Read a user in your organization. Only available for Machine to Machine tokens with correct permissions.

SecurityapiKey or application
Responses
200

success

400

bad request

401

unable to authorize client

403

forbidden

500

unexpected error

get/v3/users/:user_id
Request samples
Response samples
application/json
{
  • "created_at": "2019-08-24T14:15:22Z",
  • "email": "string",
  • "full_name": "string",
  • "id": "string",
  • "role": "owner",
  • "spaces": [
    ]
}

Update User

Update user role, name, or spaces. Only available for Machine to Machine tokens with correct permissions.

SecurityapiKey or application
Request
Request Body schema: application/json
required

request body input

full_name
string
role
string

role for the user

Enum: "owner" "admin" "editor" "readonly"
spaces
Array of strings
Responses
200

success

400

bad request

401

unable to authorize client

403

forbidden

500

unexpected error

put/v3/users/:user_id
Request samples
application/json
{
  • "full_name": "string",
  • "role": "owner",
  • "spaces": [
    ]
}
Response samples
application/json
{
  • "created_at": "2019-08-24T14:15:22Z",
  • "email": "string",
  • "full_name": "string",
  • "id": "string",
  • "role": "owner",
  • "spaces": [
    ]
}