Query group statistics
const url = 'http://localhost:3000/api/v1/groups/query';const options = { method: 'POST', headers: {'X-API-Key': '<X-API-Key>', 'Content-Type': 'application/json'}, body: '{"labelSelector":{"environment":"production","region":"us-west"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:3000/api/v1/groups/query \ --header 'Content-Type: application/json' \ --header 'X-API-Key: <X-API-Key>' \ --data '{ "labelSelector": { "environment": "production", "region": "us-west" } }'Retrieves statistics for devices matching a label selector.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”UUID of the organization (tenant) the request acts in. It selects the tenant and grants nothing: the server checks membership or an open tenant switch. Not needed for global operations. A malformed value returns 400. API keys are fixed to their own organization; another organization returns 403. The x-organization-source header grants nothing.
Request Bodyrequired
Section titled “Request Bodyrequired”object
Label selector: exact key/value pairs, all of which must match (AND). 1-20 entries, keys 1-253 and values up to 253 characters, string values only, no control characters. An empty selector is rejected with 400; use GET /api/v1/groups/stats for the whole fleet.
object
Example
{ "environment": "production", "region": "us-west"}Responses
Section titled “Responses”Group statistics retrieved successfully
object
Total number of matching devices
Status breakdown of matching devices
object
Number of online devices
Number of offline devices
Number of pending devices
Number of devices in error state
The label selector used for filtering
object
Example
{ "total": 25, "byStatus": { "online": 45, "offline": 5, "pending": 2, "error": 1 }, "labelSelector": { "environment": "production" }}LabelSelector is missing, empty or not a valid label selector
Unauthorized
Forbidden — caller lacks required permission