# Delete Location

`DELETE /api/v1/locations/{id}`

Permanently deletes a Location and everything it holds: daily history, orders, shifts, scores, ratings, store audits, COGS and retention report records, competition standings, and any users assigned directly to it. Requires the `delete` ability.

Only a location whose `is_deletable` is true can be deleted: a pending location (never activated), a deactivated one that never loaded any sales, labor or custom-metric data (keyed in by mistake), or a deactivated one whose daily history has aged out of reporting retention. A closed store's sales count toward network totals and year-over-year benchmarks for two full calendar years after the year it closed, so a deactivated location becomes deletable on Jan 1 three years after its deactivation year (four for a Dec 31 deactivation, as that day is itself retained); `deletable_on` gives the date. Deactivating (`is_active: false`) is what takes a store off leaderboards; deletion is cleanup only.

## Path parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Resource UUID. |

## Example request

```bash
curl -X DELETE "https://app.franchisesee.com/api/v1/locations/9d3f6b2e-5a41-4c7e-9a0b-2f1c8e7d4a63" \
  -H "Authorization: Bearer $FRANCHISESEE_TOKEN" \
  -H "Accept: application/json"
```

## Responses

### 204 Deleted.

### 401 Authentication failed or missing.

```json
{
    "message": "Unauthenticated."
}
```

### 403 The token lacks the required ability or the caller is not permitted.

```json
{
    "message": "This API token does not have the 'create' ability."
}
```

### 404 Resource not found.

```json
{
    "message": "Record not found."
}
```

### 409 The location cannot be deleted yet: it is active, or it is deactivated and still inside reporting retention. The message names the date it becomes deletable.

```json
{
    "message": "Cannot delete an active location. Deactivate it first."
}
```
