Updated on 2026-09-21 GMT+08:00

Copying a Key to a Specified Region

Function

Copy the key in the current region to the target region.

Calling Method

For details, see Calling APIs.

URI

POST /v2/{project_id}/kms/keys/{key_id}/replicate

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID. For details, see Obtaining a Project ID.

Constraints

N/A

Range

The value returned by the IAM API is used, which contains 32 characters.

Default Value

N/A

key_id

Yes

String

Definition

ID of the key to be copied

Constraints

  • The value must be a 36-byte ID.

  • The value must match the regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$.

Range

N/A

Default Value

N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

User token. It can be obtained by calling the IAM API. The value of X-Subject-Token in the response header is the user token.

Constraints

N/A

Range

Obtain the value by calling the IAM API for obtaining the user token.

Default Value

N/A

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

key_id

Yes

String

Definition

Key ID

Constraints

  • The value must be a 36-byte ID.

  • The value must match the regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$.

Range

N/A

Default Value

N/A

replica_region

Yes

String

Definition

Code of the new primary region to which the key belongs, for example, cn-north-4

Constraints

N/A

Range

N/A

Default Value

N/A

key_alias

Yes

String

Definition

Alias of the copied new key

Constraints

N/A

Range

N/A

Default Value

N/A

key_description

No

String

Definition

Description of the copied new key

Constraints

N/A

Range

N/A

Default Value

N/A

enterprise_project_id

No

String

Definition

Enterprise multi-project ID of the copied new key

Constraints

  • If enterprise multi-project is not enabled, you do not need to set this parameter.

  • If enterprise multi-project is enabled, you can set this field when creating resources. If this field is not specified, the default enterprise multi-project whose ID is 0 is created by default.

If you do not have the permission to create resources under the default enterprise multi-project (ID: 0), an error will be reported.

Range

N/A

Default Value

N/A

replica_project_id

Yes

String

Definition

Project ID of the copied new key

Constraints

N/A

Range

N/A

Default Value

N/A

tags

No

Array of TagItem objects

Definition

Tag list, which is the value pairs of tag keys and values.

Constraints

N/A

Range

N/A

Default Value

N/A

Table 4 TagItem

Parameter

Mandatory

Type

Description

key

Yes

String

Definition

Tag key

Constraints

  • The value can contain up to 36 Unicode characters.

  • The value cannot contain ASCII characters (0–31), asterisks (*), angle brackets (< and >), backslashes (), or equal signs (=).

  • The value cannot be empty.

Range

N/A

Default Value

N/A

value

No

String

Definition

Tag value

Constraints

  • The value can contain up to 43 Unicode characters.

  • The value cannot contain ASCII characters (0–31), asterisks (*), angle brackets (< and >), backslashes (), or equal signs (=).

  • The value cannot be empty.

Range

N/A

Default Value

N/A

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

key_id

String

Definition

Key ID

^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$.

Range

N/A

domain_id

String

User domain ID

region

String

Definition

Code of the new primary region to which the key belongs, for example, cn-north-4

Range

N/A

Example Requests

{
  "key_id" : "826314dd-1b5b-4037-b976-5f9b7a17df46",
  "replica_region" : "cn-north-4",
  "key_alias" : "replica_key_alias",
  "replica_project_id" : "2b31ed520xxxxxxebedb6e57xxxxxxxx"
}

Example Responses

Status code: 200

Request succeeded.

{
  "key_id" : "8e85c00f-f7d0-47c9-ac96-548f977d16ba",
  "domain_id" : "3bab8e245e854f68af5967c00dd43127",
  "region" : "cn-north-4"
}

Status Codes

Status Code

Description

200

Request succeeded.

Error Codes

See Error Codes.