# List location assignment candidates

Canonical page: https://docs.ovok.com/api/slim/location/list-location-assignment-candidates

`GET /v1/slim/location/assignment-candidates`

Lists locations a resident can be placed in, flagged as occupied or vacant. Use it to fill the location picker when you assign a resident.

**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 `Location:search`, `Location:read`, `Device:read`, `Patient:read` and `Organization:read` (an admin or super admin who holds no access policy skips this check).
**Scope:** The caller's project (from the token). A non-admin token without a project is refused.

## Behaviour

- Read-only.
- Built from the same data as `GET /v1/slim/location`: **one row per device** at a location, and one row for a location with no device. `total` counts rows.
- `occupied` is `true` when the row's device has a resident assigned. Such rows carry `warningCode: "location_has_existing_resident"`. Otherwise `warningCode` is `null`.
- `assignable` is always `true`.
- Fields with no value are `null`.
- `search` and `organizationId` filter as on `GET /v1/slim/location`. `occupied` takes `occupied`, `vacant` or `all` (default `all`).
- Rows are sorted as on `GET /v1/slim/location`.
- Pagination is zero-based: `page` (default `0`) and `count` (default `50`, max `50`).

## Example

```bash
curl -X GET 'https://api.sandbox.ovok.com/v1/slim/location/assignment-candidates?occupied=vacant&count=50' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk'
```

```json
{
  "total": 1,
  "page": 0,
  "count": 50,
  "resources": [
    {
      "locationId": "c3499c27-2973-0a7f-807e-fb8676a92dcb",
      "locationName": "Room 201 Bed 1",
      "organizationId": null,
      "organizationName": null,
      "deviceId": null,
      "deviceName": null,
      "patientId": null,
      "patientName": null,
      "occupied": false,
      "assignable": true,
      "warningCode": null
    }
  ]
}
```
