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

# Update Communication Settings

> This endpoint allows the update of a user's notification / email settings.

### Parameters

<ParamField path="id" type="string">
  The ID of the settings record. Can be either a UID (SecureRandom.uuid) for unauthenticated access or an ID for authenticated access.
</ParamField>

<ParamField body="reward_earned" type="hash">
  Settings for when a user earns a loyalty reward

  <Expandable title="reward_earned">
    <ParamField body="notification" type="boolean">
      app notification setting
    </ParamField>

    <ParamField body="email" type="boolean">
      email setting
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="reward_unused" type="hash">
  Settings for when a user has an unused reward

  <Expandable title="reward_unused">
    <ParamField body="notification" type="boolean">
      app notification setting
    </ParamField>

    <ParamField body="email" type="boolean">
      email setting
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="reward_progress" type="hash">
  Settings for when a user earns loyalty progress

  <Expandable title="reward_progress">
    <ParamField body="notification" type="boolean">
      app notification setting
    </ParamField>

    <ParamField body="email" type="boolean">
      email setting
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="reward_offer" type="hash">
  Settings for when a merchant sends an offer

  <Expandable title="reward_offer">
    <ParamField body="notification" type="boolean">
      app notification setting
    </ParamField>

    <ParamField body="email" type="boolean">
      email setting
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="feedback_available" type="hash">
  Settings for when a user has the opportunity to leave feedback for a purchase

  <Expandable title="feedback_available">
    <ParamField body="notification" type="boolean">
      app notification setting
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="marketing_general" type="hash">
  Settings for when a merchant sends general marketing

  <Expandable title="marketing_general">
    <ParamField body="email" type="boolean">
      email setting
    </ParamField>

    <ParamField body="sms" type="boolean">
      SMS setting
    </ParamField>
  </Expandable>
</ParamField>

### Response

<Snippet file="entities/communication-setting-consumer.mdx" />

### Authentication

This endpoint supports two authentication modes:

* **Unauthenticated**: Use the setting's UID to update preferences without authentication
* **Authenticated**: Use the setting's hashid with OAuth bearer token for authenticated access

<RequestExample>
  ```bash Unauthenticated (UID) theme={null}
  curl https://api.thanxsandbox.com/communication_settings/550e8400-e29b-41d4-a716-446655440000 \
    -X PATCH \
    -H "Content-Type: application/json"  \
    -H "Accept-Version: v4.0" \
    -H "Accept: application/json" \
    -H "X-ClientId: ${client_id}"
    -d '{
      "communication_setting": {
        "reward_earned": {
          "notification": false,
          "email": false
        },
        "feedback_available": {
          "notification": true
        },
        "marketing_general": {
          "email": true,
          "sms": false
        }
      }
    }'
  ```

  ```bash Authenticated (Hashid) theme={null}
  curl https://api.thanxsandbox.com/communication_settings/woerihfslkwer \
    -X PATCH \
    -H "Content-Type: application/json"  \
    -H "Accept-Version: v4.0" \
    -H "Accept: application/json" \
    -H "Authorization: Bearer ${token}" \
    -H "X-ClientId: ${client_id}"
    -d '{
      "communication_setting": {
        "reward_earned": {
          "notification": false,
          "email": false
        },
        "feedback_available": {
          "notification": true
        },
        "marketing_general": {
          "email": true,
          "sms": false
        }
      }
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json theme={null}
  {
    "communication_setting": {
      "id": "weoruoisdhf",
      "merchant_id": "owierywtwt",
      "merchant_handle": "example-merchant",
      "user_id": "woerushfwe",
      "reward_earned": {
        "notification": true,
        "email": true
      },
      "reward_unused": {
        "notification": true,
        "email": true
      },
      "reward_progress": {
        "notification": true,
        "email": true
      },
      "reward_offer": {
        "notification": true,
        "email": true
      },
      "feedback_available": {
        "notification": true
      },
      "marketing_general": {
        "email": true,
        "sms": true
      }
    }
  }
  ```
</ResponseExample>
