# Change the push provider

Canonical page: https://docs.ovok.com/api/push/change-the-push-provider

`PATCH /v1/push/provider`

Changes the credentials or settings of the push provider your current project has set up. The result is checked with the provider before it is stored, as `POST` does.

**Scope:** the caller's project (from the token).

## Behaviour

- `provider` names the provider set up. Another one is 409 `PUSH_PROVIDER_MISMATCH`: remove the current one with `DELETE`, then set the new one up with `POST`.
- Send the fields to change, with the rules of `POST`:
  - `fcm`: `secret`.
  - `apns`: any of `secret`, `teamId`, `keyId`, `bundleId` and `environment`.
  - `expo`: `secret`, or `null` to stop sending an access token.
  - `relay`: `url`. The signing secret stays as it is.
- No provider set up is 404 `PROVIDER_NOT_CONFIGURED`.
- A refusal from the check is 422 `INVALID_CREDENTIALS`, an unreachable provider 502 `PUSH_PROVIDER_UNAVAILABLE`; nothing is stored either way.
- When the server has no encryption key, nothing is stored and the answer is 503 `ENCRYPTION_UNAVAILABLE`.
- The answer has the provider as `GET /v1/push/provider` returns it.

## Example

```bash
curl -X PATCH 'https://api.sandbox.ovok.com/v1/push/provider' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \
  -H 'Content-Type: application/json' \
  -d '{ "provider": "apns", "environment": "production" }'
```

**Who can call it:** a project admin. See [roles](/access-policies#who-can-call-a-route).