For the complete documentation index, see llms.txt. This page is also available as Markdown.

Target Groups

APIs to create and manage Feature Flag Target Groups

Returns all Target Groups

get

Returns Target Group details for the given account

Authorizations
x-api-keystringRequired
Query parameters
accountIdentifierstringRequired

Account Identifier

Example: {"value":"default"}
orgIdentifierstringRequired

Organization Identifier

Example: {"value":"default_org"}
environmentIdentifierstringRequired

Environment Identifier

projectIdentifierstringRequired

The Project identifier

pageNumberintegerOptional

PageNumber

pageSizeintegerOptional

PageSize

sortOrderstring · enumOptional

SortOrder

Possible values:
sortByFieldstring · enumOptional

SortByField

Possible values:
namestringOptional

Name of the field

identifierstringOptional

Identifier of the field

rulesstringOptional

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.

Responses
200

OK

application/json
itemCountintegerRequired

The total number of items

Example: 1
pageCountintegerRequired

The total number of pages

Example: 100
pageIndexintegerRequired

The current page

Example: 0
pageSizeintegerRequired

The number of items per page

Example: 1
versionintegerOptional

The version of this object. The version will be incremented each time the object is modified

Example: 5
get/admin/segments
GET /gateway/cf/admin/segments?accountIdentifier=text&orgIdentifier=text&environmentIdentifier=text&projectIdentifier=text HTTP/1.1
Host: app.harness.io
x-api-key: YOUR_API_KEY
Accept: */*
{
  "itemCount": 1,
  "pageCount": 100,
  "pageIndex": 0,
  "pageSize": 1,
  "version": 5,
  "segments": [
    {
      "createdAt": 1,
      "environment": "Production",
      "excluded": [
        {
          "account": "abcXDdffdaffd",
          "anonymous": true,
          "attributes": {
            "age": 20,
            "location": "Belfast"
          },
          "createdAt": 1,
          "environment": "text",
          "identifier": "john-doe",
          "name": "John Doe",
          "org": "text",
          "project": "text",
          "segments": "[Circular Reference]"
        }
      ],
      "identifier": "text",
      "included": [
        {
          "account": "abcXDdffdaffd",
          "anonymous": true,
          "attributes": {
            "age": 20,
            "location": "Belfast"
          },
          "createdAt": 1,
          "environment": "text",
          "identifier": "john-doe",
          "name": "John Doe",
          "org": "text",
          "project": "text",
          "segments": "[Circular Reference]"
        }
      ],
      "modifiedAt": 1,
      "name": "Beta Testers",
      "rules": [
        {
          "attribute": "identifier",
          "id": 32434243,
          "negate": false,
          "op": "starts_with",
          "values": [
            "text"
          ]
        }
      ],
      "servingRules": [
        {
          "clauses": [
            {
              "attribute": "identifier",
              "id": 32434243,
              "negate": false,
              "op": "starts_with",
              "values": [
                "text"
              ]
            }
          ],
          "priority": 1,
          "ruleId": "text"
        }
      ],
      "tags": [
        {
          "identifier": "feature-flag-tag-1",
          "name": "feature-flag-tag-1"
        }
      ],
      "version": 1
    }
  ]
}

Creates a Target Group

post

Creates a Target Group in the given Project

Authorizations
x-api-keystringRequired
Query parameters
accountIdentifierstringRequired

Account Identifier

Example: {"value":"default"}
orgIdentifierstringRequired

Organization Identifier

Example: {"value":"default_org"}
Body
environmentstringRequired
excludedstring[]Optional
identifierstringOptionalExample: beta-testers
includedstring[]Optional
namestringRequired

Name of the target segment.

Example: Beta Testers
projectstringRequired
Responses
201

Created

No content

post/admin/segments
POST /gateway/cf/admin/segments?accountIdentifier=text&orgIdentifier=text HTTP/1.1
Host: app.harness.io
x-api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 458

{
  "environment": "text",
  "excluded": [
    "text"
  ],
  "identifier": "beta-testers",
  "included": [
    "text"
  ],
  "name": "Beta Testers",
  "project": "text",
  "rules": [
    {
      "attribute": "identifier",
      "id": 32434243,
      "negate": false,
      "op": "starts_with",
      "values": [
        "text"
      ]
    }
  ],
  "servingRules": [
    {
      "clauses": [
        {
          "attribute": "identifier",
          "id": 32434243,
          "negate": false,
          "op": "starts_with",
          "values": [
            "text"
          ]
        }
      ],
      "priority": 1,
      "ruleId": "text"
    }
  ],
  "tags": [
    {
      "identifier": "feature-flag-tag-1",
      "name": "feature-flag-tag-1"
    }
  ]
}

No content

Returns Target Group details for the given identifier

get

Returns Target Group details for the given ID

Authorizations
x-api-keystringRequired
Path parameters
identifierstringRequired

Unique identifier for the object in the API.

Query parameters
accountIdentifierstringRequired

Account Identifier

Example: {"value":"default"}
orgIdentifierstringRequired

Organization Identifier

Example: {"value":"default_org"}
projectIdentifierstringRequired

The Project identifier

environmentIdentifierstringRequired

Environment Identifier

rulesstringOptional

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.

Responses
200

OK

application/json

A Target Group (Segment) response

createdAtinteger · int64Optional

The data and time in milliseconds when the group was created

environmentstringOptional

The environment this target group belongs to

Example: Production
identifierstringRequired

Unique identifier for the target group.

modifiedAtinteger · int64Optional

The data and time in milliseconds when the group was last modified

namestringRequired

Name of the target group.

Example: Beta Testers
versioninteger · int64Optional

The version of this group. Each time it is modified the version is incremented

Example: 1
get/admin/segments/{identifier}
GET /gateway/cf/admin/segments/{identifier}?accountIdentifier=text&orgIdentifier=text&projectIdentifier=text&environmentIdentifier=text HTTP/1.1
Host: app.harness.io
x-api-key: YOUR_API_KEY
Accept: */*
{
  "createdAt": 1,
  "environment": "Production",
  "excluded": [
    {
      "account": "abcXDdffdaffd",
      "anonymous": true,
      "attributes": {
        "age": 20,
        "location": "Belfast"
      },
      "createdAt": 1,
      "environment": "text",
      "identifier": "john-doe",
      "name": "John Doe",
      "org": "text",
      "project": "text",
      "segments": [
        {
          "createdAt": 1,
          "environment": "Production",
          "excluded": [
            "[Circular Reference]"
          ],
          "identifier": "text",
          "included": [
            "[Circular Reference]"
          ],
          "modifiedAt": 1,
          "name": "Beta Testers",
          "rules": [
            {
              "attribute": "identifier",
              "id": 32434243,
              "negate": false,
              "op": "starts_with",
              "values": [
                "text"
              ]
            }
          ],
          "servingRules": [
            {
              "clauses": [
                {
                  "attribute": "identifier",
                  "id": 32434243,
                  "negate": false,
                  "op": "starts_with",
                  "values": [
                    "text"
                  ]
                }
              ],
              "priority": 1,
              "ruleId": "text"
            }
          ],
          "tags": [
            {
              "identifier": "feature-flag-tag-1",
              "name": "feature-flag-tag-1"
            }
          ],
          "version": 1
        }
      ]
    }
  ],
  "identifier": "text",
  "included": [
    {
      "account": "abcXDdffdaffd",
      "anonymous": true,
      "attributes": {
        "age": 20,
        "location": "Belfast"
      },
      "createdAt": 1,
      "environment": "text",
      "identifier": "john-doe",
      "name": "John Doe",
      "org": "text",
      "project": "text",
      "segments": [
        {
          "createdAt": 1,
          "environment": "Production",
          "excluded": [
            "[Circular Reference]"
          ],
          "identifier": "text",
          "included": [
            "[Circular Reference]"
          ],
          "modifiedAt": 1,
          "name": "Beta Testers",
          "rules": [
            {
              "attribute": "identifier",
              "id": 32434243,
              "negate": false,
              "op": "starts_with",
              "values": [
                "text"
              ]
            }
          ],
          "servingRules": [
            {
              "clauses": [
                {
                  "attribute": "identifier",
                  "id": 32434243,
                  "negate": false,
                  "op": "starts_with",
                  "values": [
                    "text"
                  ]
                }
              ],
              "priority": 1,
              "ruleId": "text"
            }
          ],
          "tags": [
            {
              "identifier": "feature-flag-tag-1",
              "name": "feature-flag-tag-1"
            }
          ],
          "version": 1
        }
      ]
    }
  ],
  "modifiedAt": 1,
  "name": "Beta Testers",
  "rules": [
    {
      "attribute": "identifier",
      "id": 32434243,
      "negate": false,
      "op": "starts_with",
      "values": [
        "text"
      ]
    }
  ],
  "servingRules": [
    {
      "clauses": [
        {
          "attribute": "identifier",
          "id": 32434243,
          "negate": false,
          "op": "starts_with",
          "values": [
            "text"
          ]
        }
      ],
      "priority": 1,
      "ruleId": "text"
    }
  ],
  "tags": [
    {
      "identifier": "feature-flag-tag-1",
      "name": "feature-flag-tag-1"
    }
  ],
  "version": 1
}

