# Update threshold

Canonical page: https://docs.ovok.com/api/slim/threshold/update-threshold

`PUT /v1/slim/threshold`

Replaces the home's threshold configuration: the alert limits every resident follows unless they have limits of their own.

> **Deprecated.** Use `PUT /v2/slim/threshold`. This v1 route stays available until every client has moved.

**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 `PlanDefinition:update` (an admin or super admin who holds no access policy skips this check).
**Scope:** The caller's project (from the token).

## Behaviour

- The body replaces the stored settings; fields you omit take their schema defaults, except the out-of-bed window: a body without `durationOfOutOfBed.period`, or without `durationOfOutOfBed`, keeps the home's stored window (19:00:00 to 09:00:00 when it has none). The home's limit ranges and optional vitals, which v1 cannot send, are kept as stored.
- Units: `durationOfOutOfBed` is in seconds, `sleepDuration` in hours.
- `enabled: false` switches a metric fully off: its `absolute` and `relative` bands are stored off too, whatever their own `enabled` says, and the residents following the home hold no Signals limit for it (a resident with limits of their own keeps them). Out of bed keeps its `relative` band, which only tightens its limit while it is on.
- To switch a metric back on, send its band's `enabled: true` as well. A switch-off stores the band's flag `false`, so a body that sets only the metric's `enabled: true` reads back `enabled: true` but arms nothing: the residents following the home get no limit for it.
- `meanHeartRate` and `meanRespiratoryRate` relative bands cannot be enabled for the home: a resident without a baseline of their own would get no alarm from them. Set baseline limits per resident. One sent under `enabled: false` is stored off.
- Every limit is evaluated by Signals, so every save is all or nothing, as `PUT /v2/slim/threshold` describes: it answers once Signals holds the home's limits, which every resident following the home follows at once, or puts everything back and answers an error with `saved: false` (409 another save or a tenant move got in the way; 502 out of time, or Signals did not take them; 500 the undo failed too). Nothing is stored then; send the save again. A 504 from the gateway can come while a failed save is still being put back: read the limits before sending it again.
- A change-history entry is written for a save that stands.
- The response is the saved configuration.

## Example

```bash
curl -X PUT 'https://api.sandbox.ovok.com/v1/slim/threshold' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \
  -H 'Content-Type: application/json' \
  -d '{
    "status": "active",
    "settings": {
      "heartRate": { "mode": "organization", "enabled": true, "absolute": { "enabled": true, "min": 40, "max": 120 } }
    }
  }'
```
