Perform a partial update to a feature flag. The request body must be a valid semantic patch, JSON patch, or JSON merge patch. To learn more the different formats, read Updates.
The body of a semantic patch request for updating feature flags takes the following properties:
Click to expand instructions for working with targeting and variations
These instructions require the environmentKey
parameter.
Several of the instructions for working with targeting and variations require flag rule IDs, variation IDs, or clause IDs as parameters. Each of these are returned as part of the Get feature flag response. The flag rule ID is the _id
field of each element in the rules
array within each environment listed in the environments
object. The variation ID is the _id
field in each element of the variations
array. The clause ID is the _id
field of each element of the clauses
array within the rules
array within each environment listed in the environments
object.
addClauses
Adds the given clauses to the rule indicated by ruleId
.
Parameters
ruleId
: ID of a rule in the flag.
clauses
: Array of clause objects, with contextKind
(string), attribute
(string), op
(string), negate
(boolean), and values
(array of strings, numbers, or dates) properties. The contextKind
, attribute
, and values
are case sensitive. The op
must be lower-case.
Here’s an example:
addPrerequisite
Adds the flag indicated by key
with variation variationId
as a prerequisite to the flag in the path parameter.
Parameters
key
: Flag key of the prerequisite flag.
variationId
: ID of a variation of the prerequisite flag.
Here’s an example:
addRule
Adds a new targeting rule to the flag. The rule may contain clauses
and serve the variation that variationId
indicates, or serve a percentage rollout that rolloutWeights
, rolloutBucketBy
, and rolloutContextKind
indicate.
If you set beforeRuleId
, this adds the new rule before the indicated rule. Otherwise, adds the new rule to the end of the list.
Parameters
-
clauses
: Array of clause objects, with contextKind
(string), attribute
(string), op
(string), negate
(boolean), and values
(array of strings, numbers, or dates) properties. The contextKind
, attribute
, and values
are case sensitive. The op
must be lower-case.
-
beforeRuleId
: (Optional) ID of a flag rule.
-
Either
variationId
: ID of a variation of the flag.
or
rolloutWeights
: (Optional) Map of variationId
to weight, in thousandths of a percent (0-100000).
rolloutBucketBy
: (Optional) Context attribute available in the specified rolloutContextKind
.
rolloutContextKind
: (Optional) Context kind, defaults to user
Here’s an example that uses a variationId
:
Here’s an example that uses a percentage rollout:
addTargets
Adds context keys to the individual context targets for the context kind that contextKind
specifies and the variation that variationId
specifies. Returns an error if this causes the flag to target the same context key in multiple variations.
Parameters
values
: List of context keys.
contextKind
: (Optional) Context kind to target, defaults to user
variationId
: ID of a variation on the flag.
Here’s an example:
addUserTargets
Adds user keys to the individual user targets for the variation that variationId
specifies. Returns an error if this causes the flag to target the same user key in multiple variations. If you are working with contexts, use addTargets
instead of this instruction.
Parameters
values
: List of user keys.
variationId
: ID of a variation on the flag.
Here’s an example:
addValuesToClause
Adds values
to the values of the clause that ruleId
and clauseId
indicate. Does not update the context kind, attribute, or operator.
Parameters
ruleId
: ID of a rule in the flag.
clauseId
: ID of a clause in that rule.
values
: Array of strings, case sensitive.
Here’s an example:
addVariation
Adds a variation to the flag.
Parameters
value
: The variation value.
name
: (Optional) The variation name.
description
: (Optional) A description for the variation.
Here’s an example:
clearTargets
Removes all individual targets from the variation that variationId
specifies. This includes both user and non-user targets.
Parameters
variationId
: ID of a variation on the flag.
Here’s an example:
clearUserTargets
Removes all individual user targets from the variation that variationId
specifies. If you are working with contexts, use clearTargets
instead of this instruction.
Parameters
variationId
: ID of a variation on the flag.
Here’s an example:
removeClauses
Removes the clauses specified by clauseIds
from the rule indicated by ruleId
.
Parameters
ruleId
: ID of a rule in the flag.
clauseIds
: Array of IDs of clauses in the rule.
Here’s an example:
removePrerequisite
Removes the prerequisite flag indicated by key
. Does nothing if this prerequisite does not exist.
Parameters
key
: Flag key of an existing prerequisite flag.
Here’s an example:
removeRule
Removes the targeting rule specified by ruleId
. Does nothing if the rule does not exist.
Parameters
ruleId
: ID of a rule in the flag.
Here’s an example:
removeTargets
Removes context keys from the individual context targets for the context kind that contextKind
specifies and the variation that variationId
specifies. Does nothing if the flag does not target the context keys.
Parameters
values
: List of context keys.
contextKind
: (Optional) Context kind to target, defaults to user
variationId
: ID of a flag variation.
Here’s an example:
removeUserTargets
Removes user keys from the individual user targets for the variation that variationId
specifies. Does nothing if the flag does not target the user keys. If you are working with contexts, use removeTargets
instead of this instruction.
Parameters
values
: List of user keys.
variationId
: ID of a flag variation.
Here’s an example:
removeValuesFromClause
Removes values
from the values of the clause indicated by ruleId
and clauseId
. Does not update the context kind, attribute, or operator.
Parameters
ruleId
: ID of a rule in the flag.
clauseId
: ID of a clause in that rule.
values
: Array of strings, case sensitive.
Here’s an example:
removeVariation
Removes a variation from the flag.
Parameters
variationId
: ID of a variation of the flag to remove.
Here’s an example:
reorderRules
Rearranges the rules to match the order given in ruleIds
. Returns an error if ruleIds
does not match the current set of rules on the flag.
Parameters
ruleIds
: Array of IDs of all rules in the flag.
Here’s an example:
replacePrerequisites
Removes all existing prerequisites and replaces them with the list you provide.
Parameters
prerequisites
: A list of prerequisites. Each item in the list must include a flag key
and variationId
.
Here’s an example:
replaceRules
Removes all targeting rules for the flag and replaces them with the list you provide.
Parameters
Here’s an example:
replaceTargets
Removes all existing targeting and replaces it with the list of targets you provide.
Parameters
targets
: A list of context targeting. Each item in the list includes an optional contextKind
that defaults to user
, a required variationId
, and a required list of values
.
Here’s an example:
replaceUserTargets
Removes all existing user targeting and replaces it with the list of targets you provide. In the list of targets, you must include a target for each of the flag’s variations. If you are working with contexts, use replaceTargets
instead of this instruction.
Parameters
targets
: A list of user targeting. Each item in the list must include a variationId
and a list of values
.
Here’s an example:
updateClause
Replaces the clause indicated by ruleId
and clauseId
with clause
.
Parameters
ruleId
: ID of a rule in the flag.
clauseId
: ID of a clause in that rule.
clause
: New clause
object, with contextKind
(string), attribute
(string), op
(string), negate
(boolean), and values
(array of strings, numbers, or dates) properties. The contextKind
, attribute
, and values
are case sensitive. The op
must be lower-case.
Here’s an example:
updateDefaultVariation
Updates the default on or off variation of the flag.
Parameters
onVariationValue
: (Optional) The value of the variation of the new on variation.
offVariationValue
: (Optional) The value of the variation of the new off variation
Here’s an example:
updateFallthroughVariationOrRollout
Updates the default or “fallthrough” rule for the flag, which the flag serves when a context matches none of the targeting rules. The rule can serve either the variation that variationId
indicates, or a percentage rollout that rolloutWeights
and rolloutBucketBy
indicate.
Parameters
variationId
: ID of a variation of the flag.
or
rolloutWeights
: Map of variationId
to weight, in thousandths of a percent (0-100000).
rolloutBucketBy
: (Optional) Context attribute available in the specified rolloutContextKind
.
rolloutContextKind
: (Optional) Context kind, defaults to user
Here’s an example that uses a variationId
:
Here’s an example that uses a percentage rollout:
updateOffVariation
Updates the default off variation to variationId
. The flag serves the default off variation when the flag’s targeting is Off.
Parameters
variationId
: ID of a variation of the flag.
Here’s an example:
updatePrerequisite
Changes the prerequisite flag that key
indicates to use the variation that variationId
indicates. Returns an error if this prerequisite does not exist.
Parameters
key
: Flag key of an existing prerequisite flag.
variationId
: ID of a variation of the prerequisite flag.
Here’s an example:
updateRuleDescription
Updates the description of the feature flag rule.
Parameters
description
: The new human-readable description for this rule.
ruleId
: The ID of the rule. You can retrieve this by making a GET request for the flag.
Here’s an example:
updateRuleTrackEvents
Updates whether or not LaunchDarkly tracks events for the feature flag associated with this rule.
Parameters
ruleId
: The ID of the rule. You can retrieve this by making a GET request for the flag.
trackEvents
: Whether or not events are tracked.
Here’s an example:
updateRuleVariationOrRollout
Updates what ruleId
serves when its clauses evaluate to true. The rule can serve either the variation that variationId
indicates, or a percent rollout that rolloutWeights
and rolloutBucketBy
indicate.
Parameters
-
ruleId
: ID of a rule in the flag.
-
variationId
: ID of a variation of the flag.
or
-
rolloutWeights
: Map of variationId
to weight, in thousandths of a percent (0-100000).
-
rolloutBucketBy
: (Optional) Context attribute available in the specified rolloutContextKind
.
-
rolloutContextKind
: (Optional) Context kind, defaults to user
Here’s an example:
updateTrackEvents
Updates whether or not LaunchDarkly tracks events for the feature flag, for all rules.
Parameters
trackEvents
: Whether or not events are tracked.
Here’s an example:
updateTrackEventsFallthrough
Updates whether or not LaunchDarkly tracks events for the feature flag, for the default rule.
Parameters
trackEvents
: Whether or not events are tracked.
Here’s an example:
updateVariation
Updates a variation of the flag.
Parameters
variationId
: The ID of the variation to update.
name
: (Optional) The updated variation name.
value
: (Optional) The updated variation value.
description
: (Optional) The updated variation description.
Here’s an example:
Click to expand instructions for updating flag settings
These instructions do not require the environmentKey
parameter. They make changes that apply to the flag across all environments.
addCustomProperties
Adds a new custom property to the feature flag. Custom properties are used to associate feature flags with LaunchDarkly integrations. For example, if you create an integration with an issue tracking service, you may want to associate a flag with a list of issues related to a feature’s development.
Parameters
key
: The custom property key.
name
: The custom property name.
values
: A list of the associated values for the custom property.
Here’s an example:
Adds tags to the feature flag.
Parameters
values
: A list of tags to add.
Here’s an example:
makeFlagPermanent
Marks the feature flag as permanent. LaunchDarkly does not prompt you to remove permanent flags, even if one variation is rolled out to all your customers.
Here’s an example:
makeFlagTemporary
Marks the feature flag as temporary.
Here’s an example:
removeCustomProperties
Removes the associated values from a custom property. If all the associated values are removed, this instruction also removes the custom property.
Parameters
key
: The custom property key.
values
: A list of the associated values to remove from the custom property.
removeMaintainer
Removes the flag’s maintainer. To set a new maintainer, use the updateMaintainerMember
or updateMaintainerTeam
instructions.
Here’s an example:
Removes tags from the feature flag.
Parameters
values
: A list of tags to remove.
Here’s an example:
replaceCustomProperties
Replaces the existing associated values for a custom property with the new values.
Parameters
key
: The custom property key.
name
: The custom property name.
values
: A list of the new associated values for the custom property.
Here’s an example:
turnOffClientSideAvailability
Turns off client-side SDK availability for the flag. This is equivalent to unchecking the SDKs using Mobile key and/or SDKs using Client-side ID boxes for the flag. If you’re using a client-side or mobile SDK, you must expose your feature flags in order for the client-side or mobile SDKs to evaluate them.
Parameters
value
: Use “usingMobileKey” to turn off availability for mobile SDKs. Use “usingEnvironmentId” to turn on availability for client-side SDKs.
Here’s an example:
turnOnClientSideAvailability
Turns on client-side SDK availability for the flag. This is equivalent to checking the SDKs using Mobile key and/or SDKs using Client-side ID boxes for the flag. If you’re using a client-side or mobile SDK, you must expose your feature flags in order for the client-side or mobile SDKs to evaluate them.
Parameters
value
: Use “usingMobileKey” to turn on availability for mobile SDKs. Use “usingEnvironmentId” to turn on availability for client-side SDKs.
Here’s an example:
updateDescription
Updates the feature flag description.
Parameters
value
: The new description.
Here’s an example:
updateMaintainerMember
Updates the maintainer of the flag to an existing member and removes the existing maintainer.
Parameters
value
: The ID of the member.
Here’s an example:
updateMaintainerTeam
Updates the maintainer of the flag to an existing team and removes the existing maintainer.
Parameters
value
: The key of the team.
Here’s an example:
updateName
Updates the feature flag name.
Parameters
Here’s an example:
If a request attempts to alter a flag configuration in an environment where approvals are required for the flag, the request will fail with a 405. Changes to the flag configuration in that environment will require creating an approval request.
If a flag configuration change made through this endpoint would cause a pending scheduled change or approval request to fail, this endpoint will return a 400. You can ignore this check by adding an ignoreConflicts
query parameter set to true
.