List Leads

Example Request

$ curl https://api.intercom.io/contacts \
-H 'Authorization:Bearer <Your access token>' \
-H 'Accept: application/json'
HTTP/1.1 200 OK

{
  "type": "contact.list",
  "total_count": 105,
  "contacts": [
    {
      "type": "contact",
      "id": "530370b477ad7120001d",
       ...
     },
     ...
   ],
  "pages": {
    "next": "https://api.intercom.io/contacts?per_page=50&page=2",
    "page": 1,
    "per_page": 50,
    "total_pages": 3
  }
}

# NB: Full Contact objects are returned
intercom.contacts.all.each { ... }
<?php
$leads= $intercom->leads->getLeads([]);
foreach ($leads->contacts as $lead) {
    print_r($lead->id);
    echo "\n";
}
?>
ContactCollection contacts = Contact.list();

// get first page...
List<Contact> items = contacts.getPageItems();

// ...or iterate over all pages
while (contacts.hasNext()) {
    out.println(contacts.next().getID());
}

You can fetch a list of all leads. The lead list is sorted by the created_at field and by default is ordered descending, most recently created first. Apart from sorting, the same parameters for the User list apply here.