Feature flags

Copy feature flag

POST
/api/v2/flags/{projectKey}/{featureFlagKey}/copy

Copying flag settings is an Enterprise feature

Copying flag settings is available to customers on an Enterprise plan. To learn more, read about our pricing. To upgrade your plan, contact Sales.

Copy flag settings from a source environment to a target environment.

By default, this operation copies the entire flag configuration. You can use the includedActions or excludedActions to specify that only part of the flag configuration is copied.

If you provide the optional currentVersion of a flag, this operation tests to ensure that the current flag version in the environment matches the version you've specified. The operation rejects attempts to copy flag settings if the environment's current version of the flag does not match the version you've specified. You can use this to enforce optimistic locking on copy attempts.

Authorization

ApiKey read, write
Authorization<token>

In: header

Scope: read, write

Path Parameters

projectKey*string

The project key

Formatstring
featureFlagKey*string

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

Formatstring

Request Body

application/json

source*

The source environment

target*

The source environment

comment?string

Optional comment

includedActions?array<>

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.

excludedActions?array<>

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.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/api/v2/flags/string/string/copy" \  -H "Content-Type: application/json" \  -d '{    "comment": "optional comment",    "source": {      "currentVersion": 1,      "key": "source-env-key-123abc"    },    "target": {      "currentVersion": 1,      "key": "target-env-key-123abc"    }  }'
{  "name": "My Flag",  "kind": "boolean",  "description": "This flag controls the example widgets",  "key": "flag-key-123abc",  "_version": 1,  "creationDate": "1494437420312",  "includeInSnippet": true,  "clientSideAvailability": "{\"usingMobileKey\":true,\"usingEnvironmentId\":false}",  "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"    }  },  "maintainerId": "569f183514f4432160000007",  "_maintainer": {    "_links": {      "self": {        "href": "/api/v2/members/569f183514f4432160000007",        "type": "application/json"      }    },    "_id": "569f183514f4432160000007",    "firstName": "Ariel",    "lastName": "Flores",    "role": "admin",    "email": "ariel@acme.com"  },  "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": [],  "experiments": "{\"baselineIdx\": 0,\"items\": []}",  "customProperties": "{\"jira.issues\":{\"name\":\"Jira issues\",\"value\":[\"is-123\",\"is-456\"]}}",  "archived": false,  "archivedDate": "1494437420312",  "deprecated": false,  "deprecatedDate": "1494437420312",  "defaults": "{\"onVariation\":0,\"offVariation\":1}",  "_purpose": "string",  "migrationSettings": {    "contextKind": "device",    "stageCount": 6  },  "stale": {    "readyForCodeRemoval": true,    "readyToArchive": true,    "cleanupId": "string"  },  "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    }  }}