---
title: "Update a feature flag configuration for a specific environment"
method: PATCH
path: "/feature-flags/{siteCode}/{featureKey}/{environmentKey}"
tags: ["FeatureFlag"]
---

# Update a feature flag configuration for a specific environment

`PATCH /feature-flags/{siteCode}/{featureKey}/{environmentKey}`

Updates the configuration of a feature flag using a JSON Merge Patch for the specified site code, feature key, and environment key.
Note: If you need to modify an element within an array, the entire array — including all its fields — must be provided, as partial updates to array elements are not supported.

## Path parameters

- `siteCode` string, required
- `featureKey` string, required
- `environmentKey` string, required

## Request body

- FeatureFlagWithEnvUpdate — Represents the input object for patching a feature flag for a specific environment
  - `attributionWindow` integer — Attribution window in milliseconds
  - `bucketingKey` union
    - BucketingKeyCustomDataDto — Bucketing key used for the feature flag
      - `bucketingKeyType` 'VISITOR_CODE' | 'CUSTOM_DATA'
      - `customDataId` integer
    - BucketingKeyVisitorCodeDto — Bucketing key used for the feature flag
      - `bucketingKeyType` 'VISITOR_CODE' | 'CUSTOM_DATA'
  - `defaultVariationKey` string — The default variation key to serve in this environment
  - `description` string — Description of the feature flag
  - `featureEnabled` boolean — Indicates if the feature flag is enabled in this environment
  - `featureKey` string, required — Key used to identify the feature flag
  - `integrations` FeatureFlagIntegrations, required — Integrations associated with the feature flag environment
    - `deliveryRules` FeatureFlagIntegrations[] — List of integrations enabled for delivery rules
    - `experimentRules` FeatureFlagIntegrations[] — List of integrations enabled for experimentation rules
  - `isArchived` boolean — Flag indicating if the feature flag is archived
  - `name` string, required — Name of the feature flag
  - `primaryGoalId` integer — Primary goal associated with the feature flag
  - `rolloutRules` union[], required — The rollout rules for this environment
    - union
      - ExperimentationRuleRequest — Represents a rule configuration for creation or update
        - `id` integer, nullable — ID of the rule
        - `name` string, nullable — Name of the rule
        - `orderIndex` integer, nullable — Order index of the rule execution
        - `reallocation` boolean, nullable — Perform traffic reallocation
        - `release` ReleasePeriodRequest, nullable — Release date information about this rule
          - `releaseFrom` string, date-time — Rule being applied from this date
          - `releaseTo` string, date-time — Rule being applied to this date
          - `timeZone` string, required — Timezone regarding the release of this rule
        - `rollbackConditions` RollbackConditionRequest[], nullable — Conditions under which the rule will be rolled back
          - `comparisonOperator` 'GREATER_THAN' | 'LESS_THAN' | 'GREATER_THAN' | 'LESS_THAN', required — The rollback condition comparison operator
          - `criteria` 'UPLIFT' | 'DOWNLIFT' | 'CONVERSION_RATE' | 'UPLIFT' | 'DOWNLIFT' | 'CONVERSION_RATE', required — The rollback condition criteria
          - `goalId` integer, required — The rollback condition goal ID
          - `id` integer, nullable — The rollback condition ID
          - `matchValue` number, double, required — The rollback condition match value (0.0001 to 100)
          - `recipients` string[], nullable — List of emails of recipients who will be notified when conditions are triggered
          - `target` 'RULE' | 'ENVIRONMENT' | 'RULE' | 'ENVIRONMENT', required — The rollback condition target
          - `visitors` integer, required — The rollback condition visitors
        - `segmentId` integer, nullable — ID of the segment targeted by this rule
        - `state` 'ACTIVE' | 'PAUSED' | 'ACTIVE' | 'PAUSED', nullable — Wished state of the rule
        - `type` 'TARGETED_DELIVERY' | 'PROGRESSIVE_DELIVERY' | 'EXPERIMENTATION' | 'PROGRESSIVE_DELIVERY' | 'TARGETED_DELIVERY' | 'EXPERIMENTATION', required — Type of the rule
        - `controlVariationKey` string, nullable — Key of the control variation for this rule
        - `exposition` integer, nullable, required — Percentage of the traffic exposed to this rule
        - `multiArmedBandit` boolean — Enable dynamic allocation for this rule (Multi-Armed Bandit)
        - `trafficAllocationMethod` 'CONTEXTUAL_BANDIT' | 'MANUAL' | 'MULTI_ARMED_BANDIT' | 'CONTEXTUAL_BANDIT, MANUAL, MULTI_ARMED_BANDIT' — Defines how traffic is distributed in the SDK
        - `trafficAllocations` FeatureTrafficAllocation[] — Traffic allocation settings for the rule
          - `exposition` number, double
          - `variationId` integer
          - `variationKey` string
      - ProgressiveRuleRequest — Represents a rule configuration for creation or update
        - `id` integer, nullable — ID of the rule
        - `name` string, nullable — Name of the rule
        - `orderIndex` integer, nullable — Order index of the rule execution
        - `reallocation` boolean, nullable — Perform traffic reallocation
        - `release` ReleasePeriodRequest, nullable — Release date information about this rule
          - `releaseFrom` string, date-time — Rule being applied from this date
          - `releaseTo` string, date-time — Rule being applied to this date
          - `timeZone` string, required — Timezone regarding the release of this rule
        - `rollbackConditions` RollbackConditionRequest[], nullable — Conditions under which the rule will be rolled back
          - `comparisonOperator` 'GREATER_THAN' | 'LESS_THAN' | 'GREATER_THAN' | 'LESS_THAN', required — The rollback condition comparison operator
          - `criteria` 'UPLIFT' | 'DOWNLIFT' | 'CONVERSION_RATE' | 'UPLIFT' | 'DOWNLIFT' | 'CONVERSION_RATE', required — The rollback condition criteria
          - `goalId` integer, required — The rollback condition goal ID
          - `id` integer, nullable — The rollback condition ID
          - `matchValue` number, double, required — The rollback condition match value (0.0001 to 100)
          - `recipients` string[], nullable — List of emails of recipients who will be notified when conditions are triggered
          - `target` 'RULE' | 'ENVIRONMENT' | 'RULE' | 'ENVIRONMENT', required — The rollback condition target
          - `visitors` integer, required — The rollback condition visitors
        - `segmentId` integer, nullable — ID of the segment targeted by this rule
        - `state` 'ACTIVE' | 'PAUSED' | 'ACTIVE' | 'PAUSED', nullable — Wished state of the rule
        - `type` 'TARGETED_DELIVERY' | 'PROGRESSIVE_DELIVERY' | 'EXPERIMENTATION' | 'PROGRESSIVE_DELIVERY' | 'TARGETED_DELIVERY' | 'EXPERIMENTATION', required — Type of the rule
        - `rolloutConfiguration` union, required
          - CustomRampUpRollout — Custom Ramp-Up rollout configuration
            - `type` 'PROGRESSIVE_EXPOSURE' | 'CUSTOM_RAMP_UP', required — Type of the feature rollout
            - `steps` RolloutStep[], required — List of rollout steps
              - …
          - ProgressiveExposure — Progressive exposure rollout configuration
            - `type` 'PROGRESSIVE_EXPOSURE' | 'CUSTOM_RAMP_UP', required — Type of the feature rollout
            - `frequency` RolloutFrequency — Frequency at which the exposition will evolve
              - …
            - `increaseBy` integer, required — Increment value in percentage
            - `percentageRange` RolloutPercentageRange, required — Percentage range of the rollout
              - …
            - `releaseDateTime` string, date-time — Release date time
        - `variationKey` string, required — Variation key used as control in experiments
      - TargetedRuleRequest — Represents a rule configuration for creation or update
        - `id` integer, nullable — ID of the rule
        - `name` string, nullable — Name of the rule
        - `orderIndex` integer, nullable — Order index of the rule execution
        - `reallocation` boolean, nullable — Perform traffic reallocation
        - `release` ReleasePeriodRequest, nullable — Release date information about this rule
          - `releaseFrom` string, date-time — Rule being applied from this date
          - `releaseTo` string, date-time — Rule being applied to this date
          - `timeZone` string, required — Timezone regarding the release of this rule
        - `rollbackConditions` RollbackConditionRequest[], nullable — Conditions under which the rule will be rolled back
          - `comparisonOperator` 'GREATER_THAN' | 'LESS_THAN' | 'GREATER_THAN' | 'LESS_THAN', required — The rollback condition comparison operator
          - `criteria` 'UPLIFT' | 'DOWNLIFT' | 'CONVERSION_RATE' | 'UPLIFT' | 'DOWNLIFT' | 'CONVERSION_RATE', required — The rollback condition criteria
          - `goalId` integer, required — The rollback condition goal ID
          - `id` integer, nullable — The rollback condition ID
          - `matchValue` number, double, required — The rollback condition match value (0.0001 to 100)
          - `recipients` string[], nullable — List of emails of recipients who will be notified when conditions are triggered
          - `target` 'RULE' | 'ENVIRONMENT' | 'RULE' | 'ENVIRONMENT', required — The rollback condition target
          - `visitors` integer, required — The rollback condition visitors
        - `segmentId` integer, nullable — ID of the segment targeted by this rule
        - `state` 'ACTIVE' | 'PAUSED' | 'ACTIVE' | 'PAUSED', nullable — Wished state of the rule
        - `type` 'TARGETED_DELIVERY' | 'PROGRESSIVE_DELIVERY' | 'EXPERIMENTATION' | 'PROGRESSIVE_DELIVERY' | 'TARGETED_DELIVERY' | 'EXPERIMENTATION', required — Type of the rule
        - `exposition` integer, nullable, required — Percentage of the traffic exposed to this rule. Required if creating, can be omitted on update for no change.
        - `variationKey` string, required — Variation key used as control in experiments
  - `secondaryGoalIds` integer[], required — Secondary goals associated with the feature flag
  - `tags` string[], required — List of tags associated with the feature flag
  - `variables` VariableRequest[], required — Variables associated with the feature flag
    - `allowedValues` string[], nullable — Allowed enum values
    - `key` string, required — Key to identify the variable
    - `type` 'BOOLEAN' | 'NUMBER' | 'STRING' | 'JSON' | 'JS' | 'CSS' | 'ENUM', required — Type of the variable
    - `value` string, required — Value of the variable
  - `variations` VariationRequest[], required — Variations associated with the feature flag
    - `key` string, required — Key of the variation
    - `name` string, required — Name of the variation
    - `variables` VariationVariableRequest[] — Set of variables implemented by the variation
      - `key` string, required — Key to identify the variable
      - `value` string, required — Value of the variable

