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

# Update Notification Settings

> Update dialog notification settings for current user.

#### Recipes

<AccordionGroup>
  <Accordion title="Update Notification Settings with API key">
    <Steps>
      <Step title="1. Use 'Authorization' header to pass API key">
        ```curl {3} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{  
          "enabled":0
        }' \
        https://api.quickblox.com/chat/Dialog/5d75651fa0eb4732190b72aa/notifications.json
        ```
      </Step>

      <Step title="2. Use 'On-Behalf-Of' header to pass user_id">
        To execute a request on behalf of a specific user.

        ```curl {4} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{  
          "enabled":0
        }' \
        https://api.quickblox.com/chat/Dialog/5d75651fa0eb4732190b72aa/notifications.json
        ```
      </Step>

      <Step title="3. Set settings">
        "enabled": 0 - turn off the push notifications for specified dialog <br />
        "enabled": 1 - turn off the push notifications for specified dialog

        ```curl {6} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{  
          "enabled":0
        }' \
        https://api.quickblox.com/chat/Dialog/5d75651fa0eb4732190b72aa/notifications.json
        ```
      </Step>

      <Step title="4. Set dialog ID">
        Specify the ID of the dialog whose setting status you want to update.

        ```curl {8} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{  
          "enabled":0
        }' \
        https://api.quickblox.com/chat/Dialog/5d75651fa0eb4732190b72aa/notifications.json
        ```
      </Step>

      <Step title="5. As result, the API returns updated notification settings status">
        ```curl theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{  
          "enabled":0
        }' \
        https://api.quickblox.com/chat/Dialog/5d75651fa0eb4732190b72aa/notifications.json
        ```
      </Step>
    </Steps>
  </Accordion>
</AccordionGroup>

A user can turn on/off push notifications for offline messages in a dialog. The default value is ON.

By default, when a user is offline and other user sent a message to them, they receive a push notification.
It is possible to disable this feature. Available only for dialogs `type=2` (GROUP) and `type=3` (PRIVATE).

#### Path Parameters

<ParamField path="chat_dialog_id" type="string" required> ID of the dialog to which a current message is connected. Generated automatically by the server after message creation</ParamField>

#### Body Parameters

<ParamField body="enabled" type="integer"> Possible values are: `enabled=0`, `enabled=1`. </ParamField>

#### Headers

<ParamField header="QB-Token" type="string" required> A user or application session token. See [Authentication](/reference/authentication) page to learn more about session tokens. Must be used either QB-Token or Authorization. </ParamField>
<ParamField header="Authorization" type="string" default="ApiKey {your_api_key}"> API key from Dashboard. Expected format: `ApiKey {your_api_key}`. Must be used either QB-Token or Authorization.</ParamField>
<ParamField header="On-Behalf-Of" type="string">User ID. The user ID of the user on whose behalf the request is being made.</ParamField>

#### Responses

<AccordionGroup>
  <Accordion title="200">
    A successful response

    <ResponseField name="notifications" type="object">
      <Expandable title="properties">
        <ResponseField name="enabled" type="integer" />
      </Expandable>
    </ResponseField>
  </Accordion>

  <Accordion title="400">
    An error response

    <ResponseField name="errors" type="array of strings" />
  </Accordion>
</AccordionGroup>

<RequestExample>
  ```bash cURL theme={null}
  curl -X PUT \
  -H "Content-Type: application/json" \
  -H "QB-Token: 1319b4991186601ccf4df2d0fa89565f68012bba" \
  -d '{  
    "enabled":0
  }' \
  https://api.quickblox.com/chat/Dialog/5d75651fa0eb4732190b72aa/notifications.json
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "notifications": {
      "enabled": 0
    }
  }
  ```

  ```json 400 theme={null}
  {
    "errors": [
      "Incorrect params."
    ]
  }
  ```
</ResponseExample>
