When using the API1 function, addfilter, the newly created filter can be viewed with the API2 function, listfilters, but for some reason do not appear in cPanel itself. Furthermore, there seems no way to delete these filters, either with the API1 function delfilter or the API2 function deletefilter. This is how it is created:
And these were the attempts to remove it:
What have I done wrong? 
Code:
$args = array($sEmail, "contains", "header_to", "Discard");
$xmlapi->api1_query($account, "Email", "addfilter", $args);
Code:
$args = array($sEmail, "Discard");
$xmlapi->api1_query($account, "Email", "delfilter", $args);
Code:
$params = array('account'=>$sEmail, 'filtername'=>"$header_to contains '[email protected]'",);
$xmlapi->api2_query($account, "Email", "deletefilter", $params);