> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# BulkUpdateContactSubscriptions

# Package: contacts

# Namespace: ContactSubscriptions

# Method link: https://dev.wix.com/docs/api-reference/crm/members-contacts/contacts/contacts-v5/bulk-update-contact-subscriptions.md

## Permission Scopes:
Manage Events: SCOPE.EVENTS.MANAGE-EVENTS

## Introduction

Updates the email and SMS marketing subscription statuses of multiple contacts that match the provided filter. Works asynchronously.

If a requested subscription status matches a contact's current status, that contact is left unchanged. Provide at least one of `emailSubscriptionStatus` or `phoneSubscriptionStatus`.

To check the status of the bulk update, pass the returned `jobId` to [Get Async Job](https://dev.wix.com/docs/api-reference/business-management/async-job/get-async-job.md).

---

## REST API

### Schema

```
 Method: bulkUpdateContactSubscriptions
 Description: Updates the email and SMS marketing subscription statuses of multiple contacts that match the provided filter. Works asynchronously.  If a requested subscription status matches a contact's current status, that contact is left unchanged. Provide at least one of `emailSubscriptionStatus` or `phoneSubscriptionStatus`.  To check the status of the bulk update, pass the returned `jobId` to [Get Async Job](https://dev.wix.com/docs/api-reference/business-management/async-job/get-async-job.md).
 URL: https://www.wixapis.com/contacts/v5/bulk/contacts/subscriptions/update
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  filter
 Method parameters: 
   param name: emailSubscriptionStatus | type: SubscriptionStatus    
      - enum:
           NOT_SET - No subscription status has been reported yet.
           SUBSCRIBED - Opted in to receive marketing messages.
           UNSUBSCRIBED - Opted out of receiving marketing messages.
   param name: filter | type: filter | description: A filter for the contacts that the subscription statuses will be applied to.  Example: `{ "filter": { "name.last": "Smith" } }` | required: true 
   param name: phoneSubscriptionStatus | type: SubscriptionStatus    
      - enum:
           NOT_SET - No subscription status has been reported yet.
           SUBSCRIBED - Opted in to receive marketing messages.
           UNSUBSCRIBED - Opted out of receiving marketing messages.
   param name: search | type: SearchDetails    
        - name: mode | type: Mode | description: How separate search terms in `expression` are combined.  
             - enum:
             -     OR: Any of the search terms must be present.
             -     AND: All search terms must be present.
        - name: expression | type: string | description: Search term or expression.  | validation: maxLength 100
        - name: fields | type: array<string> | description: Fields to search in. If empty, searches all searchable fields. Use dot notation to specify the JSON path.  | validation: maxItems 20, maxLength 200
        - name: fuzzy | type: boolean | description: Whether to use fuzzy search, which allows typos using a managed proximity algorithm.  
 Return type: BulkUpdateContactSubscriptionsResponse
  - name: jobId | type: string | description: Job GUID. Pass this GUID to [Get Async Job](https://dev.wix.com/docs/api-reference/business-management/async-job/get-async-job.md) to retrieve the status of the asynchronous operation.  | validation: format GUID

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: MISSING_SUBSCRIPTION_STATUS | Description: At least one of the subscription statuses must be requested.


```

### Examples

### Update contact subscriptions by filter
Asynchronously updates email and phone subscription statuses for all contacts matching a filter. Returns a job ID to poll for status.

```curl
curl -X POST \
'https://www.wixapis.com/contacts/v5/bulk/contacts/subscriptions/update' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
-d '{
  "filter": {
    "company.name": "ExampleCo"
  },
  "emailSubscriptionStatus": "SUBSCRIBED"
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.crm.contactsV5.bulkUpdateContactSubscriptions(filter, options)
 Description: Updates the email and SMS marketing subscription statuses of multiple contacts that match the provided filter. Works asynchronously.  If a requested subscription status matches a contact's current status, that contact is left unchanged. Provide at least one of `emailSubscriptionStatus` or `phoneSubscriptionStatus`.  To check the status of the bulk update, pass the returned `jobId` to [Get Async Job](https://dev.wix.com/docs/api-reference/business-management/async-job/get-async-job.md).
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  filter
 Method parameters: 
   param name: filter | type: object | description: A filter for the contacts that the subscription statuses will be applied to.  Example: `{ "filter": { "name.last": "Smith" } }` | required: true 
   param name: options | type: BulkUpdateContactSubscriptionsOptions  none  
        - name: search | type: SearchDetails | description: Free text to match in searchable fields for the contacts that the subscription statuses will be applied to.  
           - name: mode | type: Mode | description: How separate search terms in `expression` are combined.  
                 - enum:
                 -     OR: Any of the search terms must be present.
                 -     AND: All search terms must be present.
           - name: expression | type: string | description: Search term or expression.  | validation: maxLength 100
           - name: fields | type: array<string> | description: Fields to search in. If empty, searches all searchable fields. Use dot notation to specify the JSON path.  | validation: maxItems 20, maxLength 200
           - name: fuzzy | type: boolean | description: Whether to use fuzzy search, which allows typos using a managed proximity algorithm.  
        - name: emailSubscriptionStatus | type: SubscriptionStatus | description: The subscription status to apply to the contact's email address.  
             - enum:
             -     NOT_SET: No subscription status has been reported yet.
             -     SUBSCRIBED: Opted in to receive marketing messages.
             -     UNSUBSCRIBED: Opted out of receiving marketing messages.
        - name: phoneSubscriptionStatus | type: SubscriptionStatus | description: The subscription status to apply to the contact's phone.  
 Return type: PROMISE<BulkUpdateContactSubscriptionsResponse>
  - name: jobId | type: string | description: Job GUID. Pass this GUID to [Get Async Job](https://dev.wix.com/docs/api-reference/business-management/async-job/get-async-job.md) to retrieve the status of the asynchronous operation.  | validation: format GUID

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: MISSING_SUBSCRIPTION_STATUS | Description: At least one of the subscription statuses must be requested.


```

### Examples

### bulkUpdateContactSubscriptions
```javascript
import { contactsV5 } from '@wix/crm';

async function bulkUpdateContactSubscriptions(filter,options) {
  const response = await contactsV5.bulkUpdateContactSubscriptions(filter,options);
};
```

### bulkUpdateContactSubscriptions (with elevated permissions)
```javascript
import { contactsV5 } from '@wix/crm';
import { auth } from '@wix/essentials';

async function myBulkUpdateContactSubscriptionsMethod(filter,options) {
  const elevatedBulkUpdateContactSubscriptions = auth.elevate(contactsV5.bulkUpdateContactSubscriptions);
  const response = await elevatedBulkUpdateContactSubscriptions(filter,options);
}
```

### bulkUpdateContactSubscriptions (self-hosted)
Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { contactsV5 } from '@wix/crm';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { contactsV5 },
  // Include the auth strategy and host as relevant
});


async function bulkUpdateContactSubscriptions(filter,options) {
  const response = await myWixClient.contactsV5.bulkUpdateContactSubscriptions(filter,options);
};
```

---