Remove a tag from all assigned contacts and delete the tag.

Make a DELETE call to the /contact_tags/{tag_id} endpoint to start an asynchronous activity to remove the specified tag from all contacts to which it is assigned and then delete the tag. The following shows an example response with tag details:

{
    "activity_id": "2bfb15ba-5cc9-11eb-90d3-fa163ef30123",
    "state": "initialized",
    "created_at": "2021-01-22T15:47:46Z",
    "updated_at": "2021-01-22T15:47:46Z",
    "percent_done": 1,
    "activity_errors": [],
    "status": {},
    "_links": {
        "self": {
            "href": "/v3/activities/{activity_id}"
        }
    }
}
  • activity_id : The ID used to uniquely identify the asynchronous delete activity.
  • state: The current processing state for the activity (initialized, processing, completed, cancelled, failed, timed_out).
  • created_at: The system generated date and time that the resource was created (ISO-8601 format).
  • updated_at: The system generated date and time that the resource was last updated (ISO-8601 format).
  • percent_done: The percentage complete for the specified activity.
  • activity_errors: An array of error messages, if errors occurred. The array returns empty if no errors occur.
  • status: Lists the total number of contacts to which the tag applies (items_total_count) and the current total number of contacts from which the tag has was deleted (items_completed_count).
  • _links: The link returned in the response that you use to retrieve the status for the specified activity. Use the href link returned in the response to view the activity details.

Parameters

When making a DELETE call to the /contact_tags/{tag_id}, use the tag_id path query parameter to return details about the delete tag request. This is an asynchronous activity. Use the href link returned in the response to view activity details for the delete request.

Authorization Requirements

User privileges: contacts:write

Authorization scopes: contact_data

Example DELETE Tag Requests

DELETE https://api.cc.email/v3/contact_tags/{tag_id}

 <?php
 
 <?php
 
 $curl = curl_init();
 
 curl_setopt_array($curl, array(
   CURLOPT_URL => 'https://api.cc.email/v3/contact_tags/{tag_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(
     'Authorization: Authorization: Bearer {access_token}'
   ),
 ));
 
 $response = curl_exec($curl);
 
 curl_close($curl);
 echo $response;


curl --location --request DELETE 'https://api.cc.email/v3/contact_tags/{tag_id'}' \
--header 'Authorization: Bearer {access_token}'
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("https://api.cc.email/v3/contact_tags/{tag_id")
  .method("DELETE", body)
  .addHeader("Authorization", "Bearer {access_token"};
Response response = client.newCall(request).execute();

Response

 {
     "activity_id": "2bfb15ba-5cc9-11eb-90d3-fa163ef30123",
     "state": "initialized",
     "created_at": "2021-01-22T15:47:46Z",
     "updated_at": "2021-01-22T15:47:46Z",
     "percent_done": 1,
     "activity_errors": [],
     "status": {},
     "_links": {
         "self": {
             "href": "/v3/activities/{activity_id}"
         }
     }
 }

Try it!