Get fleet statistics
GET
/api/v1/groups/stats
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 ”Responses
Section titled “ Responses ”Fleet statistics retrieved successfully
Media type application/json
object
totalDevices
required
Total number of devices in the fleet
number
byStatus
required
Status breakdown of all devices
object
online
required
Number of online devices
number
offline
required
Number of offline devices
number
pending
required
Number of pending devices
number
error
required
Number of devices in error state
number
labelKeys
required
List of all label keys used in the organization
Array<string>
unlabeledDeviceCount
required
Number of devices with no labels assigned
number
Example
{ "totalDevices": 150, "byStatus": { "online": 45, "offline": 5, "pending": 2, "error": 1 }, "labelKeys": [ "environment", "region", "tier" ], "unlabeledDeviceCount": 3}Unauthorized
Forbidden — caller lacks required permission