# Count devices per zone (compatibility)

Canonical page: https://docs.ovok.com/api/slim/query/count-devices-per-zone-compatibility

`GET /v1/slim/query/organization/device/count`

Compatibility route for older zone count clients. Returns device counts per zone. For new integrations, use `GET /v1/slim/zones/device-counts`.

**Auth:** bearer token. The caller must be a practitioner, an admin or a System Owner, and needs `Organization:search` and `Device:search`.
**Scope:** the caller's project (from the token). For admins, the counts also cover the project's sub-projects.

## Behaviour

- Each entry has the zone (`organization`) and its `deviceCount`, `assignedResidentDeviceCount`, `activeDeviceCount` and `inactiveDeviceCount`.
- Devices without a zone are counted in an entry without `organization`.
- Only zones with at least one device are listed, sorted by `deviceCount`, highest first.
- A device counts as active when its telemetry reports it active.
- The top-level `total*` fields sum the counts over all entries. `total` is the number of entries.
- Results are cached for up to 60 seconds. Writes made through the Slim routes refresh the cache sooner.

## Example

```bash
curl -X GET 'https://api.sandbox.ovok.com/v1/slim/query/organization/device/count' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk'
```
