provider Feature flags GET
/api/v2/flags/{projectKey}/{featureFlagKey} @utdk/launchdarkly
/api/v2/flags/{projectKey}/{featureFlagKey} Get feature flag
Get a single feature flag by key. By default, this returns the configurations for all environments. You can filter environments with the `env` query parameter. For example, setting `env=production` restricts the returned configurations to just the `production` environment.
> #### Recommended use
>
> This endpoint can return a large amount of information. Specifying one or multiple environments with the `env` parameter can decrease response time and overall payload size. We recommend using this parameter to return only the environments relevant to your query.
### Expanding response
LaunchDarkly supports the `expand` query param to include additional fields in the response, with the following fields:
- `evaluation` includes evaluation information within returned environments, including which context kinds the flag has been evaluated for in the past 30 days
- `migrationSettings` includes migration settings information within the flag and within returned environments. These settings are only included for migration flags, that is, where `purpose` is `migration`.
For example, `expand=evaluation` includes the `evaluation` field in the response.
- projectKey path required
- The project key
- string
- featureFlagKey path required
- The feature flag key
- string
- env query
- Filter configurations by environment
- string
- expand query
- A comma-separated list of fields to expand in the response. Supported fields are explained above.
- 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.
Code snippet
Updates live as you fill in the form above.
TypeScript
import launchdarkly from '@utdk/launchdarkly';
await launchdarkly.getfeatureflag()