/v1/workspaces/{workspace_id}/configs/{config_id}/environments/{environment_id}/copyAuthCopy targeting between environments
Copies value and targeting (rules, splits, split attribute) of `setting_ids`, or of every setting that differs (`all_differing: true`), from `source_environment_id` into this environment. All or nothing: send the target `version` of every setting that will be copied in `versions`; if any moved, nothing is written and 409 lists them. Publishes one config revision, with one history entry per setting. Needs `flags.value.update` on this environment and each setting, plus `flags.protected.update` when it is protected.
Path parameters
config_id*string · uuidId of the config.
environment_id*string · uuidId of the target environment (same project as the config).
workspace_id*string · uuidId of the workspace.
Headers
Idempotency-KeystringIdempotency key (1-256 characters, `[A-Za-z0-9._:-]`). A retry with the same key and body returns the first response for 24 h.
Request body
source_environment_id*string · uuidThe environment to copy targeting from (same project).
setting_idsarrayThe settings to copy (at most 500). Send this or `all_differing: true`.
all_differingbooleanCopy every setting whose value or targeting differs between the two environments. Send this or `setting_ids`.
Example: true
versions*objectThe target environment's current `version` of every setting that will be copied, by setting id. If any is stale or missing, nothing is written and 409 `VERSION_CONFLICT` lists every one (`details.conflicts`).
Example: {"0b8f8a2c-4d3e-4f5a-8b6c-7d8e9f0a1b2c":3}
notestringA change note (at most 500 characters), saved on the new history entry. Environments with `require_note` refuse value writes without one.
Example: "Roll back FLAG-142"
Response · 200 What was copied.
data*arrayThe settings whose targeting was copied (empty when nothing differed).
revision*integerThe config revision the copy published in the target environment (null when nothing changed).
Example: 12
Example
Request
POST https://api.flags.productcraft.co/v1/workspaces/{workspace_id}/configs/{config_id}/environments/{environment_id}/copy
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
{
"source_environment_id": "00000000-0000-0000-0000-000000000000",
"setting_ids": [
"00000000-0000-0000-0000-000000000000"
],
"all_differing": true,
"versions": {
"0b8f8a2c-4d3e-4f5a-8b6c-7d8e9f0a1b2c": 3
},
"note": "Roll back FLAG-142"
}Response
{
"data": [
{
"setting_id": "00000000-0000-0000-0000-000000000000",
"key": "new_checkout",
"version": 4,
"change_id": "00000000-0000-0000-0000-000000000000"
}
],
"revision": 12
}