v5

latestOpenAPI 3.0.3Apache 2.0raw.githubusercontent.com2026-02-283466592.5 MB
Context settings

Update flag settings for context

Enable or disable a feature flag for a context based on its context kind and key.

In the request body, the setting should be the variation value to set for the context. It must match the flag's variation type. For example, for a boolean flag you can use "setting": true or "setting": false in the request body. For a string flag, you can use "setting": "existing_variation_value_to_use".

Omitting the setting attribute from the request body, or including a setting of null, erases the current setting for a context.

If you previously patched the flag, and the patch included the context's data, LaunchDarkly continues to use that data. If LaunchDarkly has never encountered the combination of the context's key and kind before, it calculates the flag values based on the context kind and key.

put/api/v2/projects/{projectKey}/environments/{environmentKey}/contexts/{contextKind}/{contextKey}/flags/{featureFlagKey}

Path parameters

projectKeystring string required

The project key

The project key

environmentKeystring string required

The environment key

The environment key

contextKindstring string required

The context kind

The context kind

contextKeystring string required

The context key

The context key

featureFlagKeystring string required

The feature flag key

The feature flag key

Request body

settingstring

The variation value to set for the context. Must match the flag's variation type.

commentstring

Optional comment describing the change

Example request

{
  "setting": "existing_variation_value_to_use",
  "comment": "make sure this context experiences a specific variation"
}

Response

Action succeeded