Delete multiple custom fields.

Use the POST /activities/custom_fields_delete endpoint to create an asynchronous activity used to remove up to 100 custom fields from contacts and deletes the custom fields from an account. To specify which custom fields to delete, use the custom_field_ids array of string values in the request body. For example:

{
  "custom_field_ids": [
    "12891e3a-ce57-11e9-802a-fa163e56c9b0",
    "03826410-fb5f-11e5-b153-00163e01f192"
  ]
}

Example Request

POST https://api.cc.email/v3/activities/custom_fields_delete

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/activities/custom_fields_delete',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
  "custom_field_ids": [
    "12341e3a-ce57-11e9-802a-fa163e56c9b0","03821234fb5f-11e5-b153-00163e01f192"
  ]
}
',
  CURLOPT_HTTPHEADER => array(
    'Accept: */*',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;


curl --location --request POST 'https://api.cc.email/activities/custom_fields_delete' \
--header 'Accept: */*' \
--header 'Content-Type: application/json' \
--data-raw '{
  "custom_field_ids": [
    "12341e3a-ce57-11e9-802a-fa163e56c9b0","03821234-fb5f-11e5-b153-00163e01f192"
  ]
}
'
OkHttpClient client=new OkHttpClient().newBuilder()
        .build();
        MediaType mediaType=MediaType.parse("application/json");
        RequestBody body=RequestBody.create(mediaType,"{\n  \"custom_fields_ids\": [\n    \"12341e3a-ce57-11e9-802a-fa163e56c9b0\",\"03821234-fb5f-11e5-b153-00163e01f192\"\n  ]\n}\n");
        Request request=new Request.Builder()
        .url("https://api.cc.email/activities/custom_field_delete")
        .method("POST",body)
        .addHeader("Accept","*/*")
        .addHeader("Content-Type","application/json")
        .build();
        Response response=client.newCall(request).execute();

Example Response

{
  "activity_id": "0c2712b8-9700-11eb-a392-33d450967a54",
  "state": "initialized",
  "created_at": "2021-04-06T17:46:42Z",
  "updated_at": "2021-04-06T17:46:42Z",
  "percent_done": 1,
  "activity_errors": [],
  "status": {},
  "_links": {
    "self": {
      "href": "/v3/activities/0c2712b8-9700-11eb-a392-33d450967a54"
    }
  }
}

Checking the Activity Status for Job Complete

Check on the activity status by calling the activity status endpoint using the activity_id provided in the _links section of the response. The activity_id is located in the href link. To retrieve the status, make the following GET call:

GET https://api.cc.email/v3/activities/{activity_id}

Endpoint Requirements

User privileges: contacts:write

Authorization scopes: contact_data

Try it!