To remove all contacts that are members on a specified list and delete the list, make a DELETE call to the /contact_lists/{list_id
} endpoint. This request updates a contacts list memberships, it does not delete the contact.
Example Request
Delete list requests are processed asynchronously. To track the status of the request, make a GET call to the links
URI returned in the response.
DELETE https://api.cc.email/v3/contact_lists/{list_id}
Endpoint Requirements
User privileges: contacts:lists:write
Authorization scopes: contact_data
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.cc.email/v3/lists/{list_id}")
.method("DELETE", body)
.addHeader("Accept", "*/*")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.cc.email/v3/lists/{list_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 => 'DELETE',
CURLOPT_HTTPHEADER => array(
'Accept: */*',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
curl --location --request DELETE 'https://api.cc.email/v3/lists/{list_id}' \
--header 'Accept: */*' \
--header 'Content-Type: application/json'
Example Responses
The following example response is returned for the asynchronous DELETE request:
{
"activity_id": "dc5b730e-43f5-11ed-938d-158fe26710f1",
"state": "initialized",
"created_at": "2022-10-04T15:04:36Z",
"updated_at": "2022-10-04T15:04:36Z",
"percent_done": 1,
"activity_errors": [],
"status": {
"list_count": 1
},
"_links": {
"self": {
"href": "/v3/activities/04fa57a7-cf55-4185-cc1a-58ed29bf0a6a"
}
}
}
To track the status for the activity, you can make a GET call to the href
url link or make a GET call to the Get /activities/{activity_id}
endpoint and specify the activity_id
to use.
The following response shows that the delete list activity completed successfully:
{
"activity_id": "dc5b730e-43f5-11ed-938d-158fe26710f1",
"state": "completed",
"started_at": "2022-10-04T15:04:36Z",
"completed_at": "2022-10-04T15:04:36Z",
"created_at": "2022-10-04T15:04:36Z",
"updated_at": "2022-10-04T15:04:36Z",
"percent_done": 100,
"activity_errors": [],
"status": {
"items_total_count": 1,
"items_completed_count": 1,
"list_count": 1
},
"_links": {
"self": {
"href": "/v3/activities/dc5b730e-43f5-11ed-938d-158fe26710f0"
}
}
}
Constant Contact does not sell or rent email addresses. Users are not permitted to upload or use purchased, traded, shared, or borrowed lists to their Constant Contact account.
Review our permission policy for more information.