# ResizeDisk

## 1. API Description

This API (ResizeDisk) is used to expand a cloud volume to a specified size.

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

* <mark style="color:blue;">This API only supports expanding cloud disks.</mark>
* <mark style="color:blue;">This API is an async API. After the call, you can use</mark> [<mark style="color:purple;">`DescribeDisks`</mark>](https://docs.console.zenlayer.com/api-reference/compute/zec/disk/describedisks) <mark style="color:blue;">to query the status of the disk. If disk has been queried with the</mark> <mark style="color:blue;">`CHANGING`</mark> <mark style="color:blue;">status, it means that the disk is being expanding.</mark>
  {% endhint %}

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name | Required | Type    | Description                                                                                                                                                                           |
| -------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| diskId         | Yes      | String  | <p>Disk ID.</p><p>Call DescribeDisks to get the disk ID.</p>                                                                                                                          |
| diskSize       | Yes      | Integer | <p>New disk size after expansion.</p><p>Unit: GB .</p><p>Must be greater than the current size Maximum limit: 32,768 GB (32 TB). Valid range: \[1, ∞).</p><p>Value range: \[1, +)</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" %}
**Expand a cloud volume to 100 GB.**

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

Request：
{
    "diskId": "<Disk ID>",
    "diskSize": 100
}

Response：
{
  "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
  "response": {
    "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3"
  }
}
```

{% endtab %}
{% endtabs %}

## 5. Developer Resources

Zenlayer Cloud API 2.0 integrates [SDKs](https://docs.console.zenlayer.com/api-reference/api-introduction/toolkit/api-sdk)，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).

| HTTP Status Code | Error Code                                        | Description                                                   |
| ---------------- | ------------------------------------------------- | ------------------------------------------------------------- |
| 400              | INVALID\_DISK\_SIZE\_MAX\_EXCEED                  | Disk size exceeds the maximum limit.                          |
| 404              | INVALID\_DISK\_NOT\_FOUND                         | Disk does not exist.                                          |
| 400              | INVALID\_DISK\_SIZE\_PARAM\_ERROR                 | Invalid disk size. It must be greater than the current size.  |
| 400              | OPERATION\_DENIED\_INSTANCE\_STATUS\_NOT\_SUPPORT | Current instance state does not allow this operation.         |
| 400              | OPERATION\_DENIED\_DISK\_STATUS                   | Operations on the disk with current status are not supported. |
