Skip to contentDevelopersPrezly website
Campaign recipients

Update Campaign Audience Sources

Replace selected saved audience sources and apply their recipient changes.

Personal tokens are not supported for this endpoint. Use an integration API key. Your account must also have access to the requested data. Authentication

Read the guide

PATCH
/campaigns/{campaign_id}/recipients/audience-selection

Saves the supplied audience sources and applies their recipient changes in one request. Omitted sources remain unchanged. Each supplied source replaces that source's saved rules. Empty lists clear a source; clear tags with empty included and excluded lists. Existing recipients outside the changed sources are preserved, including contacts still selected by another source. Only newly selected contacts are added. Up to 1,000 new reachable contacts are added synchronously. Larger additions return a deferred job.

Personal access tokens are not supported for this endpoint. Use an integration API key with the required permissions.

Authorization

API_key
headerAuthorizationBearer <token>

Bearer authentication using an integration API key, or a personal access token only where the operation explicitly supports it. Every listed personal-token scope is required; owner permissions and newsroom access still apply.

Path Parameters

campaign_id*integer

Request Body

application/json
  1. body

Structured data describing how the campaign audience was selected. Null when recipients were selected manually from the contacts grid.

tags?
emails?|array<>
previous_campaigns?array<>
contact_views?array<>

Response Body

Audience sources and recipients updated.

application/json
  1. response
campaign*
warnings*array<>
message*string
notifications*array<>
Example Request
curl -X PATCH 'https://api.prezly.com/v2/campaigns/0/recipients/audience-selection' \  -H 'Content-Type: application/json' \  -d '{  "tags": {    "included": [      42    ],    "excluded": [],    "match": "any"  }}'
Example Response
{  "campaign": {    "id": 0,    "subject": "string",    "content": "string",    "lifecycle_status": "draft",    "story_alignment": "left",    "story_appearance": "full",    "sender_domain_verification_status": "valid",    "sender_domain_verification_flow": "v1",    "author": {      "id": 0,      "email": "http://example.com",      "name": "string",      "display_name": "string",      "first_name": "string",      "last_name": "string",      "avatar_url": "http://example.com"    },    "sender": {      "id": 0,      "sender_email": "user@example.com",      "sender_name": "string",      "type": "string",      "is_default": true,      "is_public_webmail": true,      "domain": {        "domain_name": "example.com",        "is_valid": true,        "is_public_webmail": true,        "is_prezlymail": true,        "is_upgrade_recommended": true,        "verification_flow_version": "v1"      },      "is_verified": true,      "is_approved": true,      "domain_info": "string"    },    "story": {      "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",      "id": 0,      "thumbnail_url": "http://example.com",      "title": "string",      "culture": {        "code": "en",        "name": "string",        "direction": "ltr",        "language_code": "en",        "native_name": "string"      },      "language": "string",      "status": "uninitialized",      "lifecycle_status": "uninitialized",      "publication_status": "uninitialized",      "visibility": "public",      "created_at": "2019-08-24T14:15:22Z",      "updated_at": "2019-08-24T14:15:22Z",      "published_at": "2019-08-24T14:15:22Z",      "scheduled_at": "2019-08-24T14:15:22Z",      "author": {        "id": 0,        "email": "http://example.com",        "name": "string",        "display_name": "string",        "first_name": "string",        "last_name": "string",        "avatar_url": "http://example.com"      },      "newsroom": {        "id": 0,        "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",        "name": "string",        "display_name": "string",        "subdomain": "string",        "thumbnail_url": "http://example.com",        "timezone": "europe/london",        "is_active": true,        "is_archived": true,        "is_online": true,        "is_offline": true,        "is_multilingual": true,        "url": "http://example.com",        "links": {          "media_gallery_api": "http://example.com",          "room_contacts_api": "http://example.com",          "analytics_and_visibility_settings": "http://example.com",          "categories_management": "http://example.com",          "company_info_settings": "http://example.com",          "contacts_management": "http://example.com",          "domain_settings": "http://example.com",          "edit": "http://example.com",          "gallery_management": "http://example.com",          "hub_settings": "http://example.com",          "languages": "http://example.com",          "look_and_feel_settings": "http://example.com",          "manual_subscription_management": "http://example.com",          "privacy_settings": "http://example.com",          "widget_settings": "http://example.com"        }      },      "url": "http://example.com",      "oembed": {        "url": "http://example.com",        "type": "video",        "version": "1.0",        "title": "string",        "description": "string",        "author_name": "string",        "author_url": "http://example.com",        "provider_name": "string",        "provider_url": "http://example.com",        "cache_age": 0,        "html": "string",        "thumbnail_url": "http://example.com",        "thumbnail_width": 1,        "thumbnail_height": 1,        "screenshot_url": "http://example.com"      },      "slug": "string"    },    "newsroom": {      "id": 0,      "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",      "name": "string",      "display_name": "string",      "subdomain": "string",      "thumbnail_url": "http://example.com",      "timezone": "europe/london",      "is_active": true,      "is_archived": true,      "is_online": true,      "is_offline": true,      "is_multilingual": true,      "url": "http://example.com",      "links": {        "media_gallery_api": "http://example.com",        "room_contacts_api": "http://example.com",        "analytics_and_visibility_settings": "http://example.com",        "categories_management": "http://example.com",        "company_info_settings": "http://example.com",        "contacts_management": "http://example.com",        "domain_settings": "http://example.com",        "edit": "http://example.com",        "gallery_management": "http://example.com",        "hub_settings": "http://example.com",        "languages": "http://example.com",        "look_and_feel_settings": "http://example.com",        "manual_subscription_management": "http://example.com",        "privacy_settings": "http://example.com",        "widget_settings": "http://example.com"      }    },    "thumbnail_url": "http://example.com",    "recipients_number": 0,    "audience_selection_data": {      "tags": {        "included": [          1        ],        "excluded": [          1        ],        "match": "any"      },      "emails": {        "addresses": [          "user@example.com"        ],        "create_missing_contacts": true      },      "previous_campaigns": [        1      ],      "contact_views": [        "e84dd9cf-e694-4488-bfb6-af5b67542a12"      ]    },    "stats": {      "recipients": 0,      "delivered": 0,      "clicks": 0,      "opens": 0,      "replies": 0,      "bounces": 0,      "unsubscribes": "string",      "clicks_rate": 0,      "opens_rate": 0,      "replies_rate": 0,      "unsubscribes_rate": 0,      "undelivered_rate": 0    },    "created_at": "2019-08-24T14:15:22Z",    "updated_at": "2019-08-24T14:15:22Z",    "scheduled_at": "2019-08-24T14:15:22Z",    "sent_at": "2019-08-24T14:15:22Z",    "delivered_at": "2019-08-24T14:15:22Z"  },  "warnings": [    {      "field": "string",      "code": "string",      "message": "string"    }  ],  "message": "string",  "notifications": [    {      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",      "type": "string",      "style": "success",      "title": "string",      "description": "string",      "actions": [        {          "target": "http://example.com",          "name": "string"        }      ]    }  ]}