> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pacifica.fi/llms.txt
> Use this file to discover all available pages before exploring further.

# Set Notification Master Preference

> This endpoint allows users to turn a channel on or off with the account's master switch.

```http theme={null}
POST /api/v1/account/notifications/preferences/master
```

This endpoint turns one channel on or off in your master preference. Pacifica uses a channel only when it is on in the master preference and in the notification type's preference. Other channels keep their current value.

The master preference doesn't change the type preferences. Turn a channel off here to pause it for all types. When you turn it on again, your type preferences apply again.

#### Operation Type (for Signing)

| Header Field | Type | Content |
| - | - | - |
| `"type"` | string | `"set_notification_master_preference"` |

#### Request Body

<table><thead><tr><th width="176">Field</th><th width="98">Type</th><th width="95">Need</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td>`"account"`</td><td>string</td><td>required</td><td>User's wallet address</td><td>`42trU9A5...`</td></tr><tr><td>`"signature"`</td><td>string</td><td>required</td><td>Cryptographic signature</td><td>`5j1Vy9Uq...`</td></tr><tr><td>`"timestamp"`</td><td>integer</td><td>required</td><td>Current timestamp in milliseconds</td><td>`1716200000000`</td></tr><tr><td>`"channel"`</td><td>string</td><td>required</td><td>Channel to change:\
`"in_app"`\
`"mobile_push"`\
`"web_push"`</td><td>`web_push`</td></tr><tr><td>`"enabled"`</td><td>boolean</td><td>required</td><td>`true` turns the channel on. `false` turns it off</td><td>`true`</td></tr><tr><td>`"expiry_window"`</td><td>integer</td><td>optional</td><td>Signature expiry in milliseconds</td><td>`30000`</td></tr><tr><td>`"agent_wallet"`</td><td>string</td><td>optional</td><td>Agent wallet address</td><td>`69trU9A5...`</td></tr></tbody></table>

```json theme={null}
{
  "account": "42trU9A5...",
  "signature": "5j1Vy9Uq...",
  "timestamp": 1716200000000,
  "channel": "web_push",
  "enabled": true,
  "expiry_window": 30000
}
```

You can sign this request with the account key or with an [agent wallet](https://docs.pacifica.fi/api-documentation/api/signing/api-agent-keys.md).

#### Response

* Status 200: Master preference updated. The response has all your preferences after the change, in the same format as [List notification preferences](https://docs.pacifica.fi/api-documentation/api/rest-api/notifications/list-notification-preferences.md)

```json theme={null}
{
  "success": true,
  "data": {
    "master_enabled_channels": ["in_app", "web_push"],
    "preferences": [
      { "notification_type": "deposit_success", "enabled_channels": ["in_app", "web_push"] },
      { "notification_type": "withdraw_success", "enabled_channels": ["in_app", "web_push"] },
      { "notification_type": "order_filled", "enabled_channels": ["in_app", "web_push"] },
      { "notification_type": "order_partially_filled", "enabled_channels": [] },
      { "notification_type": "order_canceled", "enabled_channels": [] },
      { "notification_type": "tp_sl_triggered", "enabled_channels": ["in_app", "web_push"] },
      { "notification_type": "liquidation", "enabled_channels": ["in_app", "web_push"] },
      { "notification_type": "strategy_update", "enabled_channels": ["in_app"] }
    ]
  },
  "error": null,
  "code": null
}
```

* Status 400: Invalid request parameters or signature
* Status 403: The account doesn't exist. An account exists after its first deposit
* Status 409: You tried to turn on `web_push`, but Web Push isn't available. [Get Web Push config](https://docs.pacifica.fi/api-documentation/api/rest-api/notifications/get-web-push-config.md) returns `enabled: false` in this case

```json theme={null}
{
  "success": false,
  "data": null,
  "error": "Web Push is disabled",
  "code": 409,
  "error_id": "web_push_disabled"
}
```

* Status 429: Rate limit exceeded
* Status 500: Internal server error

#### Code Example (Python)

```python theme={null}
import requests

payload = {
    "account": "42trU9A5...",
    "signature": "5j1Vy9Uq...",
    "timestamp": 1716200000000,
    "channel": "web_push",
    "enabled": True
}

response = requests.post(
    "/api/v1/account/notifications/preferences/master",
    json=payload,
    headers={"Content-Type": "application/json"}
)

data = response.json()
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.