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    Guides

Bitbucket pipes

The ld-find-code-refs utility can be used with Bitbucket Pipelines to automatically populate code references in LaunchDarkly. We'll create a Pipes configuration using LaunchDarkly's code reference pipe

Initial setup

  1. If you haven't already, create a LaunchDarkly access token with the correct permissions.
  2. Create a new pipelines configuration in your selected Bitbucket repository. If you don't already have a pipeline configuration file, you'll need to create a new Pipelines configuration, by visiting the Pipelines section on your repository's webpage.
  3. The pipeline step should run on push, using the default configuration. The access token configured earlier should be included as a secured variable named LD_ACCESS_TOKEN, in addition to a variable named LD_PROJ_KEY, set to the desired LaunchDarkly project key. Here's an example of a minimal Pipeline configuration:

The following code may be copied and pasted into a blank pipeline configuration, assuming the LD_PROJ_KEY and LD_ACCESS_TOKEN environment variables have been configured as repository variables:

    - step:
          - pipe: launchdarkly/ld-find-code-refs-pipe:1.0.0
              LD_PROJ_KEY: $LD_PROJ_KEY
  1. Once your pipeline has been created, the best way to confirm that the pipeline is executing successfully is to create a new pull request with the workflow file, and verify that the newly created pipeline is succeeding, by visiting the Pipelines page on your repository's webpage. If your pipeline fails, there may be a problem with your configuration. To investigate, dig into the pipeline's logs to view any error messages.

Pipeline configuration

The code reference pipe may be configured with additional environment variables to enable more functionality.



A LaunchDarkly personal access token with writer-level access, or access to the code-references custom role resource. Should be supplied as a secured environment variable.



A LaunchDarkly project key. The flag parser will search this project for code references in this project.



A regular expression (PCRE) defining the files, file types, and directories which the flag finder should exclude.

Examples: vendor/, vendor/.*, .*\.css



The number of context lines above and below a code reference for the flag parser to send to LaunchDarkly.

If < 0, no source code will be sent to LaunchDarkly.

If 0, only the lines containing flag references will be sent.

If > 0, will send that number of context lines above and below the flag reference.

A maximum of 5 context lines may be provided. Defaults to 2



Set the base URL of the LaunchDarkly server for this configuration. Defaults to



Enables verbose default logging. Defaults to false



Specifies additional delimiters used to match flag keys. Must be a non-control ASCII character. If more than one character is provided in delimiters, each character will be treated as a separate delimiter. Will only match flag keys with surrounded by any of the specified delimeters. This option may also be specified multiple times for multiple delimiters. By default, only flags delimited by single-quotes, double-quotes, and backticks will be matched. Default: [" ']`.


Bitbucket pipes

Suggested Edits are limited on API Reference Pages

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