Features

Get a feature environment

Changed on

Information about the enablement status and strategies for a feature flag in specified environment.

get/api/admin/projects/{projectId}/features/{featureName}/environments/{environment}

Request

  • Base URL
    https://app.unleash-instance.example.com
  • URL
    https://app.unleash-instance.example.com/api/admin/projects/{projectId}/features/{featureName}/environments/{environment}
  • Auth
    • API key in header Authorization
    • or HTTP bearer

Path parameters

projectIdstring required
featureNamestring required
environmentstring required

Response

featureEnvironmentSchema

namestring required

The name of the environment

featureNamestring

The name of the feature

environmentstring

The name of the environment

typestring

The type of the environment

enabledboolean required

true if the feature is enabled for the environment, otherwise false.

sortOrdernumber

The sort order of the feature environment in the feature environments list

variantCountnumber

The number of defined variants

changeRequestIdsnumber[]

Experimental. A list of change request identifiers for actionable change requests that are not Cancelled, Rejected or Approved.

milestoneNamestring

Experimental: The name of the currently active release plan milestone

milestoneOrdernumber

Experimental: The zero-indexed order of currently active milestone in the list of all release plan milestones

totalMilestonesnumber

Experimental: The total number of milestones in the feature environment release plan

lastSeenAtstring date-time nullable

The date when metrics where last collected for the feature environment

hasStrategiesboolean

Whether the feature has any strategies defined.

hasEnabledStrategiesboolean

Whether the feature has any enabled strategies defined.

yesinteger

How many times the feature evaluated to true (enabled)

nointeger

How many times the feature evaluated to false (disabled)

Example response

{
  "name": "my-dev-env",
  "featureName": "disable-comments",
  "environment": "development",
  "type": "development",
  "enabled": true,
  "sortOrder": 3,
  "strategies": [
    {
      "id": "6b5157cb-343a-41e7-bfa3-7b4ec3044840",
      "name": "flexibleRollout",
      "title": "Gradual Rollout 25-Prod",
      "featureName": "myAwesomeFeature",
      "sortOrder": 9999,
      "segments": [
        1,
        2
      ],
      "constraints": [
        {
          "contextName": "appName",
          "operator": "IN",
          "values": [
            "my-app",
            "my-other-app"
          ],
          "value": "my-app"
        }
      ],
      "variants": [
        {
          "name": "blue_group",
          "weightType": "fix",
          "stickiness": "custom.context.field",
          "payload": {
            "type": "json",
            "value": "{\"color\": \"red\"}"
          }
        }
      ]
    }
  ],
  "variants": [
    {
      "name": "blue_group",
      "weightType": "variable",
      "stickiness": "custom.context.field",
      "payload": {
        "type": "json",
        "value": "{\"color\": \"red\"}"
      },
      "overrides": [
        {
          "contextName": "userId",
          "values": [
            "red",
            "blue"
          ]
        }
      ]
    }
  ],
  "milestoneName": "Phase One",
  "lastSeenAt": "2023-01-28T16:21:39.975Z",
  "releasePlans": [
    {
      "id": "01JB9GGTGQYEQ9D40R17T3YVW2",
      "discriminator": "plan",
      "name": "My release plan",
      "description": "This is my release plan",
      "featureName": "my-feature",
      "environment": "production",
      "createdByUserId": 53,
      "createdAt": "2022-01-01T00:00:00Z",
      "activeMilestoneId": "01JB9GGTGQYEQ9D40R17T3YVW1",
      "milestones": [
        {
          "id": "01JB9GGTGQYEQ9D40R17T3YVW1",
          "name": "My milestone",
          "sortOrder": 1,
          "releasePlanDefinitionId": "01JB9GGTGQYEQ9D40R17T3YVW2",
          "startedAt": "2024-01-01T00:00:00.000Z",
          "transitionCondition": {
            "intervalMinutes": 30
          },
          "progressionExecutedAt": "2024-01-01T00:00:00.000Z",
          "pausedAt": "2024-01-01T00:00:00.000Z",
          "strategies": [
            {
              "id": "01JB9GGTGQYEQ9D40R17T3YVW3",
              "milestoneId": "01JB9GGTGQYEQ9D40R17T3YVW1",
              "sortOrder": 9999,
              "title": "Gradual Rollout 25-Prod",
              "name": "flexibleRollout",
              "strategyName": "flexibleRollout",
              "constraints": [
                {
                  "values": [
                    "1",
                    "2"
                  ],
                  "inverted": false,
                  "operator": "IN",
                  "contextName": "appName",
                  "caseInsensitive": false
                }
              ],
              "variants": [
                {
                  "name": "blue_group",
                  "weightType": "fix",
                  "stickiness": "custom.context.field",
                  "payload": {
                    "type": "json",
                    "value": "{\"color\": \"red\"}"
                  }
                }
              ],
              "segments": [
                1,
                2
              ]
            }
          ]
        }
      ],
      "releasePlanTemplateId": "01JB9GGTGQYEQ9D40R17T3YVW2",
      "safeguards": [
        {
          "id": "01JB9GGTGQYEQ9D40R17T3YVW1",
          "action": {
            "type": "pauseReleasePlanProgressions",
            "id": "01JB9GGTGQYEQ9D40R17T3YVW2"
          },
          "triggerCondition": {
            "operator": ">",
            "threshold": 100
          },
          "impactMetric": {
            "id": "01JB9GGTGQYEQ9D40R17T3YVW1",
            "metricName": "unleash_counter_feature_toggle_usage_total",
            "timeRange": "day",
            "aggregationMode": "rps",
            "labelSelectors": {
              "environment": [
                "development"
              ],
              "project": [
                "default"
              ]
            },
            "source": "internal"
          }
        }
      ]
    }
  ],
  "safeguards": [
    {
      "id": "01JB9GGTGQYEQ9D40R17T3YVW1",
      "action": {
        "type": "disableFeatureEnvironment"
      },
      "triggerCondition": {
        "operator": ">",
        "threshold": 100
      },
      "impactMetric": {
        "id": "01JB9GGTGQYEQ9D40R17T3YVW1",
        "metricName": "unleash_counter_feature_toggle_usage_total",
        "timeRange": "day",
        "aggregationMode": "rps",
        "labelSelectors": {
          "environment": [
            "development"
          ],
          "project": [
            "default"
          ]
        },
        "source": "internal"
      }
    }
  ],
  "yes": 974,
  "no": 50
}

Changes

    • warning

      added the new SEMVER_GTE enum value to the //////// response property for the response status

    • warning

      added the new SEMVER_GTE enum value to the //// response property for the response status

    • warning

      added the new SEMVER_LTE enum value to the //////// response property for the response status

    • warning

      added the new SEMVER_LTE enum value to the //// response property for the response status

    • warning

      added the new REGEX enum value to the //////// response property for the response status

    • warning

      added the new REGEX enum value to the //// response property for the response status

    • info

      added the optional property ////// to the response with the status

    • info

      added the optional property ///// to the response with the status

    • info

      added the optional property to the response with the status

    • info

      response property releasePlans/items/milestones/items/strategies/items/strategyName deprecated (stability: stable)

    • info

      added the required property ////// to the response with the status