provider Context settings PUT /api/v2/projects/{projectKey}/environments/{environmentKey}/contexts/{contextKind}/{contextKey}/flags/{featureFlagKey}
@utdk/launchdarkly /api/v2/projects/{projectKey}/environments/{environmentKey}/contexts/{contextKind}/{contextKey}/flags/{featureFlagKey}
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.
projectKey path required
The project key
string
environmentKey path required
The environment key
string
contextKind path required
The context kind
string
contextKey path required
The context key
string
featureFlagKey path required
The feature flag key
string

Try it

Authentication
Configure credentials for LaunchDarkly REST API
Gateway
The gateway proxies requests and injects credentials server-side. Configure credentials above, then enter your gateway URL.

Saved automatically to browser storage.

putcontextflagsetting
PUT/api/v2/projects/{projectKey}/environments/{environmentKey}/contexts/{contextKind}/{contextKey}/flags/{featureFlagKey}
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.

Parameters

required

The project key

required

The environment key

required

The context kind

required

The context key

required

The feature flag key

Input

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

Optional comment describing the change

Enter a gateway URL above to enable sending.

Code snippet
Updates live as you fill in the form above.

TypeScript

import launchdarkly from '@utdk/launchdarkly';

await launchdarkly.putcontextflagsetting()