Skip to main content

Add a strategy to a feature flag

POST 

<your-unleash-url>/api/admin/projects/:projectId/features/:featureName/environments/:environment/strategies

Add a strategy to a feature flag in the specified environment.

Request

Responses

featureStrategySchema

Authorization: Authorization

name: Authorizationtype: apiKeyin: headerdescription: API key needed to access this API

Request Collapse all
Base URL
<your-unleash-url>
Auth
Parameters
— pathrequired
— pathrequired
— pathrequired
Body required
{
  "name": "flexibleRollout",
  "title": "Gradual Rollout 25-Prod",
  "disabled": false,
  "sortOrder": 9999,
  "constraints": [
    {
      "values": [
        "1",
        "2"
      ],
      "inverted": false,
      "operator": "IN",
      "contextName": "appName",
      "caseInsensitive": false
    }
  ],
  "variants": [
    {
      "name": "blue_group",
      "weight": 0,
      "weightType": "fix",
      "stickiness": "custom.context.field",
      "payload": {
        "type": "json",
        "value": "{\"color\": \"red\"}"
      }
    }
  ],
  "parameters": {
    "groupId": "some_new",
    "rollout": "25",
    "stickiness": "sessionId"
  },
  "segments": [
    1,
    2
  ]
}
ResponseClear

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