# List all segments

You can fetch a list of all segments.
Segment names are returned HTML-escaped, for example `&` as `&amp;`.
Requires the `read_users_companies` or `write_users_companies` OAuth scope.

Endpoint: GET /segments
Version: 2.17
Security: bearerAuth

## Query parameters:

  - `include_count` (boolean)
    Includes the count of contacts that belong to each segment. The counts are added whenever this parameter has a value in the query string, even `false` or an empty one, so omit it entirely to leave them out. A bare `include_count` with no `=` adds no counts. With `type=company`, a company segment gets no count unless a contact segment has the same name, and then it shows that contact segment's count.

  - `type` (string)
    Pass `company` to list company segments. Any other value, or no value, lists contact segments.

## Header parameters:

  - `Intercom-Version` (string)

## Response 200 fields (application/json):

  - `type` (string)
    The type of the object
    Enum: "segment.list"

  - `segments` (array)
    A list of Segment objects

  - `segments.type` (string)
    The type of object.
    Enum: "segment"

  - `segments.id` (string)
    The unique identifier representing the segment.
    Example: 56203d253cba154d39010062

  - `segments.name` (string)
    The name of the segment.
    Example: Active

  - `segments.created_at` (integer)
    The time the segment was created.
    Example: 1394621988

  - `segments.updated_at` (integer)
    The time the segment was updated.
    Example: 1394622004

  - `segments.person_type` (string)
    Type of the contact: contact (lead) or user.
    Enum: "contact", "user"

  - `segments.count` (integer)
    The number of items in the user segment. It's returned when the request has `include_count` with a value. A company segment only gets a count when a contact segment has the same name, and it shows that segment's count.
    Example: 3

## Response 401 fields (application/json):

  - `type` (string, required)
    The type is error.list
    Example: error.list

  - `request_id` (string)
    Example: f93ecfa8-d08a-4325-8694-89aeb89c8f85

  - `errors` (array, required)
    An array of one or more error objects

  - `errors.code` (any, required)
    A string indicating the kind of error, used to further qualify the HTTP response code. A few request validation errors send an HTTP status code as an integer here instead, for example `422`.
    Example: unauthorized

  - `errors.message` (string)
    Optional. Human readable description of the error.
    Example: Access Token Invalid

