List all segments

Example Request & Response

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

{
  "type": "segment.list",
  "segments": [
    {
      "created_at": 1393613031,
      "id": "5310d8e7598c9a0b24000002",
      "name": "Active",
      "type": "segment",
      "updated_at": 1393613031
    },
    {
      "created_at": 1393613030,
      "id": "5310d8e6598c9a0b24000001",
      "name": "New",
      "type": "segment",
      "updated_at": 1393613030
    },
    {
      "created_at": 1393613031,
      "id": "5310d8e7598c9a0b24000003",
      "name": "Slipping Away",
      "type": "segment",
      "updated_at": 1393613031
    }
  ]
}
intercom.segments.all.each { ... }
<?php
$intercom->segments->getSegments([]);
?>
SegmentCollection segments = Segment.list();
while (segments.hasNext()) {
    out.println(segments.next().getId());
}

You can fetch a list of all segments.

Request Query Parameters

ParameterTypeRequired?Description
include_countBooleanNoIt includes the count of contacts that belong to each segment.

Response

This will return a list of Segment Objects. The result may also have a pages object if the response is paginated.

AttributeTypeDescription
typeStringvalue is 'segment.list'
segmentsArrayA list of segment objects
pagesObjectOptional. A pagination object, which may be empty, indicating no further pages to fetch.