Skip to main content
PUT
/
projects
/
{project_id}
/
workspaces
/
{workspace_id}
/
feature-flags
/
{flag_id}
Update Feature Flag
curl --request PUT \
  --url https://{regionAndDomain}.com/api/app/projects/{project_id}/workspaces/{workspace_id}/feature-flags/{flag_id} \
  --header 'Authorization: Basic <encoded-value>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "key": "<string>",
  "tags": [
    "<string>"
  ],
  "context": "<string>",
  "ruleset": {
    "variants": [
      {
        "key": "<string>",
        "value": true,
        "is_control": true,
        "split": 0.5,
        "description": "<string>",
        "is_sticky": false
      }
    ],
    "rollout": [
      {
        "rollout_percentage": 0.5,
        "variant_splits": {},
        "name": "<string>",
        "cohort_definition": {},
        "runtime_evaluation_definition": {},
        "runtime_evaluation_rule": {},
        "runtime_event_rule": {
          "event_name": "<string>",
          "time_window": "while_flag_enabled",
          "property_filters": {}
        },
        "cohort_hash": "<string>",
        "variant_override": {
          "key": "<string>"
        }
      }
    ],
    "test": {}
  },
  "description": "<string>",
  "experiment_id": "<string>",
  "status": "disabled",
  "data_group_id": "<string>",
  "workspace_id": 123,
  "is_experiment_active": true,
  "hash_salt": "<string>",
  "reset_hash_salt": true
}
'
import requests

url = "https://{regionAndDomain}.com/api/app/projects/{project_id}/workspaces/{workspace_id}/feature-flags/{flag_id}"

payload = {
    "name": "<string>",
    "key": "<string>",
    "tags": ["<string>"],
    "context": "<string>",
    "ruleset": {
        "variants": [
            {
                "key": "<string>",
                "value": True,
                "is_control": True,
                "split": 0.5,
                "description": "<string>",
                "is_sticky": False
            }
        ],
        "rollout": [
            {
                "rollout_percentage": 0.5,
                "variant_splits": {},
                "name": "<string>",
                "cohort_definition": {},
                "runtime_evaluation_definition": {},
                "runtime_evaluation_rule": {},
                "runtime_event_rule": {
                    "event_name": "<string>",
                    "time_window": "while_flag_enabled",
                    "property_filters": {}
                },
                "cohort_hash": "<string>",
                "variant_override": { "key": "<string>" }
            }
        ],
        "test": {}
    },
    "description": "<string>",
    "experiment_id": "<string>",
    "status": "disabled",
    "data_group_id": "<string>",
    "workspace_id": 123,
    "is_experiment_active": True,
    "hash_salt": "<string>",
    "reset_hash_salt": True
}
headers = {
    "Authorization": "Basic <encoded-value>",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'PUT',
  headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    name: '<string>',
    key: '<string>',
    tags: ['<string>'],
    context: '<string>',
    ruleset: {
      variants: [
        {
          key: '<string>',
          value: true,
          is_control: true,
          split: 0.5,
          description: '<string>',
          is_sticky: false
        }
      ],
      rollout: [
        {
          rollout_percentage: 0.5,
          variant_splits: {},
          name: '<string>',
          cohort_definition: {},
          runtime_evaluation_definition: {},
          runtime_evaluation_rule: {},
          runtime_event_rule: {
            event_name: '<string>',
            time_window: 'while_flag_enabled',
            property_filters: {}
          },
          cohort_hash: '<string>',
          variant_override: {key: '<string>'}
        }
      ],
      test: {}
    },
    description: '<string>',
    experiment_id: '<string>',
    status: 'disabled',
    data_group_id: '<string>',
    workspace_id: 123,
    is_experiment_active: true,
    hash_salt: '<string>',
    reset_hash_salt: true
  })
};

