Update member's campaign consent preferences
PUT /api/members/{memberId}/campaign
- Products: Operator (
FOH), Consumer (CONSUMER) (any one of these products, not all) - Features: Online Bookings (
ONLINEBOOK), Online Joining (ONLINEJOIN), Front of House Generic Access (FOHGENERIC) (any one of these features, not all)
Overview
Sets which marketing and data-processing campaigns a member has consented to.
This is a full replacement, not an incremental opt-in. Every campaign consent the member currently holds is deleted and the list is recreated from your request. Send the member's complete set of campaign consents on every call — anything you leave out is withdrawn. Sending "campaignPreferences": [] with optInForAllCampaignsConfigured set to false removes all of the member's campaign consents. Communication-channel consents are managed separately and are not touched by this call.
There are two mutually exclusive ways to call it:
- Name the campaigns. Set
optInForAllCampaignsConfiguredtofalseand list the campaigns incampaignPreferences. - Opt in to everything configured. Set
optInForAllCampaignsConfiguredtotrueand omitcampaignPreferencesentirely. Sending both — including sending an empty array alongsidetrue— is rejected with400. The member is then consented to exactly the campaigns in the tenant's join-time opt-in configuration forsiteId.
One behaviour will surprise you: if the member is younger than the tenant's configured age of consent, the call returns 204 No Content and changes nothing at all. Juniors are never consented into campaigns, and there is no error to tell you that. Check the member's date of birth before relying on this call.
Each consent is written with a capture date of now and an expiry date taken from the campaign's own configuration.
Linked members are permitted — a token issued for a member linked to {memberId} may call this endpoint.
Endpoint
PUT {base_url}/api/members/{memberId}/campaign
{base_url} is the environment URL issued to your integration. See Authenticating with Gladstone APIs.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
memberId | integer (int32) | Yes | The member whose campaign consents are replaced. Must match the member id in your access token, or be a member linked to it. |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
siteId | string | No | The centre whose join-time opt-in configuration is read when optInForAllCampaignsConfigured is true. Maximum 15 characters. Ignored when you list campaigns yourself. Omit it to fall back to the tenant-wide configuration value. |
optInForAllCampaignsConfigured | boolean | No | Consent the member to every campaign named in the tenant's join opt-in configuration instead of listing them yourself. Defaults to false when omitted. When true, campaignPreferences must be absent, and the call fails with 422 if that configuration is missing or names campaigns that no longer exist. |
campaignPreferences | array of object | No | The complete set of campaigns the member consents to. Omitting it, or sending [], withdraws all existing campaign consents. Must be absent when optInForAllCampaignsConfigured is true. |
campaignPreferences[].campaignId | string | Yes | The id of a campaign the member consents to. Must be an active campaign — retrieve valid ids from Get all marketing campaigns or Get all data processing campaigns. Unknown, inactive or reserved ids are rejected with 400, naming the offending id. |
campaignPreferences[].guardianName | string | No | The name of the parent or guardian consenting on behalf of a member under the tenant's marketing age of consent. Maximum 50 characters. Required for those members — if any entry in the array omits it and the member is under age, the whole call is rejected with 400. Leave it out for adults. |
Sample request
curl -X PUT '{base_url}/api/members/{memberId}/campaign' \
-H 'Authorization: Bearer {accessToken}' \
-H 'X-Use-SSO: true' \
-H 'Content-Type: application/json' \
-d '{
"siteId": "string",
"optInForAllCampaignsConfigured": false,
"campaignPreferences": [
{
"campaignId": "string",
"guardianName": "string"
}
]
}'Errors
A successful call returns 204 No Content — including the silent no-op for junior members described in the Overview.
| Status | Meaning | When |
|---|---|---|
400 | Bad request | optInForAllCampaignsConfigured is true and campaignPreferences is present, even as an empty array: When opting for allocating all configured campaigns to a member, the campaign preferences does not need to be set. |
400 | Bad request | A campaign id is not an active, consentable campaign: The given campaign ID is invalid. [CampaignId: {campaignId}] |
400 | Bad request | The member is under the marketing age of consent and an entry has no guardian: The member is under the age of consent therefore a guardian name is required. |
400 | Bad request | campaignId is missing, siteId exceeds 15 characters, or guardianName exceeds 50 characters. Returned as a validation error object keyed by field name rather than a plain string. |
404 | Not found | No member exists with that id: The given member doesn't exist. [MemberId: {memberId}] |
409 | Conflict | Not returned by this endpoint. |
422 | Unprocessable entity | optInForAllCampaignsConfigured is true but the tenant has no join opt-in configuration, or it names campaigns that do not exist: No configuration value was found for the configuration key or the value does not match with the campaigns found. [ConfigurationKey: …] |
500 | Internal server error | The update could not be saved, or another unexpected server-side failure occurred. No detail is returned in the body. |