No results for ""
  • Home
  • API docs

LaunchDarkly CLI

Read time: 4 minutes
Last edited: Jun 28, 2024


This topic describes how to get started with the LaunchDarkly CLI.

LaunchDarkly provides a command line interface (CLI) so that you can set up and manage your feature flags, account members, projects, environments, teams, and other resources directly from the command line.


The LaunchDarkly CLI is available for macOS, Windows, and Linux.

To install the LaunchDarkly CLI:

brew tap launchdarkly/homebrew-tap
brew install ldcli

To update to the latest version of the LaunchDarkly CLI:

brew upgrade ldcli

Common commands in ldcli

To get started with the LaunchDarkly CLI, you need to authenticate with an access token. The config command controls authorization and other configuration values.

Here's how to configure your credentials:

# you only need to run this once
ldcli config --set access-token <your access token>

To learn how to create an access token, read API access tokens.


The setup command provides a step-by-step guide to create a flag, install an SDK, and toggle that flag:

ldcli setup

Available commands

The majority of the LaunchDarkly commands are resource commands. These commands provide direct access to LaunchDarkly APIs.

To view available commands:


Input and output formats

For each LaunchDarkly CLI resource command, you can use command line arguments, or use your shell to provide an input file.

For example, here's how to create a flag using data from the command line:

ldcli flags create --project default -d '{"name": "Example flag", "key": "example-flag"}'

Here's how to create the same flag using data from a file:

ldcli flags create --project default -d "$(cat data.json)"

By default, resource commands return a simplified plaintext output. For example, the default output message for creating the new flag in the example above is Successfully created Example flag (example-flag).

To view the full JSON response from any resource command, use the --output json flag. Optionally, pipe the result through jq for improved formatting. Here's how:

ldcli flags create --project default -d '{"name": "Example flag", "key": "example-flag"}' --output json | jq

If you prefer a particular output format, you can use the config command to set that preference:

ldcli config --set output json # or plaintext

Access SDK credentials

You can access the SDK credentials for a specific project and environment using the environments resource. You need different SDK credentials depending on which SDK you're working with. To learn more about SDK credentials, read Keys.

Here's how:

# use the SDK key for authorization in server-side SDKs
ldcli environments get --project <your project> --environment <your environment> | jq '.apiKey'

Additional documentation

Use the ldcli [command] --help command to view usage information for all commands for the LaunchDarkly CLI.

To view and contribute to the LaunchDarkly CLI source code, or to file issues for our team, visit the LaunchDarkly CLI GitHub repository.