Skip to main content
POST
/
api
/
v2
/
flags
/
{projectKey}
/
{featureFlagKey}
/
copy
Copy feature flag
curl --request POST \
  --url https://app.launchdarkly.com/api/v2/flags/{projectKey}/{featureFlagKey}/copy \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "comment": "optional comment",
  "source": {
    "currentVersion": 1,
    "key": "source-env-key-123abc"
  },
  "target": {
    "currentVersion": 1,
    "key": "target-env-key-123abc"
  }
}
'
{
  "name": "My Flag",
  "kind": "boolean",
  "key": "flag-key-123abc",
  "_version": 1,
  "creationDate": "1494437420312",
  "variations": [
    {
      "_id": "e432f62b-55f6-49dd-a02f-eb24acf39d05",
      "value": true
    },
    {
      "_id": "a00bf58d-d252-476c-b915-15a74becacb4",
      "value": false
    }
  ],
  "temporary": true,
  "tags": [
    "example-tag"
  ],
  "_links": {
    "parent": {
      "href": "/api/v2/flags/my-project",
      "type": "application/json"
    },
    "self": {
      "href": "/api/v2/flags/my-project/my-flag",
      "type": "application/json"
    }
  },
  "experiments": "{\"baselineIdx\": 0,\"items\": []}",
  "customProperties": "{\"jira.issues\":{\"name\":\"Jira issues\",\"value\":[\"is-123\",\"is-456\"]}}",
  "archived": false,
  "description": "This flag controls the example widgets",
  "includeInSnippet": true,
  "clientSideAvailability": "{\"usingMobileKey\":true,\"usingEnvironmentId\":false}",
  "maintainerId": "569f183514f4432160000007",
  "_maintainer": {
    "_links": {
      "self": {
        "href": "/api/v2/members/569f183514f4432160000007",
        "type": "application/json"
      }
    },
    "_id": "569f183514f4432160000007",
    "role": "admin",
    "email": "ariel@acme.com",
    "firstName": "Ariel",
    "lastName": "Flores"
  },
  "maintainerTeamKey": "team-1",
  "_maintainerTeam": {
    "key": "team-key-123abc",
    "name": "Example team",
    "_links": {
      "parent": {
        "href": "/api/v2/teams",
        "type": "application/json"
      },
      "roles": {
        "href": "/api/v2/teams/example-team/roles",
        "type": "application/json"
      },
      "self": {
        "href": "/api/v2/teams/example-team",
        "type": "application/json"
      }
    }
  },
  "goalIds": [],
  "archivedDate": "1494437420312",
  "deprecated": false,
  "deprecatedDate": "1494437420312",
  "defaults": "{\"onVariation\":0,\"offVariation\":1}",
  "_purpose": "<string>",
  "migrationSettings": {
    "contextKind": "device",
    "stageCount": 6
  },
  "environments": {
    "my-environment": {
      "_environmentName": "My Environment",
      "_site": {
        "href": "/default/my-environment/features/client-side-flag",
        "type": "text/html"
      },
      "_summary": {
        "prerequisites": 0,
        "variations": {
          "0": {
            "contextTargets": 1,
            "isFallthrough": true,
            "nullRules": 0,
            "rules": 0,
            "targets": 1
          },
          "1": {
            "isOff": true,
            "nullRules": 0,
            "rules": 0,
            "targets": 0
          }
        }
      },
      "archived": false,
      "contextTargets": [
        {
          "contextKind": "device",
          "values": [
            "device-key-123abc"
          ],
          "variation": 0
        }
      ],
      "fallthrough": {
        "variation": 0
      },
      "lastModified": 1627071171347,
      "offVariation": 1,
      "on": false,
      "prerequisites": [],
      "rules": [],
      "salt": "61eddeadbeef4da1facecafe3a60a397",
      "sel": "810edeadbeef4844facecafe438f2999492",
      "targets": [
        {
          "contextKind": "user",
          "values": [
            "user-key-123abc"
          ],
          "variation": 0
        }
      ],
      "trackEvents": false,
      "trackEventsFallthrough": false,
      "version": 1
    }
  }
}

Documentation Index

Fetch the complete documentation index at: https://launchdarkly-preview.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

Path Parameters

projectKey
string<string>
required

The project key

featureFlagKey
string<string>
required

The feature flag key. The key identifies the flag in your code.

Body

application/json
source
object
required

The source environment

Example:

"{\"key\": \"source-env-key-123abc\", \"currentVersion\": 1}"

target
object
required

The target environment

Example:

"{\"key\": \"target-env-key-123abc\", \"currentVersion\": 1}"

comment
string

Optional comment

includedActions
enum<string>[]

Optional list of the flag changes to copy from the source environment to the target environment. You may include either includedActions or excludedActions, but not both. If you include neither, then all flag changes will be copied.

