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

# Update subscriber preference

<Warning>
  Enter your API key in the `Authorization` field like the example shown below:

  E.g `ApiKey 18d2e625f05d80e`
</Warning>

<RequestExample>
  ```java Java theme={null}
  import co.novu.common.base.Novu;
  import co.novu.api.subscribers.requests.UpdateSubscriberPreferenceRequest;
  import co.novu.api.subscribers.responses.SingleSubscriberPrefResponse;

  public class Main {
      public static void main(String[] args) {
          String apiKey = "<NOVU_API_KEY>";
          Novu novu = new Novu(apiKey);
          String subscriberId = "<SUBSCRIBER_ID>";
          String templateId = "<TEMPLATE_ID>";

          PreferenceChannel channel = new PreferenceChannel();
          channel.setType("<TYPE>");
          channel.setEnabled(true);

          UpdateSubscriberPreferenceRequest request = new UpdateSubscriberPreferenceRequest();
          request.setEnabled(false);
          request.setChannel(channel);

          SingleSubscriberPrefResponse response = novu.updateSubscriberPreferences(request, subscriberId, templateId);
      }
  }
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "data": {
      "preference": {
        "channels": {
          "chat": "boolean",
          "email": "boolean",
          "in_app": "boolean",
          "push": "boolean",
          "sms": "boolean"
        },
        "enabled": "boolean"
      },
      "template": {
        "_id": "string",
        "critical": "boolean",
        "name": "string"
      }
    }
  }
  ```
</ResponseExample>
