> For the complete documentation index, see [llms.txt](https://docs.console.zenlayer.com/api-reference/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.console.zenlayer.com/api-reference/zec/instance/resetinstancepassword.md). Agents can also search and read this documentation through its [MCP server](https://docs.console.zenlayer.com/api-reference/~gitbook/mcp).

# ResetInstancePassword

## 1. API Description

This API (ResetInstancePassword) is used to reset the instance login password.

{% hint style="info" %} <mark style="color:blue;">**Note**</mark>

* <mark style="color:blue;">For Windows systems, the default reset applies to the Administrator password; for Linux systems, it applies to the root password.</mark>
* <mark style="color:blue;">The instance must have QGA installed and be in a powered-on state.</mark>
* <mark style="color:blue;">The operation may fail; refer to the API response for details.</mark>
* <mark style="color:blue;">Batch operations are supported. The maximum number of instances in each request is 100.</mark>
  {% endhint %}

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name | Required | Type   | Description                                                                                                                                                                                                                        |
| -------------- | -------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| instanceId     | Yes      | String | <p>ID of the instance to be operated on.</p><p>It can be obtained by calling <a href="https://docs.console.zenlayer.com/api-reference/zec/instance/describeinstances.md">DescribeInstances</a>.</p>                                |
| password       | Yes      | String | <p>Password.</p><p>It must be 8 to 16 characters long.</p><p>It must contain all of the following three types of characters: uppercase and lowercase letters (a-z, A-Z), digits (0-9), and special characters (\~!@$^\*-\_=+).</p> |

## 3. Output Parameters

| Parameter Name | Type   | Description                                                                                                           |
| -------------- | ------ | --------------------------------------------------------------------------------------------------------------------- |
| requestId      | String | <p>The unique request ID, which is returned for each request.</p><p>RequestId is required for locating a problem.</p> |

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**Reset the instance login password.**

```json
POST /api/v2/zec HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: ResetInstancesPassword
<Common Request Params>

Request:
{
  "instanceId": "instanceId",
  "password": "Example`123"
}

Response:
{
  "requestId": "TEEFDCA5B-76FB-4E91-A18E-DF7F5D2CE41F",
}
```

{% endtab %}
{% endtabs %}

## 5. Developer Resources

Zenlayer Cloud API 2.0 integrates [SDKs](https://docs.console.zenlayer.com/api-reference/api-introduction/toolkit/api-sdk.md)，to make it easier for you to call APIs. More programming languages will be supported.

## 6. Error Codes

The following only lists the error codes related to the API business logic. For other error codes, see [Common Error Codes](https://docs.console.zenlayer.com/api-reference/api-introduction/instruction/commonerrorcode.md).

| HTTP Status Code | Error Code                                                      | Description                                                                        |
| ---------------- | --------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| 400              | INVALID\_PASSWORD\_MALFORMED                                    | Password format error.                                                             |
| 400              | OPERATION\_DENIED\_INSTANCE\_IN\_OPERATION                      | Instance is performing another operation.                                          |
| 400              | OPERATION\_DENIED\_INSTANCE\_STATUS\_NOT\_SUPPORT               | Current instance state does not allow this operation.                              |
| 400              | OPERATION\_DENIED\_INSTANCE\_RESET\_PASSWORD\_NOT\_RUNNING      | Password reset precheck: the instance is not running.                              |
| 400              | OPERATION\_DENIED\_INSTANCE\_RESET\_PASSWORD\_QGA\_NOT\_RUNNING | Password reset precheck: QGA is not running in the instance.                       |
| 400              | OPERATION\_DENIED\_INSTANCE\_RESET\_PASSWORD\_QGA\_VERSION\_LOW | Password reset precheck: the QGA version in the instance is too low.               |
| 400              | OPERATION\_DENIED\_INSTANCE\_RESET\_PASSWORD\_QGA\_NO\_PERMIT   | Password reset precheck: QGA in the instance does not have sufficient permissions. |
| 400              | OPERATION\_FAILED\_INSTANCE\_RESET\_PASSWORD\_PRECHECK          | Password reset precheck: the underlying query failed.                              |
| 400              | OPERATION\_FAILED\_INSTANCE\_MODIFY\_PASSWORD                   | Failed to modify the instance password.                                            |
