Newer Version Available

This content describes an older version of this product. View Latest

Consent

Your users can store consent preferences in different locations and possibly inconsistently. You can locate your customers’ preferences for consent across multiple records when using API version 44.0 and later. Tracking consent preferences helps you and your users respect the most restrictive requests.

Syntax

Consent API aggregates consent settings across the Contact, Individual, Lead, Person Account, and User objects when the records have a lookup relationship.

URI

/services/data/v44.0/consent/action/action?ids=list_of_Ids&verbose=true_or_false&aggregatedConsent=true_or_false

Available since release
44.0
Formats
JSON
HTTP methods
GET
Authentication
Authorization: Bearer token
Request body
None
Request parameters
Parameter Description
action Required. Allowed values are:
  • email
  • fax
  • geotrack
  • phone
  • portability
  • process
  • profile
  • shouldForget
  • solicit
  • storePiiElsewhere
  • track

    When you select email as the action, the API only aggregates consent for records that contain the same email address. If the record ID specified in the URI is associated with a record that contains a different email address, the consent settings of the associated record aren’t included in the API response.

    Note

aggregatedConsent Optional: true or false. aggregatedConsent is the same as aggregatedConsent=true. If true, one result is returned indicating whether to proceed or not, rather than a result for each ID. If any ID in the list returns false, the aggregated result is false.
ids Required. Comma-separated list of IDs. The ID can be the record ID or the email address listed on the record.
verbose Optional: true or false. verbose is the same as verbose=true. Verbose responses are slower than non-verbose responses. See the examples for a verbose response.
Error Codes
Code Description
CONVERTED_LEAD_IS_INVALID Converted leads aren’t allowed.
INFO_NOT_FOUND No consent information was found, although the record ID or email address was valid.
INVALID_ID The format of the record ID doesn’t match the format of record IDs from Contact, Individual, Lead, Person Account, or User.
URI_TOO_LONG The total length of the URL is limited to 16K characters, which is about 800 IDs in a request.

Security

To call Consent API, you must have either the View All Data or the Allow User Access to Privacy Data user permission. Requiring a perm ensures that the System Administrator gives explicit permission. This API accesses org-wide consent data, such as links between records and the value of consent flags, not just records to which the user ordinarily has access.

Examples

Simple URI structure
1/services/data/v44.0/consent/action/track?ids=003xx000004TxyY,00Qxx00000syyO,003zz000004zzZ
Email addresses as IDs, and a verbose response
1/services/data/v44.0/consent/action/email?ids=j0t5t5b2@tkbxp5ia.com,4quxlswo@23wj7pwh.com&verbose=true

Response

1{
2  "j0t5t5b2@tkbxp5ia.com" : {
3    "result" : "Success",
4    "proceed" : {
5      "email" : "false"
6    },
7    "explanation" : [ {
8      "objectConsulted" : "Contact",
9      "field" : "HasOptedOutOfEmail",
10      "recordId" : "003xx000004TxyY",
11      "value" : "true"
12    } ]
13  },
14  "4quxlswo@23wj7pwh.com" : {
15    "result" : "Success",
16    "proceed" : {
17      "email" : "true"
18    },
19    "explanation" : [ {
20      "objectConsulted" : "Contact",
21      "field" : "HasOptedOutOfEmail",
22      "recordId" : "003xx000004TxyZ",
23      "value" : "false"
24    } ]
25  }
26}

Usage

The following table shows how the API responses are determined.

When the API compares consent settings across records, it doesn’t incorporate settings from converted leads.

Note

Action Fields Consulted API Response Response Schema
email
  • Contact.HasOptedOutOfEmail
  • Lead.HasOptedOutOfEmail
  • PersonAccount.HasOptedOutOfEmail

Returns TRUE if all consulted field values are 0.

Returns FALSE if any consulted field value is 1 or if no related Contact, Lead, or Person Account object exists.

{

"<ID/Email>" :

{

"result" : "<Success/errormessage>",

"proceed" : { "email" : "<true/false>" }

}

}

fax
  • Contact.HasOptedOutOfFax
  • Lead.HasOptedOutOfFax
  • PersonAccount.HasOptedOutOfFax

Returns TRUE if all consulted field values are 0.

Returns FALSE if any consulted field value is 1 or if no related Contact, Lead, or Person Account object exists.

{

"<ID/Email>" :

{

"result" : "<Success/errormessage>",

"proceed" : { "fax" : "<true/false>" }

}

}

geotrack Individual.HasOptedOutGeoTracking

Returns TRUE if the consulted field value is 0.

Returns FALSE if the consulted field value is 1 or if no related Individual object exists.

{

"<ID/Email>" :

{

"result" : "<Success/errormessage>",

"proceed" : { "geotrack" : "<true/false>" }

}

}

phone
  • Contact.DoNotCall
  • Lead.DoNotCall
  • PersonAccount.DoNotCall

Returns TRUE if all consulted field values are 0.

Returns FALSE if any consulted field value is 1 or if no related Contact, Lead, or Person Account object exists.

{

"<ID/Email>" :

{

"result" : "<Success/errormessage>",

"proceed" : { "phone" : "<true/false>" }

}

}

portability Individual.SendIndividualData

Returns TRUE if the consulted field value is 1.

Returns FALSE if the consulted field value is 0 or if no related Individual object exists.

{

"<ID/Email>" :

{

"result" : "<Success/errormessage>",

"proceed" : { "portability" : "<true/false>" }

}

}

process Individual.HasOptedOutProcessing

Returns TRUE if the consulted field value is 0.

Returns FALSE if the consulted field value is 1 or if no related Individual object exists.

{

"<ID/Email>" :

{

"result" : "<Success/errormessage>",

"proceed" : { "process" : "<true/false>" }

}

}

profile Individual.HasOptedOutProfiling

Returns TRUE if the consulted field value is 0.

Returns FALSE if the consulted field value is 1 or if no related Individual object exists.

{

"<ID/Email>" :

{

"result" : "<Success/errormessage>",

"proceed" : { "profile" : "<true/false>" }

}

}

shouldForget Individual.ShouldForget

Returns TRUE if the consulted field value is 1.

Returns FALSE if the consulted field value is 0 or if no related Individual object exists.

{

"<ID/Email>" :

{

"result" : "<Success/errormessage>",

"proceed" : { "shouldForget" : "<true/false>" }

}

}

solicit Individual.HasOptedOutSolicit

Returns TRUE if the consulted field value is 0.

Returns FALSE if the consulted field value is 1 or if no related Individual object exists.

{

"<ID/Email>" :

{

"result" : "<Success/errormessage>",

"proceed" : { "solicit" : "<true/false>" }

}

}

storePIIElsewhere Individual.CanStorePiiElsewhere

Returns TRUE if the consulted field value is 1.

Returns FALSE if the consulted field value is 0 or if no related Individual object exists.

{

"<ID/Email>" :

{

"result" : "<Success/errormessage>",

"proceed" : { "storePIIElsewhere" : "<true/false>" }

}

}

track Individual.HasOptedOutTracking

Returns TRUE if the consulted field value is 0.

Returns FALSE if the consulted field value is 1 or if no related Individual object exists.

{

"<ID/Email>" :

{

"result" : "<Success/errormessage>",

"proceed" : { "track" : "<true/false>" }

}

}