Deletes a Target Group

delete

Deletes a Target Group for the given ID

Authorizations
x-api-keystringRequired
Path parameters
identifierstringRequired

Unique identifier for the object in the API.

Query parameters
accountIdentifierstringRequired

Account Identifier

Example: {"value":"default"}
orgIdentifierstringRequired

Organization Identifier

Example: {"value":"default_org"}
projectIdentifierstringRequired

The Project identifier

environmentIdentifierstringRequired

Environment Identifier

Responses
204

No content

No content

delete/admin/segments/{identifier}
DELETE /gateway/cf/admin/segments/{identifier}?accountIdentifier=text&orgIdentifier=text&projectIdentifier=text&environmentIdentifier=text HTTP/1.1
Host: app.harness.io
x-api-key: YOUR_API_KEY
Accept: */*

No content

Updates a Target Group

patch

Updates a Target Group for the given identifier

Authorizations
x-api-keystringRequired
Path parameters
identifierstringRequired

Unique identifier for the object in the API.

Query parameters
accountIdentifierstringRequired

Account Identifier

Example: {"value":"default"}
orgIdentifierstringRequired

Organization Identifier

Example: {"value":"default_org"}
projectIdentifierstringRequired

The Project identifier

environmentIdentifierstringRequired

Environment Identifier

Body
commentstringOptional

A comment explaining the reason for this patch operation

Example: This is a comment string
executionTimeintegerOptional

Time of execution in unix epoch milliseconds when the scheduled changes will be applied

Responses
200

OK

application/json

A Target Group (Segment) response

createdAtinteger · int64Optional

The data and time in milliseconds when the group was created

environmentstringOptional

The environment this target group belongs to

Example: Production
identifierstringRequired

Unique identifier for the target group.

modifiedAtinteger · int64Optional

The data and time in milliseconds when the group was last modified

namestringRequired

Name of the target group.

Example: Beta Testers
versioninteger · int64Optional

The version of this group. Each time it is modified the version is incremented

Example: 1
patch/admin/segments/{identifier}
PATCH /gateway/cf/admin/segments/{identifier}?accountIdentifier=text&orgIdentifier=text&projectIdentifier=text&environmentIdentifier=text HTTP/1.1
Host: app.harness.io
x-api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 633

{
  "instructions": [
    {
      "kind": "addToIncludeList",
      "parameters": {
        "targets": [
          "target1",
          "target2"
        ]
      }
    },
    {
      "kind": "removeFromIncludeList",
      "parameters": {
        "targets": [
          "target1",
          "target2"
        ]
      }
    },
    {
      "kind": "addToExcludeList",
      "parameters": {
        "targets": [
          "target3"
        ]
      }
    },
    {
      "kind": "removeFromExcludeList",
      "parameters": {
        "targets": [
          "target4",
          "target5"
        ]
      }
    },
    {
      "kind": "addClause",
      "parameters": {
        "attribute": "email",
        "negate": false,
        "op": "endsWith",
        "values": [
          "gmail.com"
        ]
      }
    },
    {
      "kind": "updateClause",
      "parameters": {
        "attribute": "email",
        "clauseID": "test-clause-ID",
        "op": "equals",
        "value": [
          "testuser@testcompany.com"
        ]
      }
    },
    {
      "kind": "removeClause",
      "parameters": {
        "clauseID": "test-clause-ID"
      }
    }
  ]
}
{
  "createdAt": 1,
  "environment": "Production",
  "excluded": [
    {
      "account": "abcXDdffdaffd",
      "anonymous": true,
      "attributes": {
        "age": 20,
        "location": "Belfast"
      },
      "createdAt": 1,
      "environment": "text",
      "identifier": "john-doe",
      "name": "John Doe",
      "org": "text",
      "project": "text",
      "segments": [
        {
          "createdAt": 1,
          "environment": "Production",
          "excluded": [
            "[Circular Reference]"
          ],
          "identifier": "text",
          "included": [
            "[Circular Reference]"
          ],
          "modifiedAt": 1,
          "name": "Beta Testers",
          "rules": [
            {
              "attribute": "identifier",
              "id": 32434243,
              "negate": false,
              "op": "starts_with",
              "values": [
                "text"
              ]
            }
          ],
          "servingRules": [
            {
              "clauses": [
                {
                  "attribute": "identifier",
                  "id": 32434243,
                  "negate": false,
                  "op": "starts_with",
                  "values": [
                    "text"
                  ]
                }
              ],
              "priority": 1,
              "ruleId": "text"
            }
          ],
          "tags": [
            {
              "identifier": "feature-flag-tag-1",
              "name": "feature-flag-tag-1"
            }
          ],
          "version": 1
        }
      ]
    }
  ],
  "identifier": "text",
  "included": [
    {
      "account": "abcXDdffdaffd",
      "anonymous": true,
      "attributes": {
        "age": 20,
        "location": "Belfast"
      },
      "createdAt": 1,
      "environment": "text",
      "identifier": "john-doe",
      "name": "John Doe",
      "org": "text",
      "project": "text",
      "segments": [
        {
          "createdAt": 1,
          "environment": "Production",
          "excluded": [
            "[Circular Reference]"
          ],
          "identifier": "text",
          "included": [
            "[Circular Reference]"
          ],
          "modifiedAt": 1,
          "name": "Beta Testers",
          "rules": [
            {
              "attribute": "identifier",
              "id": 32434243,
              "negate": false,
              "op": "starts_with",
              "values": [
                "text"
              ]
            }
          ],
          "servingRules": [
            {
              "clauses": [
                {
                  "attribute": "identifier",
                  "id": 32434243,
                  "negate": false,
                  "op": "starts_with",
                  "values": [
                    "text"
                  ]
                }
              ],
              "priority": 1,
              "ruleId": "text"
            }
          ],
          "tags": [
            {
              "identifier": "feature-flag-tag-1",
              "name": "feature-flag-tag-1"
            }
          ],
          "version": 1
        }
      ]
    }
  ],
  "modifiedAt": 1,
  "name": "Beta Testers",
  "rules": [
    {
      "attribute": "identifier",
      "id": 32434243,
      "negate": false,
      "op": "starts_with",
      "values": [
        "text"
      ]
    }
  ],
  "servingRules": [
    {
      "clauses": [
        {
          "attribute": "identifier",
          "id": 32434243,
          "negate": false,
          "op": "starts_with",
          "values": [
            "text"
          ]
        }
      ],
      "priority": 1,
      "ruleId": "text"
    }
  ],
  "tags": [
    {
      "identifier": "feature-flag-tag-1",
      "name": "feature-flag-tag-1"
    }
  ],
  "version": 1
}

Returns Feature Flags that are available to be added to the given Target Group

get

Returns the list of Feature Flags that the Target Group can be added to. This list will exclude any Feature Flag that the Target Group is already part of.

Authorizations
x-api-keystringRequired
Path parameters
identifierstringRequired

Unique identifier for the object in the API.

Query parameters
accountIdentifierstringRequired

Account Identifier

Example: {"value":"default"}
orgIdentifierstringRequired

Organization Identifier

Example: {"value":"default_org"}
projectIdentifierstringRequired

The Project identifier

environmentIdentifierstringRequired

Environment Identifier

pageNumberintegerOptional

PageNumber

pageSizeintegerOptional

PageSize

sortOrderstring · enumOptional

SortOrder

Possible values:
sortByFieldstring · enumOptional

SortByField

Possible values:
flagNameIdentifierstringOptional

Identifier of the feature flag

Responses
200

OK

application/json
itemCountintegerRequired

The total number of items

Example: 1
pageCountintegerRequired

The total number of pages

Example: 100
pageIndexintegerRequired

The current page

Example: 0
pageSizeintegerRequired

The number of items per page

Example: 1
versionintegerOptional

The version of this object. The version will be incremented each time the object is modified

Example: 5
get/admin/segments/{identifier}/available_flags
GET /gateway/cf/admin/segments/{identifier}/available_flags?accountIdentifier=text&orgIdentifier=text&projectIdentifier=text&environmentIdentifier=text HTTP/1.1
Host: app.harness.io
x-api-key: YOUR_API_KEY
Accept: */*
{
  "itemCount": 1,
  "pageCount": 100,
  "pageIndex": 0,
  "pageSize": 1,
  "version": 5,
  "featureFlags": [
    {
      "identifier": "test-flag",
      "name": "Test Flag"
    }
  ]
}

