---
title: "Collect devices"
method: POST
path: "/v1/device/query"
tags: ["Device"]
---

# Collect devices

`POST /v1/device/query`

Get all (or some of) the devices which are monitored by roles of which the user is a member

## Request body

- object — Filters on which devices should be returned, the returned device properties and a skipHash field to avoid unnecessary data transfer.
  - `skipHash` string — Before sending a reply, a base64 encoded sha256 digest is calculated by sorting the devices by id and updating the hash with the lastUpdate properties of each of the devices. When the digest matches this property, code 204 with an empty response is returned.
  - `fields` string[] — Only return the specified device fields. If no fields are specified, all device fields are returned.
  - `filter` object — Indexed filters for which matching devices are returned
    - `id` integer[] — Only return devices with one of the specified ids
    - `nodeId` string[] — Only return devices with one of the specified node ids
    - `nodeType` string[] — Only return devices with one of the specified node types
    - `viewId` integer[] — Only return those devices which are monitored by roles with access to a specific view
    - `roleId` integer[] — Only return devices which are directly or indirectly monitored by one of the specified role ids. Prefer the companyId filter
    - `companyId` integer[] — Only return devices which are directly or indirectly monitored by one of the specified company ids
    - `isActive` boolean — Only return devices which are active or inactive
  - `conditions` object — Non-indexed filters on which matching devices are returned. The conditions can only be applied to properties which the user can see. These filters are applied on the application layer and are rather expensive.

## Response `200`

An array with the filtered devices. For each device, the readable and editable properties of the device are returned, as well as information regarding the editabilities of those properties and whether the user has monitorManagement rights for the device. If the fields property was specified, only those device properties which were listed are returned.

- object
  - `device` Def8[]
    - `id` integer, required — Id of the device
    - `lastUpdate` string, required — Last update of the device in server time, formatted as an ISO 8601 string
    - `properties` object, required
    - `userRights` object, required — An object specifying which device properties a user may view or edit
      - `propertyEditabilities` object, required
      - `monitorManagement` boolean, required

## Other responses

- `204` — This is returned when skipHash is provided and the provided hash matches the current hash calculated using the lastUpdate properties of the selected devices
- `400` — Invalidly formatted body
- `401` — Authentication required or token invalid

---

[API](https://skmtc.dev/eniris/apis/eniris-metadata-telemetry-query-api.md) · [All operations](https://skmtc.dev/eniris/apis/eniris-metadata-telemetry-query-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/eniris/eniris-metadata-telemetry-query-api/revisions/fe3723575e19/schema)
