> ## 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 Preference

> This endpoint allows users to turn a channel on or off for one or more notification types.

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

This endpoint turns one channel on or off for the notification types that you send. Pacifica changes all the types together or none of them. Other channels keep their current value.

A channel also needs to be on in the master preference. See [Set notification master preference](https://docs.pacifica.fi/api-documentation/api/rest-api/notifications/set-notification-master-preference.md).

#### Operation Type (for Signing)

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

#### Request Body

<table><thead><tr><th width="200">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>`"notification_types"`</td><td>array</td><td>required</td><td>One or more notification types:\
`"deposit_success"`\
`"withdraw_success"`\
`"order_filled"`\
`"order_partially_filled"`\
`"order_canceled"`\
`"tp_sl_triggered"`\
`"liquidation"`\
`"strategy_update"`</td><td>`["order_filled"]`</td></tr><tr><td>`"channel"`</td><td>string</td><td>required</td><td>Channel to change:\
`"in_app"`\
`"mobile_push"`\
`"web_push"`</td><td>`mobile_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,
  "notification_types": ["order_filled", "tp_sl_triggered", "liquidation"],
  "channel": "mobile_push",
  "enabled": true,
  "expiry_window": 30000
}
```

You can't set a preference for `test` or for types that Pacifica doesn't send. See [Notification types](https://docs.pacifica.fi/api-documentation/api/rest-api/notifications#notification-types).

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: 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", "mobile_push"],
    "preferences": [
      { "notification_type": "deposit_success", "enabled_channels": [] },
      { "notification_type": "withdraw_success", "enabled_channels": [] },
      { "notification_type": "order_filled", "enabled_channels": ["mobile_push"] },
      { "notification_type": "order_partially_filled", "enabled_channels": [] },
      { "notification_type": "order_canceled", "enabled_channels": [] },
      { "notification_type": "tp_sl_triggered", "enabled_channels": ["mobile_push"] },
      { "notification_type": "liquidation", "enabled_channels": ["mobile_push"] },
      { "notification_type": "strategy_update", "enabled_channels": [] }
    ]
  },
  "error": null,
  "code": null
}
```

* Status 400: Invalid request parameters or signature. An empty `notification_types` list, or a type that you can't configure, returns this error:

```json theme={null}
{
  "success": false,
  "data": null,
  "error": "notification_types must not be empty",
  "code": 400,
  "error_id": "invalid_notification_types"
}
```

* Status 403: The account doesn't exist. An account exists after its first deposit
* 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,
    "notification_types": ["order_filled", "tp_sl_triggered", "liquidation"],
    "channel": "mobile_push",
    "enabled": True
}

response = requests.post(
    "/api/v1/account/notifications/preferences",
    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.