list method

list ( string apikey, string id, string status, array segment , string since, string hashed )

Exports/dumps members of a list and all of their associated details. This is a very similar to exporting via the web interface.

Full URL:


apikey a valid API Key for your user account. Get by visiting your API dashboard
id the list id to get members from (can be gathered using lists())
status optional – the status to get members for - one of (subscribed, unsubscribed, cleaned), defaults to subscribed
segment optional – pull only a certain Segment of your list. For help with what this array should contain: see campaignSegmentTest(). It's also suggested that you test your options against campaignSegmentTest().
since optional – only return member whose data has changed since a GMT timestamp – in YYYY-MM-DD HH:mm:ss format
hashed optional – if, instead of full list data, you'd prefer a hashed list of email addresses, set this to the hashing algorithm you expect. Currently only "sha256" is supported.
text a plain text dump of JSON objects. The first row is a header row. Each additional row returned is an individual JSON object. Rows are delimited using a newline (\n) marker, so implementations can read in a single line at a time, handle it, and move on.

PHP Example

$apikey = 'YOUR_API_KEY';
$list_id = 'YOUR_LIST_ID';
$chunk_size = 4096; //in bytes
$url = ''.$apikey.'&id='.$list_id;

/** a more robust client can be built using fsockopen **/
$handle = @fopen($url,'r');
if (!$handle) {
  echo "failed to access url\n";
} else {
  $i = 0;
  $header = array();
  while (!feof($handle)) {
    $buffer = fgets($handle, $chunk_size);
    if (trim($buffer)!=''){
      $obj = json_decode($buffer);
      if ($i==0){
        //store the header row
        $header = $obj;
      } else {
        //echo, write to a file, queue a job, etc.
        echo $header[0].': '.$obj[0]."\n";