---
title: LaunchDarkly actions
source: https://docs.newrelic.com/docs/workflow-automation/setup-and-configure/actions-catalog/launchdarkly/launchdarkly
---

The LaunchDarkly actions let you manage feature flags directly from your workflows. You can list projects and environments, create and modify flags, toggle flags on or off, manage percentage rollouts, and control which contexts receive a given flag variation.

All actions authenticate with a LaunchDarkly personal or service access token sent as the raw `Authorization` header — no `Bearer` prefix. Each action accepts an optional `baseUrl` input so you can target the EU (`https://app.eu.launchdarkly.com`) or federal (`https://app.launchdarkly.us`) instance instead of the default US instance.

> #### 💡 TIP
>
> Selector expressions for LaunchDarkly actions must parse `responseBody` as JSON. Start every selector expression with `.responseBody | fromjson`, for example `.responseBody | fromjson.key`.

## Prerequisites

-   A LaunchDarkly account with at least one project.
-   A personal or service access token with the roles required for the actions you plan to use. See [LaunchDarkly API access tokens](https://docs.launchdarkly.com/home/account-security/api-access-tokens).
-   Store the token as a secret in the New Relic Secrets Service and reference it using `${{ :secrets:<keyName> }}`.

## Action reference [#action-reference]

| Action                                                                   | What it does                                                      | Key required inputs                                                                            |
| ------------------------------------------------------------------------ | ----------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| [`launchDarkly.project.list`](#project-list)                             | List all projects in the account                                  | `token`                                                                                        |
| [`launchDarkly.environment.list`](#environment-list)                     | List environments in a project                                    | `token`, `projectKey`                                                                          |
| [`launchDarkly.flag.create`](#flag-create)                               | Create a flag — returns variation IDs needed by targeting actions | `token`, `projectKey`, `name`, `key`                                                           |
| [`launchDarkly.flag.get`](#flag-get)                                     | Get flag configuration                                            | `token`, `projectKey`, `featureFlagName`                                                       |
| [`launchDarkly.flag.list`](#flag-list)                                   | List flags in a project                                           | `token`, `projectKey`                                                                          |
| [`launchDarkly.flag.toggle`](#flag-toggle)                               | Turn a flag on or off in one environment                          | `token`, `projectKey`, `env`, `featureFlagName`, `enabled`                                     |
| [`launchDarkly.flag.archive`](#flag-archive)                             | Soft-delete a flag (reversible)                                   | `token`, `projectKey`, `featureFlagName`                                                       |
| [`launchDarkly.flag.copy`](#flag-copy)                                   | Copy flag settings between environments (Enterprise plan only)    | `token`, `projectKey`, `featureFlagName`, `sourceEnvironmentKey`, `targetEnvironmentKey`       |
| [`launchDarkly.flagStatus.get`](#flagstatus-get)                         | Get flag lifecycle status in one environment                      | `token`, `projectKey`, `env`, `featureFlagName`                                                |
| [`launchDarkly.flagStatus.list`](#flagstatus-list)                       | List statuses for all flags in an environment                     | `token`, `projectKey`, `env`                                                                   |
| [`launchDarkly.rollout.get`](#rollout-get)                               | Get current rollout percentages                                   | `token`, `projectKey`, `env`, `featureFlagName`                                                |
| [`launchDarkly.rollout.update`](#rollout-update)                         | Set rollout percentages                                           | `token`, `projectKey`, `env`, `featureFlagName`, `rolloutWeights`                              |
| [`launchDarkly.contextTarget.add`](#contexttarget-add)                   | Pin specific contexts to a variation                              | `token`, `projectKey`, `env`, `featureFlagName`, `variationId`, `contextKeys`                  |
| [`launchDarkly.contextTarget.remove`](#contexttarget-remove)             | Remove contexts from individual targeting                         | `token`, `projectKey`, `env`, `featureFlagName`, `variationId`, `contextKeys`                  |
| [`launchDarkly.contextTargetExpiry.add`](#contexttargetexpiry-add)       | Schedule a context to be removed from targeting at a given time   | `token`, `projectKey`, `env`, `featureFlagName`, `contextKey`, `variationId`, `expirationDate` |
| [`launchDarkly.contextTargetExpiry.update`](#contexttargetexpiry-update) | Change the time at which a scheduled expiry fires                 | `token`, `projectKey`, `env`, `featureFlagName`, `contextKey`, `variationId`, `expirationDate` |
| [`launchDarkly.contextTargetExpiry.remove`](#contexttargetexpiry-remove) | Cancel a scheduled expiry                                         | `token`, `projectKey`, `env`, `featureFlagName`, `contextKey`, `variationId`                   |

## Common patterns [#common-patterns]

### Disable a flag during an incident [#pattern-disable]

Use [`launchDarkly.flag.toggle`](#flag-toggle) with `enabled: false`. This is a single-step operation — no other actions are needed.

### Gradually roll out a flag and promote to 100% [#pattern-rollout]

1.  Create the flag with [`launchDarkly.flag.create`](#flag-create) — capture variation IDs from the response.
2.  Set an initial low rollout with [`launchDarkly.rollout.update`](#rollout-update) using the captured variation IDs.
3.  Monitor with [`launchDarkly.flagStatus.get`](#flagstatus-get) until the flag reaches `active` status.
4.  Promote to 100% with another [`launchDarkly.rollout.update`](#rollout-update).
5.  Archive with [`launchDarkly.flag.archive`](#flag-archive) when the rollout is complete.

### Beta-test with named users and auto-expire access [#pattern-beta]

1.  Add specific users with [`launchDarkly.contextTarget.add`](#contexttarget-add) — this action accepts a list of context keys.
2.  Schedule automatic removal for each user with [`launchDarkly.contextTargetExpiry.add`](#contexttargetexpiry-add) — this action accepts a single `contextKey`, so you need one step per user.
3.  To extend access, use [`launchDarkly.contextTargetExpiry.update`](#contexttargetexpiry-update).
4.  To cancel the scheduled removal entirely, use [`launchDarkly.contextTargetExpiry.remove`](#contexttargetexpiry-remove).

## List projects [#project-list]

**Action identifier:** `launchDarkly.project.list`

Lists the projects in the LaunchDarkly account.

### Inputs

| Input       | Type    | Description                                                                                                                                                                                                                                                |
| ----------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `token`     | String  | **Required.** LaunchDarkly access token sent as the `Authorization` header. Must be passed as a secret. For example, `${{ :secrets:launchDarklyApiToken }}`.                                                                                               |
| `baseUrl`   | String  | **Optional.** LaunchDarkly host. Defaults to `https://app.launchdarkly.com`. Use `https://app.eu.launchdarkly.com` for the EU instance or `https://app.launchdarkly.us` for the federal instance. No trailing slash or path.                               |
| `limit`     | Integer | **Optional.** Maximum number of projects to return. For example, `20`.                                                                                                                                                                                     |
| `offset`    | Integer | **Optional.** Number of items to skip for pagination. For example, `0`.                                                                                                                                                                                    |
| `filter`    | String  | **Optional.** LaunchDarkly filter expression to narrow results. For example, `query:checkout`.                                                                                                                                                             |
| `sort`      | String  | **Optional.** Field to sort by. Prefix with `-` for descending order. For example, `name`.                                                                                                                                                                 |
| `selectors` | List    | **Optional.** JQ selectors to extract fields from the response. `responseBody` is a JSON string — start each expression with `.responseBody | fromjson`. For example, `[{"name": "projectKeys", "expression": "[.responseBody | fromjson.items[].key]"}]`. |

### Outputs

| Output         | Type    | Description                                                                                                                                                                                                                                                                                                                  |
| -------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `success`      | Boolean | `true` when LaunchDarkly returns a 2xx status.                                                                                                                                                                                                                                                                               |
| `response`     | Object  | Present when `success` is `true`; `null` on error. Contains `statusCode` (Int) and `responseBody` (String, the raw JSON from LaunchDarkly). The body includes `items` (array of projects) and `totalCount` (Int). For more information, see the [Get projects API](https://launchdarkly.com/docs/api/projects/get-projects). |
| `errorMessage` | String  | Error detail if the call failed.                                                                                                                                                                                                                                                                                             |

### Example

```yaml
name: listLaunchDarklyProjects
description: List all projects in the LaunchDarkly account
steps:
  - name: listProjects
    type: action
    action: launchDarkly.project.list
    version: '1'
    inputs:
      token: ${{ :secrets:launchDarklyApiToken }}
      selectors:
        - name: projectKeys
          expression: "[.responseBody | fromjson.items[].key]"
        - name: totalCount
          expression: ".responseBody | fromjson.totalCount"
    next: end
```

## List environments [#environment-list]

**Action identifier:** `launchDarkly.environment.list`

Lists the environments in a LaunchDarkly project.

### Inputs

| Input        | Type    | Description                                                                                                                                                           |
| ------------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `token`      | String  | **Required.** LaunchDarkly access token. Must be passed as a secret.                                                                                                  |
| `baseUrl`    | String  | **Optional.** LaunchDarkly host. Defaults to `https://app.launchdarkly.com`.                                                                                          |
| `projectKey` | String  | **Required.** The project key. For example, `my-project`.                                                                                                             |
| `limit`      | Integer | **Optional.** Maximum number of environments to return.                                                                                                               |
| `offset`     | Integer | **Optional.** Number of items to skip for pagination.                                                                                                                 |
| `filter`     | String  | **Optional.** LaunchDarkly filter expression. For example, `query:checkout`.                                                                                          |
| `sort`       | String  | **Optional.** Field to sort by. Prefix with `-` for descending order.                                                                                                 |
| `selectors`  | List    | **Optional.** JQ selectors to extract fields from the response. For example, `[{"name": "environmentKeys", "expression": "[.responseBody | fromjson.items[].key]"}]`. |

### Outputs

| Output         | Type    | Description                                                                                                                                                                                                                                                                                                             |
| -------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `success`      | Boolean | `true` when LaunchDarkly returns a 2xx status.                                                                                                                                                                                                                                                                          |
| `response`     | Object  | Present when `success` is `true`; `null` on error. Contains `statusCode` (Int) and `responseBody` (String). The body includes `items` (array of environments) and `totalCount` (Int). For more information, see the [Get environments API](https://launchdarkly.com/docs/api/environments/get-environments-by-project). |
| `errorMessage` | String  | Error detail if the call failed.                                                                                                                                                                                                                                                                                        |

### Example

```yaml
name: listLaunchDarklyEnvironments
description: List all environments in a LaunchDarkly project
steps:
  - name: listEnvironments
    type: action
    action: launchDarkly.environment.list
    version: '1'
    inputs:
      token: ${{ :secrets:launchDarklyApiToken }}
      projectKey: my-project
      selectors:
        - name: environmentKeys
          expression: "[.responseBody | fromjson.items[].key]"
    next: end
```

## Create a flag [#flag-create]

**Action identifier:** `launchDarkly.flag.create`

Creates a feature flag in a LaunchDarkly project. Defaults to a boolean flag when no `variations` are provided. Use the variation IDs from the `response` in subsequent steps that target specific variations.

### Inputs

| Input                    | Type    | Description                                                                                                                                                                                                                                |
| ------------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `token`                  | String  | **Required.** LaunchDarkly access token. Must be passed as a secret.                                                                                                                                                                       |
| `baseUrl`                | String  | **Optional.** LaunchDarkly host. Defaults to `https://app.launchdarkly.com`.                                                                                                                                                               |
| `projectKey`             | String  | **Required.** The project key. For example, `my-project`.                                                                                                                                                                                  |
| `name`                   | String  | **Required.** Human-readable flag name. For example, `New checkout flow`.                                                                                                                                                                  |
| `key`                    | String  | **Required.** Unique flag key used to reference the flag in code and in other actions. For example, `new-checkout`.                                                                                                                        |
| `description`            | String  | **Optional.** Flag description. For example, `Gates the new checkout flow`.                                                                                                                                                                |
| `tags`                   | List    | **Optional.** Tags to attach. For example, `["checkout", "release"]`.                                                                                                                                                                      |
| `temporary`              | Boolean | **Optional.** Whether the flag is temporary. LaunchDarkly defaults to `true`; pass `false` to create a permanent flag.                                                                                                                     |
| `variations`             | List    | **Optional.** Flag variations, each with a `value` and optional `name` and `description`. Omit to create a boolean flag. For example, `[{"value": true, "name": "Enabled"}, {"value": false, "name": "Disabled"}]`.                        |
| `defaults`               | Map     | **Optional.** Indexes of the default on and off variations. Both `onVariation` and `offVariation` are required if this map is provided. For example, `{"onVariation": 0, "offVariation": 1}`.                                              |
| `clientSideAvailability` | Map     | **Optional.** Whether to expose the flag to client-side SDKs. Both `usingEnvironmentId` and `usingMobileKey` are required if this map is provided. For example, `{"usingEnvironmentId": true, "usingMobileKey": false}`.                   |
| `maintainerId`           | String  | **Optional.** Member ID of the flag maintainer.                                                                                                                                                                                            |
| `customProperties`       | Map     | **Optional.** Custom properties to attach to the flag. For example, `{"jira": {"name": "Jira", "value": ["NR-1234"]}}`.                                                                                                                    |
| `clone`                  | String  | **Optional.** Key of an existing flag to clone from, including its targeting in every environment.                                                                                                                                         |
| `selectors`              | List    | **Optional.** JQ selectors to extract fields from the response. For example, `[{"name": "flagKey", "expression": ".responseBody | fromjson.key"}, {"name": "variationIds", "expression": "[.responseBody | fromjson.variations[]._id]"}]`. |

### Outputs

| Output         | Type    | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| -------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `success`      | Boolean | `true` when LaunchDarkly returns a 2xx status.                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `response`     | Object  | Present when `success` is `true`; `null` on error. Contains `statusCode` (Int) and `responseBody` (String). The body includes the full flag representation, including `key` (String), `name` (String), `variations` (Array — each variation has an `_id` you can pass to targeting actions), and per-environment settings under `environments`. For more information, see the [Create feature flag API](https://launchdarkly.com/docs/api/feature-flags/post-feature-flag). |
| `errorMessage` | String  | Error detail if the call failed.                                                                                                                                                                                                                                                                                                                                                                                                                                            |

### Example

```yaml
name: createFeatureFlag
description: Create a permanent boolean feature flag and capture its variation IDs
steps:
  - name: createFlag
    type: action
    action: launchDarkly.flag.create
    version: '1'
    inputs:
      token: ${{ :secrets:launchDarklyApiToken }}
      projectKey: my-project
      name: New checkout flow
      key: new-checkout
      temporary: false
      selectors:
        - name: flagKey
          expression: ".responseBody | fromjson.key"
        - name: trueVariationId
          expression: ".responseBody | fromjson.variations[0]._id"
        - name: falseVariationId
          expression: ".responseBody | fromjson.variations[1]._id"
    next: end
```

> #### ⚠️ IMPORTANT
>
> `flag.create` returns a variation ID for each variation in `responseBody.variations[]._id`. Capture these IDs with selectors — you need them in every subsequent step that targets a specific variation: `flag.toggle`, `rollout.update`, `contextTarget.add`, `contextTarget.remove`, and all three `contextTargetExpiry` actions.

## Get a flag [#flag-get]

**Action identifier:** `launchDarkly.flag.get`

Gets the configuration of a feature flag, optionally scoped to one environment.

### Inputs

| Input             | Type   | Description                                                                                                                                                                                                                                |
| ----------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `token`           | String | **Required.** LaunchDarkly access token. Must be passed as a secret.                                                                                                                                                                       |
| `baseUrl`         | String | **Optional.** LaunchDarkly host. Defaults to `https://app.launchdarkly.com`.                                                                                                                                                               |
| `projectKey`      | String | **Required.** The project key. For example, `my-project`.                                                                                                                                                                                  |
| `featureFlagName` | String | **Required.** The feature flag key. For example, `new-checkout`.                                                                                                                                                                           |
| `env`             | String | **Optional.** Limit the response to this environment. Omit to include all environments. For example, `production`.                                                                                                                         |
| `selectors`       | List   | **Optional.** JQ selectors to extract fields from the response. For example, `[{"name": "flagName", "expression": ".responseBody | fromjson.name"}, {"name": "on", "expression": ".responseBody | fromjson.environments.production.on"}]`. |

### Outputs

| Output         | Type    | Description                                                                                                                                                                                                                                                                         |
| -------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `success`      | Boolean | `true` when LaunchDarkly returns a 2xx status.                                                                                                                                                                                                                                      |
| `response`     | Object  | Present when `success` is `true`; `null` on error. Contains `statusCode` (Int) and `responseBody` (String). The body includes the full flag representation. For more information, see the [Get feature flag API](https://launchdarkly.com/docs/api/feature-flags/get-feature-flag). |
| `errorMessage` | String  | Error detail if the call failed.                                                                                                                                                                                                                                                    |

### Example

```yaml
name: getFeatureFlag
description: Get the configuration of a feature flag for one environment
steps:
  - name: getFlag
    type: action
    action: launchDarkly.flag.get
    version: '1'
    inputs:
      token: ${{ :secrets:launchDarklyApiToken }}
      projectKey: my-project
      featureFlagName: new-checkout
      env: production
      selectors:
        - name: flagName
          expression: ".responseBody | fromjson.name"
        - name: on
          expression: ".responseBody | fromjson.environments.production.on"
    next: end
```

## List flags [#flag-list]

**Action identifier:** `launchDarkly.flag.list`

Lists the feature flags in a LaunchDarkly project.

### Inputs

| Input        | Type    | Description                                                                                                                                                    |
| ------------ | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `token`      | String  | **Required.** LaunchDarkly access token. Must be passed as a secret.                                                                                           |
| `baseUrl`    | String  | **Optional.** LaunchDarkly host. Defaults to `https://app.launchdarkly.com`.                                                                                   |
| `projectKey` | String  | **Required.** The project key. For example, `my-project`.                                                                                                      |
| `limit`      | Integer | **Optional.** Maximum number of flags to return.                                                                                                               |
| `offset`     | Integer | **Optional.** Number of items to skip for pagination.                                                                                                          |
| `filter`     | String  | **Optional.** LaunchDarkly filter expression. For example, `query:checkout`.                                                                                   |
| `sort`       | String  | **Optional.** Field to sort by. Prefix with `-` for descending order.                                                                                          |
| `env`        | String  | **Optional.** Include flag settings for this environment in the response.                                                                                      |
| `tag`        | String  | **Optional.** Return only flags with this tag. For example, `release`.                                                                                         |
| `archived`   | Boolean | **Optional.** Return archived flags instead of active ones. Defaults to `false`.                                                                               |
| `summary`    | Boolean | **Optional.** Return a summary of each flag without full per-environment configuration. For example, `true`.                                                   |
| `selectors`  | List    | **Optional.** JQ selectors to extract fields from the response. For example, `[{"name": "flagKeys", "expression": "[.responseBody | fromjson.items[].key]"}]`. |

### Outputs

| Output         | Type    | Description                                                                                                                                                                                                                                                                                              |
| -------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `success`      | Boolean | `true` when LaunchDarkly returns a 2xx status.                                                                                                                                                                                                                                                           |
| `response`     | Object  | Present when `success` is `true`; `null` on error. Contains `statusCode` (Int) and `responseBody` (String). The body includes `items` (array of flags) and `totalCount` (Int). For more information, see the [Get feature flags API](https://launchdarkly.com/docs/api/feature-flags/get-feature-flags). |
| `errorMessage` | String  | Error detail if the call failed.                                                                                                                                                                                                                                                                         |

### Example

```yaml
name: listFeatureFlags
description: List all flags with a given tag
steps:
  - name: listFlags
    type: action
    action: launchDarkly.flag.list
    version: '1'
    inputs:
      token: ${{ :secrets:launchDarklyApiToken }}
      projectKey: my-project
      tag: release
      selectors:
        - name: flagKeys
          expression: "[.responseBody | fromjson.items[].key]"
        - name: totalCount
          expression: ".responseBody | fromjson.totalCount"
    next: end
```

## Toggle a flag [#flag-toggle]

**Action identifier:** `launchDarkly.flag.toggle`

Turns a feature flag on or off in one environment.

### Inputs

| Input             | Type    | Description                                                                                                                                                           |
| ----------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `token`           | String  | **Required.** LaunchDarkly access token. Must be passed as a secret.                                                                                                  |
| `baseUrl`         | String  | **Optional.** LaunchDarkly host. Defaults to `https://app.launchdarkly.com`.                                                                                          |
| `projectKey`      | String  | **Required.** The project key. For example, `my-project`.                                                                                                             |
| `env`             | String  | **Required.** The environment key. For example, `production`.                                                                                                         |
| `featureFlagName` | String  | **Required.** The feature flag key. For example, `new-checkout`.                                                                                                      |
| `enabled`         | Boolean | **Required.** `true` turns the flag on; `false` turns it off.                                                                                                         |
| `comment`         | String  | **Optional.** Comment recorded in the flag audit log. For example, `Enabled by incident workflow`.                                                                    |
| `selectors`       | List    | **Optional.** JQ selectors to extract fields from the response. For example, `[{"name": "on", "expression": ".responseBody | fromjson.environments.production.on"}]`. |

### Outputs

| Output         | Type    | Description                                                                                                                                                                                                                                                                                 |
| -------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `success`      | Boolean | `true` when LaunchDarkly returns a 2xx status.                                                                                                                                                                                                                                              |
| `response`     | Object  | Present when `success` is `true`; `null` on error. Contains `statusCode` (Int) and `responseBody` (String). The body includes the updated flag representation. For more information, see the [Update feature flag API](https://launchdarkly.com/docs/api/feature-flags/patch-feature-flag). |
| `errorMessage` | String  | Error detail if the call failed.                                                                                                                                                                                                                                                            |

### Example

```yaml
name: enableFeatureFlag
description: Turn a feature flag on in production
steps:
  - name: toggleFlag
    type: action
    action: launchDarkly.flag.toggle
    version: '1'
    inputs:
      token: ${{ :secrets:launchDarklyApiToken }}
      projectKey: my-project
      env: production
      featureFlagName: new-checkout
      enabled: true
      comment: Enabled by incident workflow
    next: end
```

## Archive a flag [#flag-archive]

**Action identifier:** `launchDarkly.flag.archive`

Archives a feature flag in a LaunchDarkly project. Archiving is a reversible soft-disable: the flag is hidden from the flag list and can be restored in LaunchDarkly. The flag key stays reserved until the flag is restored, so a workflow cannot recreate a flag under the same key while it is archived.

> #### ⚠️ IMPORTANT
>
> There is no delete action for LaunchDarkly flags. Permanent deletion cannot be rolled back if a workflow runs by mistake. Use `launchDarkly.flag.archive` instead — it can be undone in LaunchDarkly.

### Inputs

| Input             | Type   | Description                                                                                                                                               |
| ----------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `token`           | String | **Required.** LaunchDarkly access token. Must be passed as a secret.                                                                                      |
| `baseUrl`         | String | **Optional.** LaunchDarkly host. Defaults to `https://app.launchdarkly.com`.                                                                              |
| `projectKey`      | String | **Required.** The project key. For example, `my-project`.                                                                                                 |
| `featureFlagName` | String | **Required.** The feature flag key. For example, `new-checkout`.                                                                                          |
| `comment`         | String | **Optional.** Comment recorded in the flag audit log. For example, `Archived by cleanup workflow`.                                                        |
| `selectors`       | List   | **Optional.** JQ selectors to extract fields from the response. For example, `[{"name": "archived", "expression": ".responseBody | fromjson.archived"}]`. |

### Outputs

| Output         | Type    | Description                                                                                                                                                                                                                                                                                          |
| -------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `success`      | Boolean | `true` when LaunchDarkly returns a 2xx status.                                                                                                                                                                                                                                                       |
| `response`     | Object  | Present when `success` is `true`; `null` on error. Contains `statusCode` (Int) and `responseBody` (String). The body is the updated flag with `archived` set to `true`. For more information, see the [Update feature flag API](https://launchdarkly.com/docs/api/feature-flags/patch-feature-flag). |
| `errorMessage` | String  | Error detail if the call failed.                                                                                                                                                                                                                                                                     |

### Example

```yaml
name: archiveFeatureFlag
description: Archive a feature flag after a successful rollout
steps:
  - name: archiveFlag
    type: action
    action: launchDarkly.flag.archive
    version: '1'
    inputs:
      token: ${{ :secrets:launchDarklyApiToken }}
      projectKey: my-project
      featureFlagName: new-checkout
      comment: Archived by cleanup workflow
      selectors:
        - name: archived
          expression: ".responseBody | fromjson.archived"
    next: end
```

## Copy flag settings [#flag-copy]

**Action identifier:** `launchDarkly.flag.copy`

Copies a feature flag's settings from one environment to another within the same project.

> #### ⚠️ IMPORTANT
>
> Copying flag settings is a LaunchDarkly Enterprise plan feature. On any other plan, LaunchDarkly rejects the request and the action fails.

### Inputs

| Input                  | Type    | Description                                                                                                                                                                                                             |
| ---------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `token`                | String  | **Required.** LaunchDarkly access token. Must be passed as a secret.                                                                                                                                                    |
| `baseUrl`              | String  | **Optional.** LaunchDarkly host. Defaults to `https://app.launchdarkly.com`.                                                                                                                                            |
| `projectKey`           | String  | **Required.** The project key. For example, `my-project`.                                                                                                                                                               |
| `featureFlagName`      | String  | **Required.** The feature flag key. For example, `new-checkout`.                                                                                                                                                        |
| `sourceEnvironmentKey` | String  | **Required.** Environment to copy settings from. For example, `staging`.                                                                                                                                                |
| `targetEnvironmentKey` | String  | **Required.** Environment to copy settings to. For example, `production`.                                                                                                                                               |
| `sourceCurrentVersion` | Integer | **Optional.** Expected version of the source environment flag. The copy fails if the source has changed since. For example, `12`.                                                                                       |
| `targetCurrentVersion` | Integer | **Optional.** Expected version of the target environment flag. The copy fails if the target has changed since. For example, `7`.                                                                                        |
| `includedActions`      | List    | **Optional.** Copy only these parts of the flag (for example, `updateOn`, `updateRules`, `updateFallthrough`, `updateOffVariation`, `updatePrerequisites`, `updateTargets`). Cannot be combined with `excludedActions`. |
| `excludedActions`      | List    | **Optional.** Copy everything except these parts. Cannot be combined with `includedActions`.                                                                                                                            |
| `comment`              | String  | **Optional.** Comment recorded in the flag audit log.                                                                                                                                                                   |
| `selectors`            | List    | **Optional.** JQ selectors to extract fields from the response. For example, `[{"name": "flagKey", "expression": ".responseBody | fromjson.key"}]`.                                                                     |

### Outputs

| Output         | Type    | Description                                                                                                                                                                                                                                                                        |
| -------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `success`      | Boolean | `true` when LaunchDarkly returns a 2xx status.                                                                                                                                                                                                                                     |
| `response`     | Object  | Present when `success` is `true`; `null` on error. Contains `statusCode` (Int) and `responseBody` (String). The body is the updated flag representation. For more information, see the [Copy feature flag API](https://launchdarkly.com/docs/api/feature-flags/copy-feature-flag). |
| `errorMessage` | String  | Error detail if the call failed.                                                                                                                                                                                                                                                   |

### Example

```yaml
name: copyFlagToProduction
description: Copy flag settings from staging to production
steps:
  - name: copyFlag
    type: action
    action: launchDarkly.flag.copy
    version: '1'
    inputs:
      token: ${{ :secrets:launchDarklyApiToken }}
      projectKey: my-project
      featureFlagName: new-checkout
      sourceEnvironmentKey: staging
      targetEnvironmentKey: production
      comment: Promoted by release workflow
    next: end
```

## Get flag status [#flagstatus-get]

**Action identifier:** `launchDarkly.flagStatus.get`

Gets the status of a feature flag in one environment. Possible statuses are `new`, `active`, `inactive`, and `launched`.

### Inputs

| Input             | Type   | Description                                                                                                                                         |
| ----------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `token`           | String | **Required.** LaunchDarkly access token. Must be passed as a secret.                                                                                |
| `baseUrl`         | String | **Optional.** LaunchDarkly host. Defaults to `https://app.launchdarkly.com`.                                                                        |
| `projectKey`      | String | **Required.** The project key. For example, `my-project`.                                                                                           |
| `env`             | String | **Required.** The environment key. For example, `production`.                                                                                       |
| `featureFlagName` | String | **Required.** The feature flag key. For example, `new-checkout`.                                                                                    |
| `selectors`       | List   | **Optional.** JQ selectors to extract fields from the response. For example, `[{"name": "status", "expression": ".responseBody | fromjson.name"}]`. |

### Outputs

| Output         | Type    | Description                                                                                                                                                                                                                                                                                                                                                           |
| -------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `success`      | Boolean | `true` when LaunchDarkly returns a 2xx status.                                                                                                                                                                                                                                                                                                                        |
| `response`     | Object  | Present when `success` is `true`; `null` on error. Contains `statusCode` (Int) and `responseBody` (String). The body includes `name` (String: `new`, `active`, `inactive`, or `launched`) and `lastRequested` (String or null). For more information, see the [Get feature flag status API](https://launchdarkly.com/docs/api/feature-flags/get-feature-flag-status). |
| `errorMessage` | String  | Error detail if the call failed.                                                                                                                                                                                                                                                                                                                                      |

### Example

```yaml
name: checkFlagStatus
description: Get the status of a feature flag in production
steps:
  - name: getFlagStatus
    type: action
    action: launchDarkly.flagStatus.get
    version: '1'
    inputs:
      token: ${{ :secrets:launchDarklyApiToken }}
      projectKey: my-project
      env: production
      featureFlagName: new-checkout
      selectors:
        - name: status
          expression: ".responseBody | fromjson.name"
    next: end
```

## List flag statuses [#flagstatus-list]

**Action identifier:** `launchDarkly.flagStatus.list`

Lists the status of every feature flag in one environment.

### Inputs

| Input        | Type   | Description                                                                                                                                            |
| ------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `token`      | String | **Required.** LaunchDarkly access token. Must be passed as a secret.                                                                                   |
| `baseUrl`    | String | **Optional.** LaunchDarkly host. Defaults to `https://app.launchdarkly.com`.                                                                           |
| `projectKey` | String | **Required.** The project key. For example, `my-project`.                                                                                              |
| `env`        | String | **Required.** The environment key. For example, `production`.                                                                                          |
| `selectors`  | List   | **Optional.** JQ selectors to extract fields from the response. For example, `[{"name": "statuses", "expression": ".responseBody | fromjson.items"}]`. |

### Outputs

| Output         | Type    | Description                                                                                                                                                                                                                                                                                                                    |
| -------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `success`      | Boolean | `true` when LaunchDarkly returns a 2xx status.                                                                                                                                                                                                                                                                                 |
| `response`     | Object  | Present when `success` is `true`; `null` on error. Contains `statusCode` (Int) and `responseBody` (String). The body includes `items` (array, each with `name` and `lastRequested`). For more information, see the [Get feature flag statuses API](https://launchdarkly.com/docs/api/feature-flags/get-feature-flag-statuses). |
| `errorMessage` | String  | Error detail if the call failed.                                                                                                                                                                                                                                                                                               |

### Example

```yaml
name: listFlagStatuses
description: List the status of every flag in an environment
steps:
  - name: listStatuses
    type: action
    action: launchDarkly.flagStatus.list
    version: '1'
    inputs:
      token: ${{ :secrets:launchDarklyApiToken }}
      projectKey: my-project
      env: production
      selectors:
        - name: statuses
          expression: ".responseBody | fromjson.items"
    next: end
```

## Get rollout [#rollout-get]

**Action identifier:** `launchDarkly.rollout.get`

Gets a feature flag's default (fallthrough) rule for one environment, including its percentage rollout. The rollout is in `environments.<env>.fallthrough` of the response body.

### Inputs

| Input             | Type   | Description                                                                                                                                                                             |
| ----------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `token`           | String | **Required.** LaunchDarkly access token. Must be passed as a secret.                                                                                                                    |
| `baseUrl`         | String | **Optional.** LaunchDarkly host. Defaults to `https://app.launchdarkly.com`.                                                                                                            |
| `projectKey`      | String | **Required.** The project key. For example, `my-project`.                                                                                                                               |
| `env`             | String | **Required.** The environment key. For example, `production`.                                                                                                                           |
| `featureFlagName` | String | **Required.** The feature flag key. For example, `new-checkout`.                                                                                                                        |
| `selectors`       | List   | **Optional.** JQ selectors to extract fields from the response. For example, `[{"name": "fallthrough", "expression": ".responseBody | fromjson.environments.production.fallthrough"}]`. |

### Outputs

| Output         | Type    | Description                                                                                                                                                                                                                                                                                     |
| -------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `success`      | Boolean | `true` when LaunchDarkly returns a 2xx status.                                                                                                                                                                                                                                                  |
| `response`     | Object  | Present when `success` is `true`; `null` on error. Contains `statusCode` (Int) and `responseBody` (String). The rollout is in `environments.<env>.fallthrough.rollout`. For more information, see the [Get feature flag API](https://launchdarkly.com/docs/api/feature-flags/get-feature-flag). |
| `errorMessage` | String  | Error detail if the call failed.                                                                                                                                                                                                                                                                |

### Example

```yaml
name: getRolloutConfig
description: Get the current rollout percentage for a flag
steps:
  - name: getRollout
    type: action
    action: launchDarkly.rollout.get
    version: '1'
    inputs:
      token: ${{ :secrets:launchDarklyApiToken }}
      projectKey: my-project
      env: production
      featureFlagName: new-checkout
      selectors:
        - name: fallthrough
          expression: ".responseBody | fromjson.environments.production.fallthrough"
    next: end
```

## Update rollout [#rollout-update]

**Action identifier:** `launchDarkly.rollout.update`

Updates the percentage rollout of a feature flag's fallthrough rule in one environment. Rollout weights are in thousandths of a percent and must sum to 100000.

### Inputs

| Input                | Type   | Description                                                                                                                                                                                                                                                                                                                                                                            |
| -------------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `token`              | String | **Required.** LaunchDarkly access token. Must be passed as a secret.                                                                                                                                                                                                                                                                                                                   |
| `baseUrl`            | String | **Optional.** LaunchDarkly host. Defaults to `https://app.launchdarkly.com`.                                                                                                                                                                                                                                                                                                           |
| `projectKey`         | String | **Required.** The project key. For example, `my-project`.                                                                                                                                                                                                                                                                                                                              |
| `env`                | String | **Required.** The environment key. For example, `production`.                                                                                                                                                                                                                                                                                                                          |
| `featureFlagName`    | String | **Required.** The feature flag key. For example, `new-checkout`.                                                                                                                                                                                                                                                                                                                       |
| `rolloutWeights`     | Map    | **Required.** Map of variation ID to weight in thousandths of a percent. Weights must sum to 100000 (representing 100%). Common conversions: 10% = 10000, 25% = 25000, 50% = 50000, 100% = 100000. Use variation IDs from a prior `flag.create` or `flag.get` step. For example, `{"<trueVariationId>": 10000, "<falseVariationId>": 90000}` sets a 10% rollout to the true variation. |
| `rolloutContextKind` | String | **Optional.** Context kind to bucket by. For example, `user`.                                                                                                                                                                                                                                                                                                                          |
| `rolloutBucketBy`    | String | **Optional.** Context attribute to bucket by. For example, `key`.                                                                                                                                                                                                                                                                                                                      |
| `comment`            | String | **Optional.** Comment recorded in the flag audit log.                                                                                                                                                                                                                                                                                                                                  |
| `selectors`          | List   | **Optional.** JQ selectors to extract fields from the response. For example, `[{"name": "fallthrough", "expression": ".responseBody | fromjson.environments.production.fallthrough"}]`.                                                                                                                                                                                                |

### Outputs

| Output         | Type    | Description                                                                                                                                                                                                                                                                           |
| -------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `success`      | Boolean | `true` when LaunchDarkly returns a 2xx status.                                                                                                                                                                                                                                        |
| `response`     | Object  | Present when `success` is `true`; `null` on error. Contains `statusCode` (Int) and `responseBody` (String). The body is the updated flag representation. For more information, see the [Update feature flag API](https://launchdarkly.com/docs/api/feature-flags/patch-feature-flag). |
| `errorMessage` | String  | Error detail if the call failed.                                                                                                                                                                                                                                                      |

### Example

```yaml
name: setTenPercentRollout
description: Ramp a flag to 10% in production using variation IDs from a prior step
steps:
  - name: updateRollout
    type: action
    action: launchDarkly.rollout.update
    version: '1'
    inputs:
      token: ${{ :secrets:launchDarklyApiToken }}
      projectKey: my-project
      env: production
      featureFlagName: new-checkout
      rolloutWeights: '${{ {(.steps.createFlag.outputs.trueVariationId): 10000, (.steps.createFlag.outputs.falseVariationId): 90000} }}'
      comment: 10% rollout from release workflow
    next: end
```

## Add context targets [#contexttarget-add]

**Action identifier:** `launchDarkly.contextTarget.add`

Adds context keys to the individual targets of a feature flag so they always receive a given variation, regardless of rollout percentage.

### Inputs

| Input             | Type   | Description                                                                                                                                                                            |
| ----------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `token`           | String | **Required.** LaunchDarkly access token. Must be passed as a secret.                                                                                                                   |
| `baseUrl`         | String | **Optional.** LaunchDarkly host. Defaults to `https://app.launchdarkly.com`.                                                                                                           |
| `projectKey`      | String | **Required.** The project key. For example, `my-project`.                                                                                                                              |
| `env`             | String | **Required.** The environment key. For example, `production`.                                                                                                                          |
| `featureFlagName` | String | **Required.** The feature flag key. For example, `new-checkout`.                                                                                                                       |
| `variationId`     | String | **Required.** The variation ID (the `_id` of an entry in the flag's `variations` list). For example, `d9a1fdf9-94d5-4679-a5cd-6b46ac143ed8`.                                           |
| `contextKeys`     | List   | **Required.** Context keys to add. For example, `["beta-user-1", "beta-user-2"]`.                                                                                                      |
| `contextKind`     | String | **Optional.** Context kind the keys belong to. Defaults to `user`.                                                                                                                     |
| `comment`         | String | **Optional.** Comment recorded in the flag audit log.                                                                                                                                  |
| `selectors`       | List   | **Optional.** JQ selectors to extract fields from the response. For example, `[{"name": "targets", "expression": ".responseBody | fromjson.environments.production.contextTargets"}]`. |

### Outputs

| Output         | Type    | Description                                                                                                                                                                                                                                                                           |
| -------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `success`      | Boolean | `true` when LaunchDarkly returns a 2xx status.                                                                                                                                                                                                                                        |
| `response`     | Object  | Present when `success` is `true`; `null` on error. Contains `statusCode` (Int) and `responseBody` (String). The body is the updated flag representation. For more information, see the [Update feature flag API](https://launchdarkly.com/docs/api/feature-flags/patch-feature-flag). |
| `errorMessage` | String  | Error detail if the call failed.                                                                                                                                                                                                                                                      |

### Example

```yaml
name: addBetaUsersToFlag
description: Add beta users to a feature flag's individual targets
steps:
  - name: addContextTargets
    type: action
    action: launchDarkly.contextTarget.add
    version: '1'
    inputs:
      token: ${{ :secrets:launchDarklyApiToken }}
      projectKey: my-project
      env: production
      featureFlagName: new-checkout
      variationId: ${{ .steps.createFlag.outputs.trueVariationId }}
      contextKeys:
        - beta-user-1
        - beta-user-2
    next: end
```

## Remove context targets [#contexttarget-remove]

**Action identifier:** `launchDarkly.contextTarget.remove`

Removes context keys from the individual targets of a feature flag.

### Inputs

| Input             | Type   | Description                                                                          |
| ----------------- | ------ | ------------------------------------------------------------------------------------ |
| `token`           | String | **Required.** LaunchDarkly access token. Must be passed as a secret.                 |
| `baseUrl`         | String | **Optional.** LaunchDarkly host. Defaults to `https://app.launchdarkly.com`.         |
| `projectKey`      | String | **Required.** The project key.                                                       |
| `env`             | String | **Required.** The environment key. For example, `production`.                        |
| `featureFlagName` | String | **Required.** The feature flag key.                                                  |
| `variationId`     | String | **Required.** The variation ID. For example, `d9a1fdf9-94d5-4679-a5cd-6b46ac143ed8`. |
| `contextKeys`     | List   | **Required.** Context keys to remove. For example, `["beta-user-1", "beta-user-2"]`. |
| `contextKind`     | String | **Optional.** Context kind the keys belong to. Defaults to `user`.                   |
| `comment`         | String | **Optional.** Comment recorded in the flag audit log.                                |
| `selectors`       | List   | **Optional.** JQ selectors to extract fields from the response.                      |

### Outputs

| Output         | Type    | Description                                                                                                                                                                                                                                                                           |
| -------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `success`      | Boolean | `true` when LaunchDarkly returns a 2xx status.                                                                                                                                                                                                                                        |
| `response`     | Object  | Present when `success` is `true`; `null` on error. Contains `statusCode` (Int) and `responseBody` (String). The body is the updated flag representation. For more information, see the [Update feature flag API](https://launchdarkly.com/docs/api/feature-flags/patch-feature-flag). |
| `errorMessage` | String  | Error detail if the call failed.                                                                                                                                                                                                                                                      |

### Example

```yaml
name: removeBetaUsersFromFlag
description: Remove beta users from a feature flag's individual targets
steps:
  - name: removeContextTargets
    type: action
    action: launchDarkly.contextTarget.remove
    version: '1'
    inputs:
      token: ${{ :secrets:launchDarklyApiToken }}
      projectKey: my-project
      env: production
      featureFlagName: new-checkout
      variationId: ${{ .steps.createFlag.outputs.trueVariationId }}
      contextKeys:
        - beta-user-1
        - beta-user-2
    next: end
```

## Schedule a context target expiry [#contexttargetexpiry-add]

**Action identifier:** `launchDarkly.contextTargetExpiry.add`

Schedules a context target to be automatically removed from a feature flag's individual targeting at a given time.

> #### ⚠️ CAUTION
>
> The response body identifies the context with either a `userKey` field or a `contextKey`/`contextKind` pair depending on your LaunchDarkly instance. Write selectors against the field your instance returns — do not assume one or the other.

### Inputs

| Input             | Type    | Description                                                                                                                                                   |
| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `token`           | String  | **Required.** LaunchDarkly access token. Must be passed as a secret.                                                                                          |
| `baseUrl`         | String  | **Optional.** LaunchDarkly host. Defaults to `https://app.launchdarkly.com`.                                                                                  |
| `projectKey`      | String  | **Required.** The project key.                                                                                                                                |
| `env`             | String  | **Required.** The environment key. For example, `production`.                                                                                                 |
| `featureFlagName` | String  | **Required.** The feature flag key.                                                                                                                           |
| `contextKey`      | String  | **Required.** The key of the context whose targeting expires. For example, `beta-user-1`.                                                                     |
| `contextKind`     | String  | **Optional.** The kind of context. Defaults to `user`.                                                                                                        |
| `variationId`     | String  | **Required.** The variation ID. For example, `d9a1fdf9-94d5-4679-a5cd-6b46ac143ed8`.                                                                          |
| `expirationDate`  | Integer | **Required.** Epoch time in milliseconds at which the target is removed. For example, `1792833814467`.                                                        |
| `comment`         | String  | **Optional.** Comment recorded in the flag audit log.                                                                                                         |
| `selectors`       | List    | **Optional.** JQ selectors to extract fields from the response. For example, `[{"name": "expiringTargets", "expression": ".responseBody | fromjson.items"}]`. |

### Outputs

| Output         | Type    | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| -------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `success`      | Boolean | `true` when LaunchDarkly returns a 2xx status.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `response`     | Object  | Present when `success` is `true`; `null` on error. Contains `statusCode` (Int) and `responseBody` (String). The body includes `items` (array of scheduled expiries), `totalInstructions`, `successfulInstructions`, and `failedInstructions`. Each item includes `_id`, `_version`, `expirationDate`, `variationId`, and a context identifier field (`userKey` or `contextKey` depending on your LaunchDarkly instance). For more information, see the [Update expiring context targets API](https://launchdarkly.com/docs/api/feature-flags/update-expiring-context-targets-on-feature-flag). |
| `errorMessage` | String  | Error detail if the call failed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |

### Example

```yaml
name: scheduleContextTargetExpiry
description: Schedule a beta user to be removed from flag targeting in 24 hours
steps:
  - name: addExpiry
    type: action
    action: launchDarkly.contextTargetExpiry.add
    version: '1'
    inputs:
      token: ${{ :secrets:launchDarklyApiToken }}
      projectKey: my-project
      env: production
      featureFlagName: new-checkout
      contextKey: beta-user-1
      variationId: ${{ .steps.createFlag.outputs.trueVariationId }}
      expirationDate: ${{ ((now * 1000) | floor) + 86400000 }}
      selectors:
        - name: expiringTargets
          expression: ".responseBody | fromjson.items"
    next: end
```

## Update a context target expiry [#contexttargetexpiry-update]

**Action identifier:** `launchDarkly.contextTargetExpiry.update`

Changes the time at which a scheduled context target is removed from a feature flag.

> #### ⚠️ CAUTION
>
> The response body identifies the context with either a `userKey` field or a `contextKey`/`contextKind` pair depending on your LaunchDarkly instance. Write selectors against the field your instance returns — do not assume one or the other.

### Inputs

| Input             | Type    | Description                                                                                                                                     |
| ----------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| `token`           | String  | **Required.** LaunchDarkly access token. Must be passed as a secret.                                                                            |
| `baseUrl`         | String  | **Optional.** LaunchDarkly host. Defaults to `https://app.launchdarkly.com`.                                                                    |
| `projectKey`      | String  | **Required.** The project key.                                                                                                                  |
| `env`             | String  | **Required.** The environment key. For example, `production`.                                                                                   |
| `featureFlagName` | String  | **Required.** The feature flag key.                                                                                                             |
| `contextKey`      | String  | **Required.** The key of the context whose targeting expires.                                                                                   |
| `contextKind`     | String  | **Optional.** The kind of context. Defaults to `user`.                                                                                          |
| `variationId`     | String  | **Required.** The variation ID.                                                                                                                 |
| `expirationDate`  | Integer | **Required.** New epoch time in milliseconds at which the target is removed.                                                                    |
| `version`         | Integer | **Optional.** Current `_version` of the expiring target entry. The update fails if the target has changed since this version. For example, `1`. |
| `comment`         | String  | **Optional.** Comment recorded in the flag audit log.                                                                                           |
| `selectors`       | List    | **Optional.** JQ selectors to extract fields from the response.                                                                                 |

### Outputs

| Output         | Type    | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| -------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `success`      | Boolean | `true` when LaunchDarkly returns a 2xx status.                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `response`     | Object  | Present when `success` is `true`; `null` on error. Contains `statusCode` (Int) and `responseBody` (String). The body includes `items`, `totalInstructions`, `successfulInstructions`, and `failedInstructions`. Each item in `items` includes `_version` (the new version after the update). For more information, see the [Update expiring context targets API](https://launchdarkly.com/docs/api/feature-flags/update-expiring-context-targets-on-feature-flag). |
| `errorMessage` | String  | Error detail if the call failed.                                                                                                                                                                                                                                                                                                                                                                                                                                   |

### Example

```yaml
name: extendContextTargetExpiry
description: Extend a scheduled context target expiry to 48 hours from now
steps:
  - name: updateExpiry
    type: action
    action: launchDarkly.contextTargetExpiry.update
    version: '1'
    inputs:
      token: ${{ :secrets:launchDarklyApiToken }}
      projectKey: my-project
      env: production
      featureFlagName: new-checkout
      contextKey: beta-user-1
      variationId: ${{ .steps.createFlag.outputs.trueVariationId }}
      expirationDate: ${{ ((now * 1000) | floor) + 172800000 }}
    next: end
```

## Remove a context target expiry [#contexttargetexpiry-remove]

**Action identifier:** `launchDarkly.contextTargetExpiry.remove`

Removes the scheduled expiry from a context target so it stays on the feature flag indefinitely.

> #### ⚠️ CAUTION
>
> The response body identifies the context with either a `userKey` field or a `contextKey`/`contextKind` pair depending on your LaunchDarkly instance. Write selectors against the field your instance returns — do not assume one or the other.

### Inputs

| Input             | Type   | Description                                                                  |
| ----------------- | ------ | ---------------------------------------------------------------------------- |
| `token`           | String | **Required.** LaunchDarkly access token. Must be passed as a secret.         |
| `baseUrl`         | String | **Optional.** LaunchDarkly host. Defaults to `https://app.launchdarkly.com`. |
| `projectKey`      | String | **Required.** The project key.                                               |
| `env`             | String | **Required.** The environment key.                                           |
| `featureFlagName` | String | **Required.** The feature flag key.                                          |
| `contextKey`      | String | **Required.** The key of the context whose expiry to remove.                 |
| `contextKind`     | String | **Optional.** The kind of context. Defaults to `user`.                       |
| `variationId`     | String | **Required.** The variation ID.                                              |
| `comment`         | String | **Optional.** Comment recorded in the flag audit log.                        |
| `selectors`       | List   | **Optional.** JQ selectors to extract fields from the response.              |

### Outputs

| Output         | Type    | Description                                                                                                                                                                                                                                                                                                                                                                                                               |
| -------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `success`      | Boolean | `true` when LaunchDarkly returns a 2xx status.                                                                                                                                                                                                                                                                                                                                                                            |
| `response`     | Object  | Present when `success` is `true`; `null` on error. Contains `statusCode` (Int) and `responseBody` (String). The body includes `items` (empty array on successful removal), `totalInstructions`, `successfulInstructions`, and `failedInstructions`. For more information, see the [Update expiring context targets API](https://launchdarkly.com/docs/api/feature-flags/update-expiring-context-targets-on-feature-flag). |
| `errorMessage` | String  | Error detail if the call failed.                                                                                                                                                                                                                                                                                                                                                                                          |

### Example

```yaml
name: cancelContextTargetExpiry
description: Cancel a scheduled context target expiry so the user stays targeted
steps:
  - name: removeExpiry
    type: action
    action: launchDarkly.contextTargetExpiry.remove
    version: '1'
    inputs:
      token: ${{ :secrets:launchDarklyApiToken }}
      projectKey: my-project
      env: production
      featureFlagName: new-checkout
      contextKey: beta-user-1
      variationId: ${{ .steps.createFlag.outputs.trueVariationId }}
    next: end
```
