Body
-
This is a list of objects that describes a contact's opt-in status. Each object contains the following fields:
contact_id
, which must be a string representing phone number in E.164 format;correlation_id
, a unique 32-character UUID used to uniquely map the request item with the response item;sender_id
, which can be either a valid messaging service SID or a from phone number;status
, a string representing the consent status. Can be one of [opt-in
,opt-out
];source
, a string indicating the medium through which the consent was collected. Can be one of [website
,offline
,opt-in-message
,opt-out-message
,others
];date_of_consent
, an optional datetime string field in ISO-8601 format that captures the exact date and time when the user gave or revoked consent. If not provided, it will be empty.
curl \
--request POST 'https://accounts.twilio.com/v1/Consents/Bulk' \
--user "username:password" \
--header "Content-Type: application/x-www-form-urlencoded" \
--data 'Items=%7B%22contact_id%22%3A%22%2B19999999999%22%2C%22correlation_id%22%3A%22ad388b5a46b33b874b0d41f7226db2ef%22%2C%22sender_id%22%3A%22MG00000000000000000000000000000001%22%2C%22date_of_consent%22%3A%222025-02-28T10%3A05%3A27Z%22%2C%22status%22%3A%22opt-out%22%2C%22source%22%3A%22website%22%7D&Items=%7B%22contact_id%22%3A%22%2B19%22%2C%22correlation_id%22%3A%2202520cfa6c432f0e3ec3a38c122d428d%22%2C%22sender_id%22%3A%22123456%22%2C%22date_of_consent%22%3A%222025-03-25%22%2C%22status%22%3A%22opt-in%22%2C%22source%22%3A%22opt-in-message%22%7D'
{"Items"=>["{\"contact_id\":\"+19999999999\",\"correlation_id\":\"ad388b5a46b33b874b0d41f7226db2ef\",\"sender_id\":\"MG00000000000000000000000000000001\",\"date_of_consent\":\"2025-02-28T10:05:27Z\",\"status\":\"opt-out\",\"source\":\"website\"}", "{\"contact_id\":\"+19\",\"correlation_id\":\"02520cfa6c432f0e3ec3a38c122d428d\",\"sender_id\":\"123456\",\"date_of_consent\":\"2025-03-25\",\"status\":\"opt-in\",\"source\":\"opt-in-message\"}"]}
{
"items": [
{
"error_code": 0,
"correlation_id": "ad388b5a46b33b874b0d41f7226db2ef",
"error_messages": []
},
{
"error_code": 30646,
"correlation_id": "02520cfa6c432f0e3ec3a38c122d428d",
"error_messages": [
"INVALID_CONTACT_ID",
"INVALID_DATE_OF_CONSENT"
]
}
]
}