> ## Documentation Index
> Fetch the complete documentation index at: https://launchdarkly.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# CircleCI code references

<View title="Developer" />

<View title="Federal docs" />

<View title="EU docs" />

<Note>
  **Code references are available to customers on select plans**

  Code references are only available to customers on select plans. To learn more, [read about our pricing](https://launchdarkly.com/pricing/). To upgrade your plan, [contact Sales](https://launchdarkly.com/contact-sales/).
</Note>

This topic explains how you can use the `ld-find-code-refs` utility with CircleCI to automatically populate code references in LaunchDarkly.

## Prerequisites

To complete this procedure, you must have the following prerequisites:

* An API access token with write permissions for the `code-reference-repository` resource, either through a base role, a LaunchDarkly-provided project role, or another role that you have created. To learn more, read [API access tokens](/docs/home/account/api) and [Code reference actions](/docs/home/account/roles/role-actions#code-reference-actions).
* The LaunchDarkly [CircleCI Orb](https://circleci.com/orbs/registry/orb/launchdarkly/ld-find-code-refs).

<Note>
  **Circle Workflow version 2.1 or higher is required**

  To use CircleCI code references, you must be using a Circle Workflow version of 2.1 or higher. If you're using an earlier version, try manually using the utility binary or docker image to create your own workflow job. To learn more, read [Execution via CLI](https://github.com/launchdarkly/ld-find-code-refs/tree/main/README.md#execution-via-cli) in the `ld-find-code-refs` documentation.
</Note>

## Set up the LaunchDarkly CircleCI integration

To set up the LaunchDarkly orb in CircleCI:

1. Save your API access token as an environment variable titled `LD_ACCESS_TOKEN` in your CircleCI project settings. To learn more, read [CircleCI's documentation](https://circleci.com/docs/guides/security/set-environment-variable/#set-an-environment-variable-in-a-project).
2. Create a YAML file in CircleCI with configuration including LaunchDarkly's Orb.
   Here's an example minimal configuration using LaunchDarkly's Orb:

   <CodeGroup>
     ```yaml title="YAML" lines wrap theme={null}
     version: 2.1

     orbs:
       launchdarkly: launchdarkly/ld-find-code-refs@2.12.0

     workflows:
       main:
         jobs:
           - launchdarkly/find-code-references:
               proj_key: $YOUR_LAUNCHDARKLY_PROJECT_KEY
               repo_type: github # can be 'bitbucket', 'custom', 'github', or 'gitlab'
               repo_url: $YOUR_REPO_URL # used to generate links to your repository
     ```
   </CodeGroup>

## Additional configuration options

There are additional configuration options for the code references orb.

To skip searching files and directories, use an [`.ldignore`](https://github.com/launchdarkly/ld-find-code-refs/blob/main/docs/CONFIGURATION.md#ignoring-files-and-directories) file.

To configure custom delimiters and aliases for your flag keys, or to set other advanced configuration, use the [`.launchdarkly/coderefs.yaml`](https://github.com/launchdarkly/ld-find-code-refs/blob/main/docs/CONFIGURATION.md#advanced-yaml-configuration) file.
