LaunchDarkly Developer Documentation

Get started in under 30 minutes.
LaunchDarkly provides feature flags as a service for Java · Python · Ruby · Go · Node.js · PHP · .NET. Control feature launches -- who sees what and when -- without multiple code deploys. Easy dashboard for phased rollouts, targeting and segmenting.
Need more help? write us at support@launchdarkly.com

Get Started    Documentation

Creating a feature flag

Overview

This topic explains how to create feature flags in LaunchDarkly. You can also clone and modify an existing flag to create new ones.

You can always use the API instead

You can also use the LaunchDarkly API to create and manage feature flags, as well as do many other tasks. LaunchDarkly is an API-first product, so everything you can do in the LaunchDarkly API is also available as an API endpoint.

To learn more, read our REST API Documentation.

Creating a feature flag

You can create and modify feature flags from the dashboard.

To learn more about the dashboard, read The dashboard.

To create a feature flag:

  1. Log into LaunchDarkly. The dashboard appears.
  2. Click New. The "Create a feature flag" screen appears.
The dashboard, with the New button called out.

The dashboard, with the New button called out.

  1. Enter a unique, human-readable Name.
  2. Enter a unique flag Key. You'll use this key to reference the flag in your code. A suggested key auto-populates from the name you enter, but you can customize it if you wish.
  3. (Optional) Enter a Description of the flag. A brief, human-readable description helps your team members understand what the flag is for.
  4. (Optional) Click into the Tags dropdown and choose one or more tags for your flag.

Tags let you sort flags into groups

Tags are useful for managing flag permissions using custom roles. For example, you can tag a flag as "Marketing" and "DevOps", and then use these tags to determine who has read or write access for the flag.

To learn more, read Custom roles.

  1. Choose an option in the Flag variations dropdown. To learn more, read Flag variations.
  2. (Optional) Specify details for your Variation. To learn more, read Flag variations.
  3. (Optional) Select the This is a permanent flag checkbox. If you choose this option, no one will be able to delete this flag after it is created.
  4. (Optional) Select the Make this flag available to client-side SDKs checkbox. If you choose this option, the flag will be pushed out to client-side SDKs.

Flags are not available on the client-side by default

If you're using a client-side SDK, you must make each flag you wish to appear on the frontend available to the client. Making flags available on the client side may have security implications you should consider.

To learn more, read Client-side and server-side SDKs.

  1. Click Save Flag.
The Create a feature flag screen.

The Create a feature flag screen.

That's it! You just created a feature flag. You can see it in the dashboard.

Configuring the same flag in different environments

When you create a feature flag, the flag is scoped to the project you created it from. All environments within a project have the same set of feature flags.

Understanding flag scopes

Flag scoping refers to the parts of LaunchDarkly where a flag is available or used. If a flag is scoped at the project level, it is available to all environments within the project, because projects contain environments.

To learn more about projects, read Projects.
To learn more about environments, read Environments.

Flag configuration settings are specific to each environment. The changes you make in one environment do not apply to the same flag in any other environment. If you want to, you can configure the same flag in a unique way for every environment you have.

To configure a flag:

  1. Navigate to the dashboard.
  2. Click the environment name in the top left corner. The Switch environment menu appears.
The Switch environment menu.

The Switch environment menu.

  1. Search for the environment you wish to switch to and click on it, or choose it from the list. The dashboard for the new environment appears.

Look for the header change

You know you're in a different environment because the name displayed in the top left corner changes when you select that environment from the list.

  1. Find the flag you wish to modify and make whatever changes you like.

Cloning flags

You can also create new flags by cloning existing flags. Instead of creating an entirely new flag with complicated configuration, you can clone and modify an existing flag with similar configuration.

When you clone a flag, LaunchDarkly makes a new flag and copies the original flag's targeting configuration for all environments, including whether the flag is toggled on or off.

To clone a flag:

  1. Navigate to the dashboard.
  2. Find the flag you wish to clone and click its name. The flag detail page opens.
  1. Click into the flag's Settings tab. The flag Settings menu opens.
  2. Click Clone This Flag. The "Clone feature flag" screen appears.
  1. Enter a unique, human-readable Name.
  2. Enter a unique flag Key. You'll use this key to reference the flag in your code. A suggested key auto-populates from the name you enter, but you can customize it if you wish.
  3. (Optional) Enter a Description of the flag. A brief, human-readable description helps your team members understand what the flag is for.
  4. (Optional) Click into the Tags dropdown and choose one or more tags for your flag.

Tags sort flags into groups

Tags are useful for managing flag permissions using custom roles. For example, you can tag a flag as "Marketing" and "DevOps", and then use these tags to determine who has read or write access for the flag.

To learn more, read Custom roles.

  1. Click Save Flag. You are taken to the new flag's details page.

The new flag also appears in the dashboard, where you can search for it or access it any time.


Creating a feature flag


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.