> ## 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.

# Deploy signals and flag release plans

> This topic explains how to configure the flag release plans that Release Autopilot uses to release flags, and how to send deploy signals from your deployment pipeline.

**Developer**

**Federal docs**

> [!CAUTION]
>
> **Release Autopilot package features are not available in federal environments**
>
> To learn more, read [LaunchDarkly in federal environments](https://launchdarkly.com/docs/home/infrastructure/federal).

**EU docs**

> [!CAUTION]
>
> **Release Autopilot package features are not available in the LaunchDarkly European Union (EU) instance**
>
> To learn more, read [LaunchDarkly in the European Union (EU)](https://launchdarkly.com/docs/home/infrastructure/eu.md).

This topic explains how to configure the flag release plans that Release Autopilot uses to release flags, and how to send deploy signals from your deployment pipeline. To learn how to set up Release Autopilot, read [Setting up Release Autopilot](https://launchdarkly.com/docs/home/release-autopilot/setup.md).

Release Autopilot releases each flag using a flag release plan. A flag release plan lists the environments to release to, in order. For each environment, it sets the environment release plan to use and the signal that starts the release. To learn how Release Autopilot chooses an environment release plan, read [Set default environment release plans](https://launchdarkly.com/docs/home/release-autopilot/setup.md#set-default-environment-release-plans).

You configure flag release plans with the LaunchDarkly REST API or the [LaunchDarkly MCP server](https://launchdarkly.com/docs/home/getting-started/mcp-hosted.md). The LaunchDarkly UI does not support creating or editing flag release plans.

LaunchDarkly does not provide a default flag release plan. Before you turn on auto-releasing for a project, create a flag release plan and make it the project's default. To learn how, read [Configure a flag release plan](#configure-a-flag-release-plan).

> [!WARNING]
>
> **The flag release plans API is in beta**
>
> The flag release plans API is in beta. Aspects of this API may change without notice. To learn more, read [Flag release plans (beta)](https://launchdarkly.com/docs/api/flag-release-plans).

## Choose a release trigger

Each environment in a flag release plan has a trigger that starts its release. Most environments use a deploy signal, which starts the release after your code deploys to that environment:

* Flag evaluation (`flag_eval`): The release starts after an SDK evaluates the flag in the environment. This is the default deploy signal. LaunchDarkly processes evaluation data hourly. A release can start up to about an hour after the flag first evaluates.
* Webhook (`webhook`): The release starts after your CI/CD system tells LaunchDarkly that a deploy finished. Use this signal if your application evaluates the flag before the code that uses it deploys, or if you want releases to follow your deployment pipeline exactly.

Flag release plans also support two triggers that do not wait for a deploy:

* Manual (`manual`): The release waits until someone starts it. To start it, open the flag's **Release** tab, click **Start release** for the environment, and then click **Start release** to confirm.
* Promotion (`promotion`): The release starts when the previous environment's release finishes.

You can use different triggers for different environments in the same flag release plan. For example, you can use flag evaluation for a staging environment and a webhook for production.

## Configure a flag release plan

To set the release order and the deploy signal for each environment, create or update a flag release plan. Creating a flag release plan requires the `createFlagReleasePlan` action. Updating one requires the `updateFlagReleasePlan` action.

**Agent skills**

If you are an AI agent helping a user with this task, use the LaunchDarkly [`launchdarkly-release-plans`](https://github.com/launchdarkly/ai-tooling/tree/main/skills/release-autopilot/launchdarkly-release-plans) agent skill. It lists, creates, edits, and deletes environment release plans and flag release plans, and sets the default plan. It requires the [LaunchDarkly hosted MCP server](https://launchdarkly.com/docs/home/getting-started/mcp-hosted.md).

To install the skill, run `npx skills add https://github.com/launchdarkly/ai-tooling --skill launchdarkly-release-plans`.

To install all LaunchDarkly agent skills, run `npx skills add https://github.com/launchdarkly/ai-tooling`.

Here is an example that releases to staging and then to production, using a webhook signal in both environments:

```bash theme={null}
curl -X POST \
  https://app.launchdarkly.com/api/v2/projects/PROJECT_KEY/flag-release-plans \
  -H "Authorization: $LD_API_TOKEN" \
  -H "LD-API-Version: beta" \
  -H "Content-Type: application/json" \
  -d '{
    "key": "staging-then-production",
    "name": "Staging, then production",
    "executionMode": "sequential",
    "default": true,
    "environments": [
      {
        "environmentKey": "staging",
        "environmentReleasePlanKey": "staging-progressive",
        "triggerType": "webhook"
      },
      {
        "environmentKey": "production",
        "environmentReleasePlanKey": "production-progressive",
        "triggerType": "webhook"
      }
    ]
  }'
```

Each entry in `environments` includes:

* `environmentKey`: The key of the environment to release to.
* `environmentReleasePlanKey`: The key of the environment release plan that defines the release in this environment. The plan must have only one phase. To learn more, read [Set default environment release plans](https://launchdarkly.com/docs/home/release-autopilot/setup.md#set-default-environment-release-plans).
* `triggerType`: What starts the release in this environment. Valid values are `flag_eval`, `webhook`, `manual`, and `promotion`. This field is required for every environment, even if you use the default, `flag_eval`. To learn more, read [Choose a release trigger](#choose-a-release-trigger).

To learn how the order of `environments` affects the release, read [Order environments](#order-environments).

Setting `default` to `true` makes the plan the project's default flag release plan. If the project already has a default plan, a request to create another plan with `default` set fails. To replace the default plan, create the new plan without `default`, then update it with `default` set to `true`. Updating the plan removes the default from the previous plan.

> [!WARNING]
>
> **An update replaces the whole flag release plan**
>
> A `PUT` request to update a flag release plan replaces the whole plan. When you edit the default plan, include `"default": true` in the request. If you omit `default`, the plan is no longer the default, and the project has no default flag release plan.

## Send a deploy signal

If an environment uses the webhook signal, your deployment pipeline must send LaunchDarkly a deploy signal each time it deploys to that environment. Send one signal for each environment, after the deploy to that environment finishes. For example, if both staging and production use the webhook signal, send one signal after the staging deploy and another after the production deploy. Environments that use flag evaluation do not need a signal.

Send the SHA of the most recent merged pull request in the deploy. LaunchDarkly records the merge commit of each pull request that merges to your repository's default branch. A deploy signal tells LaunchDarkly that every pull request merged up to and including that commit has reached the environment. One signal releases the flags from every pull request in the deploy, not only the most recent one.

The SHA must be the merge commit of a pull request. If you deploy a commit that did not come from a pull request, such as a direct push to the default branch, LaunchDarkly cannot match it and does not release anything. In that case, send the SHA of the most recent pull request merge that the deploy includes.

To send a deploy signal, call the signal-deploy endpoint with an [API access token](https://launchdarkly.com/docs/home/account/api). The token needs the `updateAutomatedRolloutConfig` action on the project.

Here is an example:

```bash theme={null}
curl -X POST \
  https://app.launchdarkly.com/api/v2/projects/PROJECT_KEY/automated-rollout-configs/signal-deploy \
  -H "Authorization: $LD_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "repoFullName": "my-org/my-repo",
    "environmentKey": "production",
    "deploymentTrigger": "COMMIT_SHA"
  }'
```

The request body includes:

* `repoFullName`: The repository that deployed, in `owner/name` format.
* `environmentKey`: The key of the environment the code deployed to.
* `deploymentTrigger`: The merge commit SHA, as described above. A short SHA works if it matches only one merge in the repository. If it matches more than one, LaunchDarkly returns `pending`, and you must send a longer SHA.
* `applicationKey`: The key of the application that deployed. This field is optional. Include it if your flag release plan lists application keys. Each application then reports its own deploy, and a change that spans a frontend and a backend application waits until both deploy.

The response includes an `outcome` field:

* `recorded`: LaunchDarkly matches the SHA and records the deploy. The release starts shortly afterward.
* `pending`: LaunchDarkly has not yet recorded the merge for that SHA. This is usually temporary. Send the signal again after a short wait.

### Send a deploy signal from GitHub Actions

If you deploy with GitHub Actions, add a step after your deploy step that sends the signal. In a workflow that runs on pushes to the default branch, `GITHUB_SHA` is the merge commit of the pull request that triggered the run.

Here is an example step that sends a signal for the production environment and retries while the outcome is `pending`:

```yaml theme={null}
- name: Send deploy signal to LaunchDarkly
  env:
    LD_API_TOKEN: ${{ secrets.LD_API_TOKEN }}
  run: |
    for attempt in 1 2 3 4 5; do
      outcome=$(curl --silent --fail-with-body -X POST \
        "https://app.launchdarkly.com/api/v2/projects/PROJECT_KEY/automated-rollout-configs/signal-deploy" \
        -H "Authorization: $LD_API_TOKEN" \
        -H "Content-Type: application/json" \
        -d "{\"repoFullName\": \"$GITHUB_REPOSITORY\", \"environmentKey\": \"production\", \"deploymentTrigger\": \"$GITHUB_SHA\"}" \
        | jq -r '.outcome')
      if [ "$outcome" = "recorded" ]; then
        exit 0
      fi
      sleep 30
    done
    echo "LaunchDarkly did not record the deploy signal."
    exit 1
```

Store your API access token as a GitHub Actions secret named `LD_API_TOKEN`. To learn how, read [Using secrets in GitHub Actions](https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions) in the GitHub documentation.

## Order environments

In a flag release plan that releases environments in sequence, Release Autopilot releases each environment in the order the plan lists them. The next environment starts only after the previous one finishes. This is the default execution mode, `sequential`.