## Response `200`

OK

- FeatureFlagConfiguration — Configuration for the feature flag
  - `archived` boolean
  - `attributionWindow` integer — Attribution window
  - `bucketingKey` union
    - BucketingKeyCustomDataDto — Bucketing key used for the feature flag
      - `bucketingKeyType` 'VISITOR_CODE' | 'CUSTOM_DATA'
      - `customDataId` integer
    - BucketingKeyVisitorCodeDto — Bucketing key used for the feature flag
      - `bucketingKeyType` 'VISITOR_CODE' | 'CUSTOM_DATA'
  - `createdById` integer — Created by id
  - `dateContentModified` string, date-time — Date and time when the feature flag configuration content was last modified
  - `dateCreated` string, date-time — Date and time when the feature flag configuration was created
  - `dateModified` string, date-time — Date and time when the feature flag configuration was last modified
  - `description` string — Description of the feature
  - `environmentConfigurations` EnvironmentResponse[] — Environment-specific configurations for the feature flag
    - `dateModified` string, date-time — The date when this environment configuration was last modified
    - `defaultVariationKey` string — Default variation key to serve in this environment
    - `environmentKey` string — Environment key of this configuration
    - `featureEnabled` boolean — Indicates if the feature flag is enabled in this environment
    - `integrations` FeatureFlagIntegrations — Integrations associated with the feature flag environment
      - `deliveryRules` FeatureFlagIntegrations[] — List of integrations enabled for delivery rules
      - `experimentRules` FeatureFlagIntegrations[] — List of integrations enabled for experimentation rules
    - `rolloutRules` union[] — Rollout rules for this environment
      - union
        - ExperimentationRuleResponse — Rollout rules for this environment
          - `experimentId` integer — ID of the experiment linked to this rule
          - `id` integer — Unique identifier of the rule
          - `name` string — Name of the rule
          - `release` FeatureFlagRelease — Release date information about this rule
            - `releaseFrom` string, date-time — Rule being applied from this date
            - `releaseTo` string, date-time — Rule being applied to this date
            - `timeZone` string — Timezone regarding the release of this rule
          - `rollbackConditions` FeatureRollbackCondition[] — Conditions for defining rollback
            - `comparisonOperator` 'GREATER_THAN' | 'LESS_THAN' — The rollback condition comparison operator
            - `criteria` 'UPLIFT' | 'DOWNLIFT' | 'CONVERSION_RATE' — The rollback condition criteria
            - `goalId` integer — The rollback condition goal ID
            - `id` integer — The rollback condition ID
            - `matchValue` number, double — The rollback condition match value
            - `recipients` string[] — List of emails of recipients who will be notified when conditions are triggered
            - `target` 'RULE' | 'ENVIRONMENT' — The rollback condition target
            - `visitors` integer — The rollback condition visitors
          - `segmentId` integer — ID of the segment linked to this rule
          - `status` 'ACTIVE' | 'PAUSED' | 'PLANNED' — Status of the rule
          - `trafficAllocations` FeatureTrafficAllocation[] — Traffic allocation settings for the rule
            - `exposition` number, double
            - `variationId` integer
            - `variationKey` string
          - `type` 'TARGETED_DELIVERY' | 'PROGRESSIVE_DELIVERY' | 'EXPERIMENTATION', required — Type of the rule
          - `controlVariationKey` string
          - `exposition` integer — Percentage of the traffic exposed to this rule
          - `multiArmedBandit` boolean — (Deprecated, use trafficAllocationMethod instead) Enable dynamic allocation for this rule (Multi-Armed Bandit)
          - `trafficAllocationMethod` 'CONTEXTUAL_BANDIT' | 'MANUAL' | 'MULTI_ARMED_BANDIT' — Defines how traffic is distributed in the SDK
        - FeatureRolloutTargetedRule — Rollout rules for this environment
          - `experimentId` integer — ID of the experiment linked to this rule
          - `id` integer — Unique identifier of the rule
          - `name` string — Name of the rule
          - `release` FeatureFlagRelease — Release date information about this rule
            - `releaseFrom` string, date-time — Rule being applied from this date
            - `releaseTo` string, date-time — Rule being applied to this date
            - `timeZone` string — Timezone regarding the release of this rule
          - `rollbackConditions` FeatureRollbackCondition[] — Conditions for defining rollback
            - `comparisonOperator` 'GREATER_THAN' | 'LESS_THAN' — The rollback condition comparison operator
            - `criteria` 'UPLIFT' | 'DOWNLIFT' | 'CONVERSION_RATE' — The rollback condition criteria
            - `goalId` integer — The rollback condition goal ID
            - `id` integer — The rollback condition ID
            - `matchValue` number, double — The rollback condition match value
            - `recipients` string[] — List of emails of recipients who will be notified when conditions are triggered
            - `target` 'RULE' | 'ENVIRONMENT' — The rollback condition target
            - `visitors` integer — The rollback condition visitors
          - `segmentId` integer — ID of the segment linked to this rule
          - `status` 'ACTIVE' | 'PAUSED' | 'PLANNED' — Status of the rule
          - `trafficAllocations` FeatureTrafficAllocation[] — Traffic allocation settings for the rule
            - `exposition` number, double
            - `variationId` integer
            - `variationKey` string
          - `type` 'TARGETED_DELIVERY' | 'PROGRESSIVE_DELIVERY' | 'EXPERIMENTATION', required — Type of the rule
          - `exposition` integer — Percentage of the traffic exposed to this rule
          - `variationKey` string — Key of the variation to serve to visitors matching this rule
        - ProgressiveRuleResponse — Rollout rules for this environment
          - `experimentId` integer — ID of the experiment linked to this rule
          - `id` integer — Unique identifier of the rule
          - `name` string — Name of the rule
          - `release` FeatureFlagRelease — Release date information about this rule
            - `releaseFrom` string, date-time — Rule being applied from this date
            - `releaseTo` string, date-time — Rule being applied to this date
            - `timeZone` string — Timezone regarding the release of this rule
          - `rollbackConditions` FeatureRollbackCondition[] — Conditions for defining rollback
            - `comparisonOperator` 'GREATER_THAN' | 'LESS_THAN' — The rollback condition comparison operator
            - `criteria` 'UPLIFT' | 'DOWNLIFT' | 'CONVERSION_RATE' — The rollback condition criteria
            - `goalId` integer — The rollback condition goal ID
            - `id` integer — The rollback condition ID
            - `matchValue` number, double — The rollback condition match value
            - `recipients` string[] — List of emails of recipients who will be notified when conditions are triggered
            - `target` 'RULE' | 'ENVIRONMENT' — The rollback condition target
            - `visitors` integer — The rollback condition visitors
          - `segmentId` integer — ID of the segment linked to this rule
          - `status` 'ACTIVE' | 'PAUSED' | 'PLANNED' — Status of the rule
          - `trafficAllocations` FeatureTrafficAllocation[] — Traffic allocation settings for the rule
            - `exposition` number, double
            - `variationId` integer
            - `variationKey` string
          - `type` 'TARGETED_DELIVERY' | 'PROGRESSIVE_DELIVERY' | 'EXPERIMENTATION', required — Type of the rule
          - `currentExposition` integer
          - `rolloutConfiguration` union
            - CustomRampUpRollout — Custom Ramp-Up rollout configuration
              - …
            - ProgressiveExposure — Progressive exposure rollout configuration
              - …
          - `variationKey` string — Key of the variation to serve to visitors matching this rule
  - `featureKey` string, required — Key used to identify the feature flag
  - `health` 'PERMANENT' | 'HEALTHY' | 'STALE' | 'SMELLY' — Health of the feature flag (for temporary ones)
  - `id` integer, required — System-generated unique string of integers to identify a feature flag
  - `isArchived` boolean
  - `name` string, required — Name of the feature flag
  - `primaryGoalId` integer — Primary goal of the feature flag
  - `secondaryGoalIds` integer[] — Secondary goals associated with the feature flag
  - `siteCode` string, required — Unique Id for the project in the Kameleoon app. This is an optional field to be included as query parameters
  - `tags` string[] — List of tags associated with the feature flag. This is an optional field to be included as query parameters
  - `teamId` integer — Team id
  - `variables` VariableResponse[] — Variables associated with the feature flag
    - `allowedValues` string[], nullable — Allowed enum values
    - `key` string, required — Key to identify the variable
    - `type` 'BOOLEAN' | 'NUMBER' | 'STRING' | 'JSON' | 'JS' | 'CSS' | 'ENUM', required — Type of the variable
    - `value` string, required — Value of the variable
  - `variations` VariationResponse[] — Variations associated with the feature flag
    - `key` string, required — Key of the variation
    - `name` string, required — Name of the variation
    - `variables` VariationVariableResponse[] — Set of variables implemented by the variation
      - `key` string, required — Key to identify the variable
      - `type` 'BOOLEAN' | 'NUMBER' | 'STRING' | 'JSON' | 'JS' | 'CSS' | 'ENUM', required — Type of the variable
      - `value` string, required — Value of the variable

## Other responses

- `400` — Bad Request
- `403` — Forbidden
- `404` — Feature flag for provided site code and feature key not found
- `423` — Resource Locked
- `500` — Internal Server Error

---

[API](https://skmtc.net/kameleoon/apis/openapi-definition-for-automation-api.md) · [All operations](https://skmtc.net/kameleoon/apis/openapi-definition-for-automation-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/kameleoon/openapi-definition-for-automation-api/revisions/09f2abcea0b5/schema)
