Get group statistics via query params
const url = 'http://localhost:3000/api/v1/groups/query';const options = {method: 'GET', headers: {'X-API-Key': '<X-API-Key>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url http://localhost:3000/api/v1/groups/query \ --header 'X-API-Key: <X-API-Key>'Retrieves statistics for devices matching label query parameters. Pass label key-value pairs as query parameters (e.g., ?env=prod®ion=us-east). Reserved keys limit and offset are excluded from label matching and must be non-negative integers. The pairs must form a valid label selector: 1-20 pairs, one value per key, keys 1-253 and values up to 253 characters, no control characters. An empty selector is rejected with 400; use GET /api/v1/groups/stats for the whole fleet.
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.
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" }}The query parameters do not form a valid, non-empty label selector
Unauthorized
Forbidden — caller lacks required permission