Returns Feature Flags in a Target Group

get

Returns the details of a Feature Flag in a Target Group for the given identifier

Authorizations
x-api-keystringRequired
Path parameters
identifierstringRequired

Unique identifier for the object in the API.

Query parameters
accountIdentifierstringRequired

Account Identifier

Example: {"value":"default"}
orgIdentifierstringRequired

Organization Identifier

Example: {"value":"default_org"}
projectIdentifierstringRequired

The Project identifier

environmentIdentifierstringRequired

Environment Identifier

Responses
200

OK

application/json

Details of a Feature Flag that has been included in a Target Group (Segment)

descriptionstringOptional

A description of the feature flag

environmentstringRequired

The environment identifier for the feature flag

identifierstringRequired

The identifier of the feature flag

Example: simple-bool
namestringRequired

The name of the feature flag

Example: Simple Bool
projectstringRequired

The project identifier for the feature flag

ruleIdstringOptional

The unique identifier for this rule

typestring · enumRequired

How the the flag has been included, either directly or via a custom rule

Possible values:
variationstringRequired

The identifier for the variation of the flag that should be served to members of the group

get/admin/segments/{identifier}/flags
GET /gateway/cf/admin/segments/{identifier}/flags?accountIdentifier=text&orgIdentifier=text&projectIdentifier=text&environmentIdentifier=text HTTP/1.1
Host: app.harness.io
x-api-key: YOUR_API_KEY
Accept: */*
[
  {
    "description": "text",
    "environment": "text",
    "identifier": "simple-bool",
    "name": "Simple Bool",
    "project": "text",
    "ruleId": "text",
    "type": "DIRECT",
    "variation": "text"
  }
]

Last updated

Was this helpful?