> 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/cn/compute/vm/disk/describedisks.md).

# DescribeDisks

## 1. 接口描述

本接口(DescribeDisks)用于查询云硬盘列表。

## 2. 请求参数

以下请求参数列表仅列出了接口中需要的请求参数

| 参数名称            | 必选 | 类型                                                                     | 描述                                                          |
| --------------- | -- | ---------------------------------------------------------------------- | ----------------------------------------------------------- |
| diskIds         | 否  | Array of String                                                        | 云硬盘ID集合。                                                    |
| diskName        | 否  | String                                                                 | 云硬盘名称。                                                      |
| diskStatus      | 否  | [DiskStatus](/api-reference/cn/compute/vm/datastructure.md#diskstatus) | 云硬盘状态。                                                      |
| diskType        | 否  | [DiskType](/api-reference/cn/compute/vm/datastructure.md#disktype)     | <p>云硬盘类型。</p><p>SYSTEM：系统盘。</p><p>DATA：数据盘。</p>             |
| diskCategory    | 否  | String                                                                 | <p>云硬盘种类。</p><p>STANDARD：标准云盘。</p><p>SSD：固态硬盘。</p>          |
| diskSize        | 否  | Integer                                                                | <p>云硬盘大小，单位GB。</p><p>可选值范围：\[20, 20000]</p>                 |
| portable        | 否  | Boolean                                                                | <p>是否可拔插。</p><p>false代表会随实例一起删除。</p><p>true代表不会随实例一起删除。</p> |
| instanceId      | 否  | String                                                                 | 实例ID。                                                       |
| zoneId          | 否  | String                                                                 | <p>可用区ID。</p><p>可从DescribeZones接口中获取。</p>                   |
| pageNum         | 否  | Integer                                                                | <p>返回的分页数。</p><p>默认为1。</p><p>默认值：1</p>                      |
| pageSize        | 否  | Integer                                                                | <p>返回的分页大小。</p><p>默认为20，最大为1000。</p>                        |
| resourceGroupId | 否  | String                                                                 | 资源组ID。                                                      |
| tagKeys         | 否  | Array of String                                                        | <p>根据标签键进行搜索。</p><p>最长不得超过20个标签键。</p>                       |
| tags            | 否  | Array of [Tag](/api-reference/cn/compute/vm/datastructure.md#tag)      | <p>根据标签进行搜索。</p><p>最长不得超过20个标签。</p>                         |

## 3. 响应结果

| 参数名称       | 类型                                                                          | 描述                                                       |
| ---------- | --------------------------------------------------------------------------- | -------------------------------------------------------- |
| requestId  | String                                                                      | <p>唯一请求 ID。</p><p>每次请求都会返回。定位问题时需要提供该次请求的 requestId。</p> |
| totalCount | Integer                                                                     | 符合条件的数据总数。                                               |
| dataSet    | Array of [DiskInfo](/api-reference/cn/compute/vm/datastructure.md#diskinfo) | 结果集。                                                     |

## 4. 代码示例

{% tabs %}
{% tab title="示例" %}
**1. 查询云硬盘列表。**

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

Request:
{
  "diskStatus": "AVAILABLE",
  "diskSize": 20,
  "portable": true,
  "zoneId": "SIN-E"
}

Response:
{
  "requestId": "T83B6A963-B111-4BF9-8466-1C3351E2DFD1",
  "response": {
    "requestId": "T83B6A963-B111-4BF9-8466-1C3351E2DFD1",
    "dataSet": [
      {
        "diskName": "default-SIN-20GB-01",
        "period": 1,
        "instanceName": "Test-Instanc",
        "chargeType": "PREPAID",
        "portable": true,
        "expiredTime": "2023-02-01T00:00:00Z",
        "diskSize": 20,
        "instanceId": "your-instance-id-1",
        "createTime": "2023-02-01T00:00:00Z",
        "zoneId": "SIN-E",
        "diskStatus": "AVAILABLE",
        "diskId": "disk-id-1",
        "diskType": "DATA",
        "diskCategory": "SSD",
        "autoRenew": true
      },
      {
        "diskName": "default-SIN-20GB-01",
        "period": 1,
        "instanceName": "Test-Instance",
        "chargeType": "PREPAID",
        "portable": true,
        "expiredTime": "2023-02-01T00:00:00Z",
        "diskSize": 20,
        "instanceId": "your-instance-id-1",
        "createTime": "2023-01-01T00:00:00Z",
        "zoneId": "SIN-E",
        "diskStatus": "AVAILABLE",
        "diskId": "disk-id-2",
        "diskType": "SYSTEM",
        "diskCategory": "SSD",
        "autoRenew": true
      }
    ],
    "totalCount": 2
  }
}
```

{% endtab %}
{% endtabs %}

## 5. 开发者工具

Zenlayer Cloud API 2.0 提供了配套的[开发工具集（SDK）](/api-reference/cn/api-introduction/toolkit.md)，未来会陆续支持更多开发语言，方便快速接入和使用Zenlayer的产品和服务。

## 6. 错误码

下面包含业务逻辑中遇到的错误码，其他错误码见[公共错误码](/api-reference/cn/api-introduction/instruction/commonerrorcode.md)

| HTTP状态码 | 错误码                       | 说明         |
| ------- | ------------------------- | ---------- |
| 404     | INVALID\_ZONE\_NOT\_FOUND | 指定的可用区不存在。 |
