Get fleet statistics
const url = 'http://localhost:3000/api/v1/groups/stats';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/stats \ --header 'X-API-Key: <X-API-Key>'Retrieves fleet-wide statistics including device counts and available label keys.
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”Fleet statistics retrieved successfully
object
Total number of devices in the fleet
Status breakdown of all devices
object
Number of online devices
Number of offline devices
Number of pending devices
Number of devices in error state
List of all label keys used in the organization
Number of devices with no labels assigned
Example
{ "totalDevices": 150, "byStatus": { "online": 45, "offline": 5, "pending": 2, "error": 1 }, "labelKeys": [ "environment", "region", "tier" ], "unlabeledDeviceCount": 3}Unauthorized
Forbidden — caller lacks required permission