Retrieve All Subscribers on a List

This page contains information about retrieving all subscribers on a list.

Why Retrieve All Subscribers on a List 

You can use this call to get information about the subscribers on a list, including their subscription status.

How To Retrieve All Subscribers on a List 

Use the sample code below as an example to build your own API calls.

Sample .NET Code 

1// Filter by ListID
2SimpleFilterPart sfp = new SimpleFilterPart();
3sfp.Property = "ListID";
4sfp.SimpleOperator = SimpleOperators.equals;
5sfp.Value = new string[] {"503" };
6// Create the RetrieveRequest ListSubscriber objects
7RetrieveRequest rr = new RetrieveRequest();
8rr.ObjectType = "ListSubscriber";
9rr.Properties = new string[] { "ListID", "SubscriberKey", "Status" };
10rr.Filter = sfp;
11string status = integrationFramework.Retrieve(rr, out requestID, out results);
12// Iterate over the results
13Console.WriteLine("List Subscriber Details:\tList ID\tSubscriberKey\tStatus");
14for (int i = 0; i < results.Length; i++)
15{
16       ListSubscriber ls = (ListSubscriber)results[i];
17       Console.WriteLine("List Subscriber Details:\t{0}\t{1}\t{2}", ls.ListID, ls.SubscriberKey, ls.Status);
18}

Output 

1List Subscriber Details:      List ID   SubscriberKey         Status
2List Subscriber Details:      503       test1@example.com     Active
3List Subscriber Details:      503       test2@example.com     Active
4List Subscriber Details:      503       hello@example.com     Active
5List Subscriber Details:      503       hello22@example.com   Unsubscribed

Sample SOAP Envelope 

1<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
2   <Header>
3      <fueloauth>YOUR_ACCESS_TOKEN</fueloauth>
4   </Header>
5   <Body>
6      <RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
7         <RetrieveRequest>
8            <ObjectType>ListSubscriber</ObjectType>
9            <Properties>ObjectID</Properties>
10            <Properties>SubscriberKey</Properties>
11            <Properties>CreatedDate</Properties>
12            <Properties>ModifiedDate</Properties>
13            <Properties>Client.ID</Properties>
14            <Properties>Client.PartnerClientKey</Properties>
15            <Properties>ListID</Properties>
16            <Properties>Status</Properties>
17            <Filter xmlns:ns1="http://exacttarget.com/wsdl/partnerAPI" xsi:type="ns1:SimpleFilterPart">
18               <Property>ListID</Property>
19               <SimpleOperator>equals</SimpleOperator>
20               <Value>503</Value>
21            </Filter>
22         </RetrieveRequest>
23      </RetrieveRequestMsg>
24   </Body>
25</Envelope>