Available options:
updateOn,
updateRules,
updateFallthrough,
updateOffVariation,
updatePrerequisites,
updateTargets,
updateFlagConfigMigrationSettings
Example:
["updateOn"]
excludedActions
enum<string>[]

Optional list of the flag changes NOT to copy from the source environment to the target environment. You may include either includedActions or excludedActions, but not both. If you include neither, then all flag changes will be copied.

Available options:
updateOn,
updateRules,
updateFallthrough,
updateOffVariation,
updatePrerequisites,
updateTargets,
updateFlagConfigMigrationSettings
Example:
["updateOn"]

Response

Global flag response

name
string
required

A human-friendly name for the feature flag

Example:

"My Flag"

kind
enum<string>
required

Kind of feature flag

Available options:
boolean,
multivariate
Example:

"boolean"

key
string
required

A unique key used to reference the flag in your code

Example:

"flag-key-123abc"

_version
integer
required

Version of the feature flag

Example:

1

creationDate
integer<int64>
required

Timestamp of flag creation date

Example:

"1494437420312"

variations
object[]
required

An array of possible variations for the flag

Example:
[
{
"_id": "e432f62b-55f6-49dd-a02f-eb24acf39d05",
"value": true
},
{
"_id": "a00bf58d-d252-476c-b915-15a74becacb4",
"value": false
}
]
temporary
boolean
required

Whether the flag is a temporary flag

Example:

true

tags
string[]
required

Tags for the feature flag

Example:
["example-tag"]

The location and content type of related resources

Example:
{
"parent": {
"href": "/api/v2/flags/my-project",
"type": "application/json"
},
"self": {
"href": "/api/v2/flags/my-project/my-flag",
"type": "application/json"
}
}
experiments
object
required

Experimentation data for the feature flag

Example:

"{\"baselineIdx\": 0,\"items\": []}"

customProperties
object
required

Metadata attached to the feature flag, in the form of the property key associated with a name and array of values for the metadata to associate with this flag. Typically used to store data related to an integration.

Example:

"{\"jira.issues\":{\"name\":\"Jira issues\",\"value\":[\"is-123\",\"is-456\"]}}"

archived
boolean
required

Boolean indicating if the feature flag is archived

Example:

false

description
string

Description of the feature flag

Example:

"This flag controls the example widgets"

includeInSnippet
boolean
deprecated

Deprecated, use clientSideAvailability. Whether this flag should be made available to the client-side JavaScript SDK

Example:

true

clientSideAvailability
object

Which type of client-side SDKs the feature flag is available to

Example:

"{\"usingMobileKey\":true,\"usingEnvironmentId\":false}"

maintainerId
string

Associated maintainerId for the feature flag

Example:

"569f183514f4432160000007"

_maintainer
object

Associated maintainer member info for the feature flag

maintainerTeamKey
string

The key of the associated team that maintains this feature flag

Example:

"team-1"

_maintainerTeam
object

Associated maintainer team info for the feature flag

goalIds
string[]
deprecated

Deprecated, use experiments instead

Example:
[]
archivedDate
integer<int64>

If archived is true, date of archive

Example:

"1494437420312"

deprecated
boolean

Boolean indicating if the feature flag is deprecated

Example:

false

deprecatedDate
integer<int64>

If deprecated is true, date of deprecation

Example:

"1494437420312"

defaults
object

The indices, from the array of variations, for the variations to serve by default when targeting is on and when targeting is off. These variations will be used for this flag in new environments. If omitted, the first and last variation will be used.

Example:

"{\"onVariation\":0,\"offVariation\":1}"

_purpose
string
migrationSettings
object

Migration-related settings for the flag

environments
object

Details on the environments for this flag. Only returned if the request is filtered by environment, using the filterEnv query parameter.

Example:
{
"my-environment": {
"_environmentName": "My Environment",
"_site": {
"href": "/default/my-environment/features/client-side-flag",
"type": "text/html"
},
"_summary": {
"prerequisites": 0,
"variations": {
"0": {
"contextTargets": 1,
"isFallthrough": true,
"nullRules": 0,
"rules": 0,
"targets": 1
},
"1": {
"isOff": true,
"nullRules": 0,
"rules": 0,
"targets": 0
}
}
},
"archived": false,
"contextTargets": [
{
"contextKind": "device",
"values": ["device-key-123abc"],
"variation": 0
}
],
"fallthrough": { "variation": 0 },
"lastModified": 1627071171347,
"offVariation": 1,
"on": false,
"prerequisites": [],
"rules": [],
"salt": "61eddeadbeef4da1facecafe3a60a397",
"sel": "810edeadbeef4844facecafe438f2999492",
"targets": [
{
"contextKind": "user",
"values": ["user-key-123abc"],
"variation": 0
}
],
"trackEvents": false,
"trackEventsFallthrough": false,
"version": 1
}
}