To update an existing contact’s details, make a PUT call to the /contacts/{contact_id}
endpoint. The update_source
property is required in the PUT request payload.
Properties
When updating a contact resource, all core properties are updated, overwriting all previous values. Any core properties that are not included or left blank in the request payload are overwritten with the null value.
Subresources
Add or change any of the subresources by including them in the PUT request payload. Excluded subresources in the request payload are preserved.
To learn more about additional contact properties and subresources you can include, see Contact Subresources.
Request Example
The example that follows adds the sms_channel
subresource:
PUT https://api.cc.email/v3/contacts/{contact_id}
Endpoint Requirements
User privileges: contacts:write
Authorization scopes: contact_data
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.cc.email/v3/contacts/{contact_id}',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_POSTFIELDS =>'{
"email_address": {
"address": "dlang21@example.com",
"permission_to_send": "implicit"
},
"update_source": "Account",
"first_name": "Debora",
"last_name": "Lang",
"job_title": "Musician",
"company_name": "Acme Corp.",
"create_source": "Account",
"birthday_month": 11,
"birthday_day": 24,
"anniversary": "2006-11-15",
"phone_numbers": [
{
"phone_number": "+1-555-555-5556",
"kind": "home"
}
],
"street_addresses": [
{
"kind": "home",
"street": "123 Kashmir Valley Road",
"city": "Chicago",
"state": "Illinois",
"postal_code": "60609",
"country": "United States"
}
],
"sms_channel": {
"full_sms_address": "17815551212",
"sms_channel_consents": [
{
"sms_consent_permission": "explicit",
"consent_type": "promotional_sms",
"consent_medium_details": "IPhone 13 device used to provide consent."
}
]
}
}',
CURLOPT_HTTPHEADER => array(
'Accept: */*',
'Content-Type: application/json',
'Authorization: Bearer {access token}'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
curl --location --request PUT 'https://api.cc.email/v3/contacts/{contact_id}' \
--header 'Accept: */*' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {access token}' \
--data-raw '{
"email_address": {
"address": "dlang21@example.com",
"permission_to_send": "implicit"
},
"update_source": "Account",
"first_name": "Debora",
"last_name": "Lang",
"job_title": "Musician",
"company_name": "Acme Corp.",
"create_source": "Account",
"birthday_month": 11,
"birthday_day": 24,
"anniversary": "2006-11-15",
"phone_numbers": [
{
"phone_number": "+1-555-555-5556",
"kind": "home"
}
],
"street_addresses": [
{
"kind": "home",
"street": "123 Kashmir Valley Road",
"city": "Chicago",
"state": "Illinois",
"postal_code": "60609",
"country": "United States"
}
],
"sms_channel": {
"full_sms_address": "17815551212",
"sms_channel_consents": [
{
"sms_consent_permission": "explicit",
"consent_type": "promotional_sms",
"consent_medium_details": "IPhone 13 device used to provide consent."
}
]
}
}'
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"email_address\": {\n \"address\": \"dlang21@example.com\",\n \"permission_to_send\": \"implicit\"\n },\n \"update_source\": \"Account\",\n \"first_name\": \"Debora\",\n \"last_name\": \"Lang\",\n \"job_title\": \"Musician\",\n \"company_name\": \"Acme Corp.\",\n \"create_source\": \"Account\",\n \"birthday_month\": 11,\n \"birthday_day\": 24,\n \"anniversary\": \"2006-11-15\",\n \"phone_numbers\": [\n {\n \"phone_number\": \"+1-555-555-5556\",\n \"kind\": \"home\"\n }\n ],\n \"street_addresses\": [\n {\n \"kind\": \"home\",\n \"street\": \"123 Kashmir Valley Road\",\n \"city\": \"Chicago\",\n \"state\": \"Illinois\",\n \"postal_code\": \"60609\",\n \"country\": \"United States\"\n }\n ],\n \"sms_channel\": {\n \"full_sms_address\": \"17815551212\",\n \"sms_channel_consents\": [\n {\n \"sms_consent_permission\": \"explicit\",\n \"consent_type\": \"promotional_sms\",\n \"consent_medium_details\": \"IPhone 13 device used to provide consent\" \n } \n ] \n }\n} ");
Request request = new Request.Builder()
.url("https://api.cc.email/v3/contacts/{contact_id}")
.method("PUT", body)
.addHeader("Accept", "*/*")
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer {access token}")
.build();
Response response = client.newCall(request).execute();
Response Example
{
"contact_id": "{contact_id}",
"email_address": {
"address": "test123@example.com",
"permission_to_send": "implicit",
"created_at": "2013-11-26T15:46:13-05:00",
"updated_at": "2016-10-28T14:34:35-04:00",
"opt_in_source": "Account",
"opt_in_date": "2018-11-26T15:46:13-05:00",
"confirm_status": "off"
},
"first_name": "Tim",
"last_name": "Jones",
"update_source": "Contact",
"create_source": "Account",
"created_at": "2017-11-26T15:46:13-05:00",
"updated_at": "2018-10-28T14:34:35-04:00",
"street_addresses": [
{
"street_address_id": "{street_address_id}",
"kind": "work",
"street": "1313 Mockingbird Lane",
"city": "Mockingbird Heights",
"state": "California",
"postal_code": "99606-1313",
"country": "United States",
"created_at": "2018-10-28T14:33:10-04:00",
"updated_at": "2018-10-28T14:34:35-04:00"
}
],
"custom_fields": [
{
"custom_field_id": "{custom_field_id}",
"value": "Tesla S 2017"
}
],
"sms_channel": {
"sms_channel_id": "d5e64892-c935-11ef-ae61-ade70b8a5bc5",
"sms_address": "7815551212",
"dial_code": "1",
"country_code": "US",
"create_source": "Account",
"update_source": "Account",
"created_at": "2025-01-02T18:17:33Z",
"updated_at": "2025-01-02T18:17:33Z",
"sms_channel_consents": [
{
"sms_consent_permission": "explicit",
"consent_type": "Promotional_sms",
"opt_in_date": "2025-01-02T18:17:32Z",
"confirmed": false,
"created_at": "2025-01-02T18:17:33Z",
"updated_at": "2025-01-02T18:17:33Z"
}
]
}
}