# Get zone device counts

Canonical page: https://docs.ovok.com/api/slim/zones/get-zone-device-counts

`GET /v1/slim/zones/device-counts`

Returns device counts per zone for your project, with project-wide totals. A zone is a FHIR `Organization`.

**Auth:** Bearer token. The caller must be a practitioner, an admin, a super admin, or hold the "System Owner" access policy. The access policy must grant `Organization:search`, `Organization:read`, `Device:search` and `Device:read` (an admin or super admin who holds no access policy skips this check).
**Scope:** The caller's project (from the token).

## Behaviour

- By default, `deviceCount` matches the rows `GET /v1/slim/device/live` returns for each zone: devices assigned to a resident.
- `all=true` counts every device in each zone, assigned or not, and ignores `effectiveSleepStatus`.
- `effectiveSleepStatus` (`disconnected`, `connected`, `awake`, `away`, `asleep`) counts only devices in that state. A device that is not active counts as `disconnected`.
- `includeUnassigned=true` also counts devices with no resident (unless `all=true` already does) and adds a bucket, with `organization` unset, for devices in no zone.
- `includeEmpty=true` keeps project zones that have no matching devices, with zero counts.
- For each zone, `assignedResidentDeviceCount` counts devices with a resident, and `activeDeviceCount` / `inactiveDeviceCount` split devices by whether they are currently active.
- Zones are sorted by `deviceCount`, highest first. `total` is the number of entries; the `total…Count` fields sum the per-zone counts.

## Example

```bash
curl -X GET 'https://api.sandbox.ovok.com/v1/slim/zones/device-counts?includeEmpty=true&includeUnassigned=true' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk'
```
