# Create location in zone

Canonical page: https://docs.ovok.com/api/slim/zones/create-location-in-zone

`POST /v1/slim/zones/{zoneId}/locations`

Creates a location (a FHIR `Location`) inside a zone. The new location's managing organization is the zone.

**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:create` and `Device:update` (an admin or super admin who holds no access policy skips this check).
**Scope:** The location is created in the caller's project (from the token). A super-admin caller may pass `?projectId=<uuid>` to create it in that project instead; the project must exist. The zone must belong to the project in use, its parent project, or one of its sub-projects.

## Behaviour

- `name` is required and must be unique among the locations your token can search.
- `floor`, `room` and `bed` are optional. When at least one is set, no other location in the zone may have the same floor, room and bed. A location with none of them is checked by name only.
- The location is created with no devices or residents. Assign them with `PUT /v1/slim/zones/{zoneId}/locations/{locationId}`.
- A location-created entry is added to the change history. A failure to write that entry does not fail the request.
- The response is the new location, in the same shape as `GET /v1/slim/location/{id}`.

## Example

```bash
curl -X POST 'https://api.sandbox.ovok.com/v1/slim/zones/c3499c27-2973-0a7f-807e-fb8676a92dcb/locations' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Room 101 Bed 1",
    "floor": "1",
    "room": "101",
    "bed": "1"
  }'
```