fetch('https://{regionAndDomain}.com/api/app/projects/{project_id}/workspaces/{workspace_id}/feature-flags/{flag_id}', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://{regionAndDomain}.com/api/app/projects/{project_id}/workspaces/{workspace_id}/feature-flags/{flag_id}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => json_encode([
    'name' => '<string>',
    'key' => '<string>',
    'tags' => [
        '<string>'
    ],
    'context' => '<string>',
    'ruleset' => [
        'variants' => [
                [
                                'key' => '<string>',
                                'value' => true,
                                'is_control' => true,
                                'split' => 0.5,
                                'description' => '<string>',
                                'is_sticky' => false
                ]
        ],
        'rollout' => [
                [
                                'rollout_percentage' => 0.5,
                                'variant_splits' => [
                                                                
                                ],
                                'name' => '<string>',
                                'cohort_definition' => [
                                                                
                                ],
                                'runtime_evaluation_definition' => [
                                                                
                                ],
                                'runtime_evaluation_rule' => [
                                                                
                                ],
                                'runtime_event_rule' => [
                                                                'event_name' => '<string>',
                                                                'time_window' => 'while_flag_enabled',
                                                                'property_filters' => [
                                                                                                                                
                                                                ]
                                ],
                                'cohort_hash' => '<string>',
                                'variant_override' => [
                                                                'key' => '<string>'
                                ]
                ]
        ],
        'test' => [
                
        ]
    ],
    'description' => '<string>',
    'experiment_id' => '<string>',
    'status' => 'disabled',
    'data_group_id' => '<string>',
    'workspace_id' => 123,
    'is_experiment_active' => true,
    'hash_salt' => '<string>',
    'reset_hash_salt' => true
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Basic <encoded-value>",
    "Content-Type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://{regionAndDomain}.com/api/app/projects/{project_id}/workspaces/{workspace_id}/feature-flags/{flag_id}"

	payload := strings.NewReader("{\n  \"name\": \"<string>\",\n  \"key\": \"<string>\",\n  \"tags\": [\n    \"<string>\"\n  ],\n  \"context\": \"<string>\",\n  \"ruleset\": {\n    \"variants\": [\n      {\n        \"key\": \"<string>\",\n        \"value\": true,\n        \"is_control\": true,\n        \"split\": 0.5,\n        \"description\": \"<string>\",\n        \"is_sticky\": false\n      }\n    ],\n    \"rollout\": [\n      {\n        \"rollout_percentage\": 0.5,\n        \"variant_splits\": {},\n        \"name\": \"<string>\",\n        \"cohort_definition\": {},\n        \"runtime_evaluation_definition\": {},\n        \"runtime_evaluation_rule\": {},\n        \"runtime_event_rule\": {\n          \"event_name\": \"<string>\",\n          \"time_window\": \"while_flag_enabled\",\n          \"property_filters\": {}\n        },\n        \"cohort_hash\": \"<string>\",\n        \"variant_override\": {\n          \"key\": \"<string>\"\n        }\n      }\n    ],\n    \"test\": {}\n  },\n  \"description\": \"<string>\",\n  \"experiment_id\": \"<string>\",\n  \"status\": \"disabled\",\n  \"data_group_id\": \"<string>\",\n  \"workspace_id\": 123,\n  \"is_experiment_active\": true,\n  \"hash_salt\": \"<string>\",\n  \"reset_hash_salt\": true\n}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("Authorization", "Basic <encoded-value>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.put("https://{regionAndDomain}.com/api/app/projects/{project_id}/workspaces/{workspace_id}/feature-flags/{flag_id}")
  .header("Authorization", "Basic <encoded-value>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"<string>\",\n  \"key\": \"<string>\",\n  \"tags\": [\n    \"<string>\"\n  ],\n  \"context\": \"<string>\",\n  \"ruleset\": {\n    \"variants\": [\n      {\n        \"key\": \"<string>\",\n        \"value\": true,\n        \"is_control\": true,\n        \"split\": 0.5,\n        \"description\": \"<string>\",\n        \"is_sticky\": false\n      }\n    ],\n    \"rollout\": [\n      {\n        \"rollout_percentage\": 0.5,\n        \"variant_splits\": {},\n        \"name\": \"<string>\",\n        \"cohort_definition\": {},\n        \"runtime_evaluation_definition\": {},\n        \"runtime_evaluation_rule\": {},\n        \"runtime_event_rule\": {\n          \"event_name\": \"<string>\",\n          \"time_window\": \"while_flag_enabled\",\n          \"property_filters\": {}\n        },\n        \"cohort_hash\": \"<string>\",\n        \"variant_override\": {\n          \"key\": \"<string>\"\n        }\n      }\n    ],\n    \"test\": {}\n  },\n  \"description\": \"<string>\",\n  \"experiment_id\": \"<string>\",\n  \"status\": \"disabled\",\n  \"data_group_id\": \"<string>\",\n  \"workspace_id\": 123,\n  \"is_experiment_active\": true,\n  \"hash_salt\": \"<string>\",\n  \"reset_hash_salt\": true\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://{regionAndDomain}.com/api/app/projects/{project_id}/workspaces/{workspace_id}/feature-flags/{flag_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"<string>\",\n  \"key\": \"<string>\",\n  \"tags\": [\n    \"<string>\"\n  ],\n  \"context\": \"<string>\",\n  \"ruleset\": {\n    \"variants\": [\n      {\n        \"key\": \"<string>\",\n        \"value\": true,\n        \"is_control\": true,\n        \"split\": 0.5,\n        \"description\": \"<string>\",\n        \"is_sticky\": false\n      }\n    ],\n    \"rollout\": [\n      {\n        \"rollout_percentage\": 0.5,\n        \"variant_splits\": {},\n        \"name\": \"<string>\",\n        \"cohort_definition\": {},\n        \"runtime_evaluation_definition\": {},\n        \"runtime_evaluation_rule\": {},\n        \"runtime_event_rule\": {\n          \"event_name\": \"<string>\",\n          \"time_window\": \"while_flag_enabled\",\n          \"property_filters\": {}\n        },\n        \"cohort_hash\": \"<string>\",\n        \"variant_override\": {\n          \"key\": \"<string>\"\n        }\n      }\n    ],\n    \"test\": {}\n  },\n  \"description\": \"<string>\",\n  \"experiment_id\": \"<string>\",\n  \"status\": \"disabled\",\n  \"data_group_id\": \"<string>\",\n  \"workspace_id\": 123,\n  \"is_experiment_active\": true,\n  \"hash_salt\": \"<string>\",\n  \"reset_hash_salt\": true\n}"

response = http.request(request)
puts response.read_body
{
  "status": "<string>",
  "results": {
    "name": "<string>",
    "key": "<string>",
    "tags": [
      "<string>"
    ],
    "context": "<string>",
    "ruleset": {
      "variants": [
        {
          "key": "<string>",
          "value": true,
          "is_control": true,
          "split": 0.5,
          "description": "<string>",
          "is_sticky": false
        }
      ],
      "rollout": [
        {
          "rollout_percentage": 0.5,
          "variant_splits": {},
          "name": "<string>",
          "cohort_definition": {},
          "runtime_evaluation_definition": {},
          "runtime_evaluation_rule": {},
          "runtime_event_rule": {
            "event_name": "<string>",
            "time_window": "while_flag_enabled",
            "property_filters": {}
          },
          "cohort_hash": "<string>",
          "variant_override": {
            "key": "<string>"
          }
        }
      ],
      "test": {}
    },
    "id": "<string>",
    "project_id": 123,
    "content_type": "<string>",
    "created": "2023-11-07T05:31:56Z",
    "creator_id": 123,
    "creator_name": "<string>",
    "creator_email": "<string>",
    "modified": "2023-11-07T05:31:56Z",
    "can_update_basic": false,
    "is_superadmin": false,
    "allow_staff_override": false,
    "can_view": false,
    "can_share": false,
    "can_pin": false,
    "is_shared_with_project": false,
    "description": "<string>",
    "experiment_id": "<string>",
    "status": "disabled",
    "data_group_id": "<string>",
    "workspace_id": 123,
    "is_experiment_active": true,
    "hash_salt": "<string>",
    "reset_hash_salt": true,
    "last_modified_by_id": 123,
    "last_modified_by_name": "<string>",
    "last_modified_by_email": "<string>",
    "is_favorited": true,
    "pinned_date": "<string>",
    "enabled_at": "2023-11-07T05:31:56Z",
    "deleted": "2023-11-07T05:31:56Z",
    "content_environments_id": "<string>",
    "project_name": "<string>"
  }
}
{
  "error": "<string>",
  "status": "error"
}
{
  "error": "<string>",
  "status": "error"
}

Authorizations

Authorization
string
header
required

Service Account

Path Parameters

project_id
integer
required
workspace_id
integer
required
flag_id
string
required

Body

application/json
name
string
required
Required string length: 1 - 255
key
string
required
Required string length: 1 - 255
tags
string[]
required
context
string
required
Required string length: 1 - 255
serving_method
enum<string>
required
Available options:
client,
server,
remote_or_local,
remote_only
ruleset
ManagementRuleSet · object
required
description
string | null
experiment_id
string<uuid4> | null
status
enum<string>
default:disabled
Available options:
enabled,
disabled,
archived
data_group_id
workspace_id
integer | null
is_experiment_active
boolean | null
hash_salt
string | null
Required string length: 32
reset_hash_salt
boolean | null

Response

Success

status
string
required
Allowed value: "ok"
results
FeatureFlagApiResponse · object
required