recordContactConsent
Requires permission communications:consent:update.
Records a contact's consent status for a channel and purpose, with where it came from. The contact's customer must be in the caller's own book. Requires permission to update consent.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
mutation RecordContactConsent($input: RecordContactConsentInput!) {
recordContactConsent(input: $input) {
id
status
channel
contactId
occurredAt
partnerId
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation RecordContactConsent($input: RecordContactConsentInput!) {\n recordContactConsent(input: $input) {\n id\n status\n channel\n contactId\n occurredAt\n partnerId\n }\n}",
"variables": {
"input": {
"channel": "EMAIL",
"contactId": "id",
"purpose": "BROADCAST",
"source": "ADMIN",
"status": "OPTED_IN"
}
}
}
EOF
Variables:
{
"input": {
"channel": "EMAIL",
"contactId": "id",
"purpose": "BROADCAST",
"source": "ADMIN",
"status": "OPTED_IN"
}
}
Response:
{
"data": {
"recordContactConsent": {
"id": "id",
"status": "OPTED_IN",
"channel": "EMAIL",
"contactId": "id",
"occurredAt": "2025-01-15T00:00:00Z",
"partnerId": "id"
}
}
}
recordContactConsent(
input: RecordContactConsentInput!
): ContactConsentGql!
Arguments
recordContactConsent.input ● RecordContactConsentInput! non-null input
The contact, channel, purpose, consent status and source.
Type
ContactConsentGql object
A contact's consent for one channel and purpose.