Skip to main content

Get strategy segments

GET 

<your-unleash-url>/api/admin/segments/strategies/:strategyId

Retrieve all segments that are referenced by the specified strategy. Returns an empty list of segments if the strategy ID doesn't exist.

Request

Path Parameters

    strategyId stringrequired

Responses

segmentsSchema

Schema
    segments object[]

    A list of segments

  • Array [
  • idintegerrequired

    The ID of this segment

    Example: 2
    namestringrequired

    The name of this segment

    Example: ios-users
    descriptionstringnullable

    The description for this segment

    Example: IOS users segment
    constraints object[]required

    The list of constraints that are used in this segment

  • Array [
  • contextNamestringrequired

    The name of the context field that this constraint should apply to.

    Example: appName
    operatorstringrequired

    The operator to use when evaluating this constraint. For more information about the various operators, refer to the strategy constraint operator documentation.

    Possible values: [NOT_IN, IN, STR_ENDS_WITH, STR_STARTS_WITH, STR_CONTAINS, NUM_EQ, NUM_GT, NUM_GTE, NUM_LT, NUM_LTE, DATE_AFTER, DATE_BEFORE, SEMVER_EQ, SEMVER_GT, SEMVER_LT]

    Example: IN
    caseInsensitiveboolean

    Whether the operator should be case sensitive or not. Defaults to false (being case sensitive).

    Default value: false
    invertedboolean

    Whether the result should be negated or not. If true, will turn a true result into a false result and vice versa.

    Default value: false
    valuesstring[]

    The context values that should be used for constraint evaluation. Use this property instead of value for properties that accept multiple values.

    Example: ["my-app","my-other-app"]
    valuestring

    The context value that should be used for constraint evaluation. Use this property instead of values for properties that only accept single values.

    Example: my-app
  • ]
  • usedInFeaturesintegernullable

    The number of feature flags that use this segment. The number also includes the any flags with pending change requests that would add this segment.

    Example: 3
    usedInProjectsintegernullable

    The number of projects that use this segment. The number includes any projects with pending change requests that would add this segment.

    Example: 2
    projectstringnullable

    The project the segment belongs to. Only present if the segment is a project-specific segment.

    Example: red-vista
    createdBystringnullable

    The creator's email or username

    Example: someone@example.com
    createdAtdate-timerequired

    When the segment was created

    Example: 2023-04-12T11:13:31.960Z
  • ]

Authorization: Authorization

name: Authorizationtype: apiKeyin: headerdescription: API key needed to access this API
curl -L '<your-unleash-url>/api/admin/segments/strategies/:strategyId' \
-H 'Accept: application/json' \
-H 'Authorization: <Authorization>'
Request Collapse all
Base URL
<your-unleash-url>
Auth
Parameters
— pathrequired
ResponseClear

Click the Send API Request button above and see the response here!