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

Get Started    Documentation


Environments allow you to manage your feature flags throughout your entire development lifecycle — from local development to QA, staging, and production.

When you first sign up, you're provided with two environments within a project. By default, they're named Test and Production. Each environment has its own SDK key, which is used to connect the LaunchDarkly SDK to a specific environment.

Each feature flag that you create has its own set of targeting rules for each environment. This means that you can change your flag rollout rules in a development or staging environment for QA testing before rolling out to production.

The LaunchDarkly sidebar has a dropdown widget that shows you the current project and environment and allows you to quickly switch environments.

You can manage your environments from your Account settings page. Here, you can add new environments to a project (for example, to give each developer on your team their own environment for local testing).

Each environment has its own swatch color. The swatch color gives you a quick visual indication of which environment you're working on.

Migrating content between environments

You can migrate some, but not all, content between environments.

Use the REST API to migrate flags from one environment to another. First, GET the feature flag you wish to import, then PATCH to update the flag configuration in production.

To learn more about these endpoints, read Get feature flag and Update feature flag.

Additionally, script is available that automates the process of syncing an environment's data to another environment, although this script does not migrate any information about user segments.

To learn more about the script, see the LaunchDarkly Github repository.

Reset SDK key

When editing your environment, you'll see the option to reset your SDK key for that environment. Clicking the "Reset SDK Key" button will bring up a confirmation screen. From there you have the option to keep the old SDK key active for a period of time.

TTL setting

Each environment also has a time-to-live (TTL) setting. This sets the number of minutes that the PHP SDK can cache feature flag rules locally.

TTL settings

The TTL is only used in our PHP SDK, since PHP's shared-nothing architecture makes our streaming model impossible.

For customers using PHP, we recommend setting your TTL to at least 5 minutes in production environments. This lets our SDKs cache feature flag rules for 5 minutes, so most calls to variation will not make a remote request. The tradeoff is that changes you make to your feature flag rules on your dashboard will not take effect for 5 minutes.

If your site has relatively low traffic (fewer than one request per minute), you may wish to increase the TTL to 5 minutes or more to take better advantage of the local cache.

If the TTL is set to 0 minutes, the SDK will not use a local cache, and every call to variation will make a remote request to our CDN. You can set your TTL to 0 in testing environments to see changes reflected immediately, but we do not recommend a 0 minute TTL in production.

In high volume PHP environments, we strongly recommend using the the LaunchDarkly relay proxy.

Require Comments

When creating or editing an environment, you'll see the option to "Require comments for flag and segment changes".

By clicking the "Require comments for flag and segment changes" checkbox you can mark whether changes to flags and segments within that environment must include a comment.

This is useful to enforce change management policies in critical environments like your production environment.

Require Environment Confirmations

When creating or editing an environment, you'll see the option to "Require confirmation for flag and segment changes".

By clicking the "Require confirmation for flag and segment changes" checkbox you can mark whether changes to flags and segments within that environment will require the user to enter the name or key for that environment.

This is useful to reduce the risk of unintentionally changing flags in your production environment or other critical environments.


Suggested Edits are limited on API Reference Pages

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