Updated on 2025-07-25 GMT+08:00

Batch Changing Instance Passwords

Function

This API is used to change the passwords of the management account (user root or Administrator) for logging in to different servers.

Prerequisites: The instances are in the running state.

This API is synchronous. The passwords can be all changed or all fail to be changed.

Constraints:

There is no password complexity check that meets security requirements. No error message is displayed after an insecure password is entered.

The new password will be in effective after a server is started or restarted (by calling the ChangeServerPowerState API).

Calling Method

For details, see Calling APIs.

URI

PUT /v1/{project_id}/instances/password

Table 1 URI parameter

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

The project ID.

Constraints

N/A

Range

The project ID of the account

Default Value

N/A

Request Parameters

Table 2 Request header parameter

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

Requests for calling an API can be authenticated using a token. If token-based authentication is used, this parameter is mandatory and must be set to a user token.

Constraints

N/A

Range

N/A

Default Value

N/A

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

new_password

Yes

String

Definition

Default login password for the instance administrator. For Linux, the administrator is root. For Windows, the administrator is Administrator.

Constraints

N/A

Range

The value can contain 8 to 26 characters.

The password must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters (!@$%^-_=+[{}]:,./?).

The password cannot contain the username or the username spelled backwards.

Default Value

N/A

instance_id_set

No

Array of strings

Definition

The list of instance IDs.

Constraints

An instance ID list cannot contain more than 50 IDs.

Response Parameters

Status code: 200

Table 4 Response body parameter

Parameter

Type

Description

instances

Array of instances objects

Definition

Returned instance information.

Constraints

N/A

Table 5 instances

Parameter

Type

Description

id

String

Definition

Instance ID.

Constraints

N/A

Range

N/A

Default Value

N/A

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Definition

Error code.

Constraints

N/A

Range

N/A

Default Value

N/A

error_msg

String

Definition

Error message.

Constraints

N/A

Range

N/A

Default Value

N/A

Status code: 401

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Definition

Error code.

Constraints

N/A

Range

N/A

Default Value

N/A

error_msg

String

Definition

Error message.

Constraints

N/A

Range

N/A

Default Value

N/A

Status code: 429

Table 8 Response body parameter

Parameter

Type

Description

-

String

-

Status code: 500

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Definition

Error code.

Constraints

N/A

Range

N/A

Default Value

N/A

error_msg

String

Definition

Error message.

Constraints

N/A

Range

N/A

Default Value

N/A

Example Requests

Request for batch changing instance passwords

GET https://{endpoint}/v1/{project_id}/instances/password

Example Responses

Status code: 200

Password changed.

{
  "instances" : [ {
    "id" : "0197f36d-d83b-7258-b177-3784b7887a17"
  } ]
}

Status Codes

Status Code

Description

200

Password changed.

400

Invalid request parameter.

401

The request is not authenticated.

429

The request is overloaded.

500

Internal server error.

Error Codes

For details, see Error Codes.