Get details about a segment.

Make a DELETE call to the /segments/{segment_id} endpoint to delete a segment from your account.

Before deleting a segment, verify that the segment is not associated with a scheduled campaign.

Deleted segments do not display in the results when using the GET /segments endpoint. If you know the segment_id, you can use the GET /segments/{segment_id} endpoint to view the deleted segment’s details. A segment’s details are preserved for external reference purposes, such as displaying the segment name in the campaign’s history.

Authorization Requirements

User privileges: contacts:lists:write

Authorization scopes: contact_data

Parameters

In the path parameter, specify the segment_id for the segment that you want to delete. A 204 message is returned if the segment is successfully deleted from your account. If the segment_id does not exist for the account, a 404 error response is returned.

Example DELETE Segment Request

DELETE https://api.cc.email/v3/segments/{segment_id}

 <?php
 
 $request = new HttpRequest();
 $request->setUrl('https://api.cc.email/segments/12');
 $request->setMethod(HTTP_METH_DELETE);
 
 $request->setHeaders(array(
   'cache-control' => 'no-cache',
   'Connection' => 'keep-alive',
   'Accept-Encoding' => 'gzip, deflate',
   'Host' => 'host_name.com',
   'Cache-Control' => 'no-cache',
   'Authorization' => 'Bearer {access_token}'
   'Content-Type' => 'application/json',
   'Accept' => '*/*'
 ));
 
 try {
   $response = $request->send();
 
   echo $response->getBody();
 } catch (HttpException $ex) {
   echo $ex;
 }
curl -X DELETE \
  https://api.cc.email/segments/12 \
  -H 'Accept: */*' \
  -H 'Accept-Encoding: gzip, deflate' \
  -H 'Authorization: Bearer {access_token}' \
  -H 'Cache-Control: no-cache' \
  -H 'Connection: keep-alive' \
  -H 'Content-Length: ' \
  -H 'Content-Type: application/json' \
  -H 'Host: host_name.com' \
  -H 'cache-control: no-cache'
 
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cc.email/v3/segments/12")
  .delete()
  .addHeader("Content-Type", "application/json")
  .addHeader("Authorization", "Bearer {access_token}")
  .addHeader("Accept", "*/*")
  .addHeader("Cache-Control", "no-cache")
  .addHeader("Host", "host_name.com")
  .addHeader("Accept-Encoding", "gzip, deflate")
  .addHeader("Content-Length", "")
  .addHeader("Connection", "keep-alive")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();

Try it!