secrets.environments.promote-many

Promote many secrets into one environment; `dryRun` returns the plan first

POST /secrets/api/environments/promoteIAM secrets:PromoteSecretChanges stateDestructive

Each item gets a `plan`: create, update, unchanged, not-compared (no secrets:CompareSecretValues), needs-reference (synced: confirm `suggestedReference` and send it as the item’s `reference`) or blocked (`error`). Run the dry run, then the same items without `dryRun`. Per item, not atomic.

Depending on the resource, the call checks secrets:CreateSecret, secrets:RotateSecret, secrets:UseSecretSource, secrets:CompareSecretValues instead; hold all of them to be sure it is allowed.

Request syntax

POST /secrets/api/environments/promote
{
  "toEnvironmentId": "string",
  "items": "array of json",
  "dryRun": "boolean"
}

Request body

  • toEnvironmentIdRequired

    string

    The environment every item is promoted into, or null for Default. An item already in it is blocked; an unknown id blocks every item with 404.

    May be null.

  • itemsRequired

    array of json

    The secrets to promote, 1 to 500, each { secretId, reference? }. Promoted one at a time in this order; each is authorized and answered on its own.

  • dryRunOptional

    boolean

    true: answer with each item’s plan and write nothing (only value comparisons are made, each audited). Omitted or false: promote.

Response

200 with { dryRun, results, create, update, unchanged, notCompared, needsReference, blocked }: one result per item (secretId, name, plan, done, targetSecretId, created, changed, reference, suggestedReference, error) and how many items have each plan. Always 200: refusals are per item.

A JSON response is wrapped as { "success": true, "data": … }; the CLI prints the whole body with --json.

Errors

  • 400The request does not pass the schema above. The body is { "error": …, "issues": […] }, one issue per field.
  • 401No credentials, or an access key that is unknown, revoked or expired.
  • 403The caller's policies do not allow secrets:PromoteSecret on this resource. The body names the action and the resource, and the refusal is recorded in the audit log.
  • 404The resource does not exist in your organization.

Examples

The required parameters only, with example values. Replace id and the other placeholders with your own.

dcloud secrets environments promote-many --to-environment-id example --items '["example"]'

Generated from the API description, the same one the API checks requests against and the CLI is built from. MCP tool: dcloud_secrets_environments_promote-many.