# Delete location

Canonical page: https://docs.ovok.com/slim-apis/location/delete-location

| Method | Path |
| --- | --- |
| `DELETE` | `/v1/slim/location/:id` |

[Authentication](/authentication) · [Access policies](/access-policies)

Deletes a location that has no devices attached.

**Auth:** Bearer token. The caller must be a project admin or super admin. The access policy must grant `Location:delete` and `Device:update` (admins and super admins skip the access-policy check, so in practice only the admin role matters).
**Scope:** The location must belong to the caller's project (from the token).

## Request [#request]

### Path parameters [#path-parameters]

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string (uuid)` | Yes | Location id. |

## Behaviour [#behaviour]

- Detach every device first (`PUT /v1/slim/location/{id}` with `"deviceId": []`). A location with a device attached is refused.
- The Location resource is deleted.
- The write is atomic and takes a short write lock. A concurrent write to the same location gets a 409.
- A location-deleted entry is added to the change history. A failure to write that entry does not fail the request.
- The response has no body.

## Example [#example]

```bash
curl -X DELETE 'https://api.sandbox.ovok.com/v1/slim/location/5d2a9c64-7e1b-4830-b6f5-9a3c1e8d7b02' \
  -H "Authorization: Bearer ${OVOK_TOKEN}"
```

## Successful response [#successful-response]

`200` — Location deleted. The response has no body.

## Errors [#errors]

| Status | Meaning |
| --- | --- |
| [`400`](/errors/malformed-request) | The FHIR backend refuses the delete. |
| [`401`](/errors/unauthenticated) | Bearer token is missing, invalid or expired. |
| [`403`](/errors/forbidden) | You are not an admin or super admin, you lack `Location:delete` or `Device:update`, or the location does not exist or is outside your project. |
| [`409`](/errors/conflict) | Another write holds the location. Retry. |
| [`422`](/errors/validation-failed) | `id` is not a UUID, or devices are still at the location. |
