# Returns all Target Groups

Returns Target Group details for the given account

Endpoint: GET /cf/admin/segments
Version: 1.0
Security: x-api-key

## Query parameters:

  - `accountIdentifier` (string, required)
    Account Identifier

  - `orgIdentifier` (string, required)
    Organization Identifier

  - `environmentIdentifier` (string, required)
    Environment Identifier

  - `projectIdentifier` (string, required)
    The Project identifier

  - `pageNumber` (integer)
    PageNumber

  - `pageSize` (integer)
    PageSize

  - `sortOrder` (string)
    SortOrder
    Enum: "ASCENDING", "DESCENDING"

  - `sortByField` (string)
    SortByField
    Enum: "name", "identifier", "archived", "kind", "modifiedAt"

  - `name` (string)
    Name of the field

  - `identifier` (string)
    Identifier of the field

  - `rules` (string)
    When set to rules=v2 will return AND rule compatible serving_rules field. When not set or set to any other value will return old rules field only compatible with OR rules.

## Response 200 fields (application/json):

  - `itemCount` (integer, required)
    The total number of items
    Example: 1

  - `pageCount` (integer, required)
    The total number of pages
    Example: 100

  - `pageIndex` (integer, required)
    The current page

  - `pageSize` (integer, required)
    The number of items per page
    Example: 1

  - `version` (integer)
    The version of this object.  The version will be incremented each time the object is modified
    Example: 5

  - `segments` (array)

  - `segments.createdAt` (integer)
    The data and time in milliseconds when the group was created

  - `segments.environment` (string)
    The environment this target group belongs to
    Example: "Production"

  - `segments.excluded` (array)
    A list of Targets who are excluded from this target group

  - `segments.excluded.account` (string, required)
    The account ID that the target belongs to
    Example: "abcXDdffdaffd"

  - `segments.excluded.anonymous` (boolean)
    Indicates if this target is anonymous

  - `segments.excluded.attributes` (object)
    a JSON representation of the attributes for this target
    Example: {"age":20,"location":"Belfast"}

  - `segments.excluded.createdAt` (integer)
    The date and time in milliseconds when this Target was created

  - `segments.excluded.environment` (string, required)
    The identifier for the environment that the target belongs to

  - `segments.excluded.identifier` (string, required)
    The unique identifier for this target
    Example: "john-doe"

  - `segments.excluded.name` (string, required)
    The name of this Target
    Example: "John Doe"

  - `segments.excluded.org` (string, required)
    The identifier for the organization that the target belongs to

  - `segments.excluded.project` (string, required)
    The identifier for the project that this target belongs to

  - `segments.excluded.segments` (array)
    A list of Target Groups (Segments) that this Target belongs to

  - `segments.identifier` (string, required)
    Unique identifier for the target group.

  - `segments.included` (array)
    A list of Targets who belong to this target group

  - `segments.modifiedAt` (integer)
    The data and time in milliseconds when the group was last modified

  - `segments.name` (string, required)
    Name of the target group.
    Example: "Beta Testers"

  - `segments.rules` (array)

  - `segments.rules.attribute` (string, required)
    The attribute to use in the clause.  This can be any target attribute
    Example: "identifier"

  - `segments.rules.id` (string)
    The unique ID for the clause
    Example: 32434243

  - `segments.rules.negate` (boolean, required)
    Is the operation negated?

  - `segments.rules.op` (string, required)
    The type of operation such as equals, starts_with, contains
    Example: "starts_with"

  - `segments.rules.values` (array, required)
    The values that are compared against the operator

  - `segments.servingRules` (array)
    An array of rules that can cause a user to be included in this segment.

  - `segments.servingRules.clauses` (array, required)
    A list of clauses to use in the rule

  - `segments.servingRules.priority` (integer, required)
    The rules priority relative to other rules.  The rules are evaluated in order with 1 being the highest
    Example: 1

  - `segments.servingRules.ruleId` (string, required)
    The unique identifier for this rule

  - `segments.tags` (array)
    Tags for this target group

  - `segments.tags.identifier` (string, required)
    The identifier of the tag
    Example: "feature-flag-tag-1"

  - `segments.tags.name` (string, required)
    The name of the tag
    Example: "feature-flag-tag-1"

  - `segments.version` (integer)
    The version of this group.  Each time it is modified the version is incremented
    Example: 1

## Response 401 fields (application/json):

  - `code` (string, required)
    The http error code
    Example: 404

  - `details` (object)
    Additional details about the error

  - `message` (string, required)
    The reason the request failed
    Example: "Error retrieving projects, organization 'default_org' does not exist"


