> 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 # GetAudience # Package: emailMarketing # Namespace: CampaignService # Method link: https://dev.wix.com/docs/api-reference/business-management/marketing/emails/email-marketing/campaign/get-audience.md ## Permission Scopes: Manage Email Marketing: SCOPE.DC-PROMOTE.EMAIL-MARKETING ## Introduction Retrieves the audience of a paused campaign. Use this method to retrieve all selected audience of the paused campaign at once, so they can be passed in bulk when the campaign is published again after being paused. --- ## REST API ### Schema ``` Method: getAudience Description: Retrieves the audience of a paused campaign. Use this method to retrieve all selected audience of the paused campaign at once, so they can be passed in bulk when the campaign is published again after being paused. URL: https://www.wixapis.com/email-marketing/v1/campaigns/{campaignId}/audience Method: POST Return type: GetAudienceResponse - name: audience | type: CampaignAudience | description: Campaign audience. - name: contactIds | type: array | description: IDs of contacts to whom to send the campaign. - name: labelIds | type: array | description: Labels GUIDs. - name: segmentIds | type: array | description: Segment GUIDs. - name: contactsFilter | type: object | description: Filter for contacts in JSON format. - name: contactsSearchTerm | type: string | description: Contacts plain text search expression (searches in name, phone and email fields). - name: activeContactsOnly | type: boolean | description: Should "inactive" contacts be excluded or not. ``` ### Examples ### Get Audience ```curl curl -X POST 'https://www.wixapis.com/email-marketing/v1/campaigns/11ab3908-c40e-4deb-8e42-ca743f73ac8b/audience' \ -H 'Authorization: ' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.emailMarketing.CampaignService.getAudience(campaignId) Description: Retrieves the audience of a paused campaign. Use this method to retrieve all selected audience of the paused campaign at once, so they can be passed in bulk when the campaign is published again after being paused. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: campaignId Method parameters: param name: campaignId | type: string | description: Campaign GUID. | required: true Return type: PROMISE - name: audience | type: CampaignAudience | description: Campaign audience. - name: contactIds | type: array | description: IDs of contacts to whom to send the campaign. - name: labelIds | type: array | description: Labels GUIDs. - name: segmentIds | type: array | description: Segment GUIDs. - name: contactsFilter | type: object | description: Filter for contacts in JSON format. - name: contactsSearchTerm | type: string | description: Contacts plain text search expression (searches in name, phone and email fields). - name: activeContactsOnly | type: boolean | description: Should "inactive" contacts be excluded or not. ``` ### Examples ### getAudience ```javascript import { campaigns } from '@wix/email-marketing'; async function getAudience(campaignId) { const response = await campaigns.getAudience(campaignId); }; ``` ### getAudience (with elevated permissions) ```javascript import { campaigns } from '@wix/email-marketing'; import { auth } from '@wix/essentials'; async function myGetAudienceMethod(campaignId) { const elevatedGetAudience = auth.elevate(campaigns.getAudience); const response = await elevatedGetAudience(campaignId); } ``` ### getAudience (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 { campaigns } from '@wix/email-marketing'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { campaigns }, // Include the auth strategy and host as relevant }); async function getAudience(campaignId) { const response = await myWixClient.campaigns.getAudience(campaignId); }; ``` ---