The clearLists function is deprecated.


The clearLists function allows you to remove all contacts from a list, hence leaving it completely empty. This does not delete the contacts from your account. The clearLists call:

  • Does not generate events for contacts removed from the affected lists.
  • Will not trigger workflows when contacts are removed from the affected lists.
  • Might result in incorrect membership for segments that reference the affected lists.

If you need any of the above behaviors, you should not use the clearLists function. You should call readContacts using the list as a filter to get a list of contact IDs and then call removeFromList to remove these contacts from the list.


writeResult = bApi.clearLists(mailListObject[] lists);


Name Type Required Description
id string Yes (unless the list name is used) The unique id assigned to the list. You can obtain the id for a list by calling readLists, or by looking at the footer when viewing the overview page for an individual list in the application.
name string Yes (unless name the list id is used) The internal name of the list.

PHP Code Example

This example will clear two lists of all contacts on those lists.
You must edit the code to refer to the list id you wish to clear.
$client = new SoapClient('', array(
  'trace' => 1,
setlocale(LC_ALL, 'en_US');
try {
  $token = "YOUR API TOKEN";
  print "logging in ";
  $sessionId = $client->login(array(
    'apiToken' => $token
  $session_header = new SoapHeader("", 'sessionHeader', array(
    'sessionId' => $sessionId
  $ids = array(
      'id' => 'YOUR FIRST LIST ID'
    ) ,
      'id' => 'YOUR SECOND LIST ID'
  $res = $client->clearLists($ids)->return;
  if ($res->errors) {
    print "There was a problem clearing your lists: ";
    print $res->results[$res->errors[0]]->errorString . " ";
  else {
    print "Lists have been cleared ";
catch(Exception $e) {
  print "uncaught exception\n";