# Update a project setting

Canonical page: https://docs.ovok.com/api/projects/update-a-project-setting

`PUT /v1/project/settings/{key}`

Turns one on/off setting of your current project on or off, for example `PRACTITIONER_INVITATION_ENABLED`.

**Auth:** bearer token of a project admin. The caller must also be a Practitioner, an admin or hold the System Owner access policy.
**Scope:** the caller's project (from the token).

## Behaviour

- `:key` must be one of the on/off keys returned in `settings` by `GET /v1/project/settings`. It may be URL-encoded.
- Writes the entry into `Project.setting[]`, adding it when missing. Every other entry is kept as it is.
- The write only succeeds if the project did not change since the server read it; otherwise it answers 409.
- The response is the full settings envelope after the write, as `GET /v1/project/settings` returns it.
- An unknown `:key` returns 400 `UNKNOWN_SETTING` with the accepted keys.
- `SIGNALS_SEND_AUTO` and `SIGNALS_ANNOTATE_OBSERVATIONS` also switch their wiring before the setting is saved: Medplum's `Subscription` for send-auto, Signals' `ovok-annotations` subscriber for annotations. Nothing is saved if that fails (502 `SETTING_WIRING_FAILED`). Turning either on for a project without its own Signals tenant answers 409 `SETTING_NOT_AVAILABLE`; a concurrent change of the same switch answers 409 too. While `SIGNALS_ANNOTATE_OBSERVATIONS` has no saved value it follows `SIGNALS_SEND_AUTO`, so switching send-auto also switches annotations' wiring.
- Read the project again and retry on 409.

## Example

```bash
curl -X PUT 'https://api.sandbox.ovok.com/v1/project/settings/PRACTITIONER_INVITATION_ENABLED' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \
  -H 'Content-Type: application/json' \
  -d '{ "enabled": true }'
```
