# CreateDisks

## 1. API Description

This API (CreateDisks) is used to create one or more disks.

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

<mark style="color:blue;">This API is an async API. A disk</mark> <mark style="color:blue;">`ID`</mark> <mark style="color:blue;">list is returned after the creation request is sent. However, it does not mean the creation has been completed. You can use</mark> [<mark style="color:purple;">`DescribeDisks`</mark>](/api-reference/compute/zec/disk/describedisks.md) <mark style="color:blue;">to query the status of the disk. If disk has been queried with the</mark> <mark style="color:blue;">**AVAILABLE**</mark> <mark style="color:blue;">status, it means that the disk has been created successfully; if disk has been attached to a certain instance while creating, the</mark> <mark style="color:blue;">**IN\_USE**</mark> <mark style="color:blue;">status means attaching successfully.</mark>
{% endhint %}

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name   | Required | Type                                                                         | Description                                                                                                                                                                                                                                  |
| ---------------- | -------- | ---------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| zoneId           | Yes      | String                                                                       | ID of availability zone to which the disk belongs.                                                                                                                                                                                           |
| diskName         | Yes      | String                                                                       | <p>Disk name.</p><p>This parameter must start with a number or a letter, containing up to 64 characters.</p><p>Only letters, numbers, - and periods (.) are supported.</p>                                                                   |
| diskSize         | Yes      | Integer                                                                      | <p>Storage space.</p><p>Unit: GB.</p>                                                                                                                                                                                                        |
| diskAmount       | No       | Integer                                                                      | <p>Quantity of disks.</p><p>Value range: \[1, 50]</p><p>Default value: 1</p>                                                                                                                                                                 |
| instanceId       | No       | String                                                                       | <p>ID of instance to which the disks are attached.</p><p>Specify the ID of an instance in the current zone to which the disks are attached.</p>                                                                                              |
| resourceGroupId  | No       | String                                                                       | <p>Resource group ID.</p><p>If the value is null, the disk will be added into default resource group.</p>                                                                                                                                    |
| diskCategory     | No       | String                                                                       | <p>Disk type.</p><p>Basic NVMe SSD : the Basic NVMe SSD. Standard NVMe SSD : the Standard NVMe SSD.</p><p>Default value: Standard NVMe SSD .</p><p>Call DescribeDiskCategory to obtain disk type.</p><p>Default value: Standard NVMe SSD</p> |
| snapshotId       | No       | String                                                                       | <p>ID of the snapshot to create a disk.</p><p>If this parameter is specified, the disk will be created from the snapshot. The snapshot’s disk info must be of type disk.</p>                                                                 |
| marketingOptions | No       | [MarketingInfo](/api-reference/compute/zec/datastructure.md#marketinginfo)   | Information on marketing campaigns.                                                                                                                                                                                                          |
| tags             | No       | [TagAssociation](/api-reference/compute/zec/datastructure.md#tagassociation) | <p>Bound tags when creating resources.</p><p>Tag keys must be unique.</p>                                                                                                                                                                    |
| instanceIds      | No       | Array of String                                                              | <p>IDs of instances to be attached.</p><p>The number of IDs should be the same as diskAmount .</p>                                                                                                                                           |
| burstingEnabled  | No       | Boolean                                                                      | <p>Whether to enable burstable performance.</p><p>Default value: false</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> |
| diskIds        | Array of String | ID list of disks.                                                                                                     |
| orderNumber    | String          | Number of order.                                                                                                      |

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**Create one or more disks.**

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

Request:
{
  "diskName": "Test-Disk",
  "diskSize": 30,
  "diskAmount": 1,
  "zoneId": "HKG-A"
}

Response:
{
  "requestId": "T842EE571-4490-4AFE-9F17-931030D3B4F9",
  "response": {
    "requestId": "T842EE571-4490-4AFE-9F17-931030D3B4F9",
    "diskIds": [
      "862857204414550690"
    ],
    "orderNumber": "862857208122313378"
  }
}
```

{% endtab %}
{% endtabs %}

## 5. Developer Resources

Zenlayer Cloud API 2.0 integrates [SDKs](/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](/api-reference/api-introduction/instruction/commonerrorcode.md).

| HTTP Status Code | Error Code                                           | Description                                                                            |
| ---------------- | ---------------------------------------------------- | -------------------------------------------------------------------------------------- |
| 400              | INVALID\_DISK\_CATEGORY\_ZONE\_NO\_SELL              | Disk type not for sale in the zone.                                                    |
| 400              | INVALID\_DISK\_SIZE\_EXCEED\_MAXIMUM                 | Disk size exceeds the maximum limit.                                                   |
| 400              | INVALID\_DISK\_SIZE\_LESS\_MINIMUM                   | Disk size should be larger than the minimum limit.                                     |
| 404              | INVALID\_DISK\_SNAPSHOT\_NOT\_FOUND                  | Snapshot does not exist.                                                               |
| 400              | INVALID\_DISK\_SNAPSHOT\_SIZE\_MISMATCH              | The capacity of the created disk is smaller than the source disk size of the snapshot. |
| 404              | INVALID\_DISK\_SNAPSHOT\_ZONE\_MISMATCH              | The snapshot does not match the specified zone.                                        |
| 404              | INVALID\_INSTANCE\_NOT\_FOUND                        | Instance not found.                                                                    |
| 404              | INVALID\_INSTANCE\_OR\_ZONE\_CANNOT\_BE\_BOTH\_EMPTY | Specify at least one of the parameters: instance and zone.                             |
| 400              | INVALID\_ZONE\_MISMATCH                              | The zones mismatch.                                                                    |
| 404              | INVALID\_ZONE\_NOT\_FOUND                            | Region does not exist.                                                                 |
| 400              | LIMIT\_EXCEEDED\_INSTANCE\_CAN\_ATTACH               | Quantity of attached disks exceed available disk numbers of an instance.               |
| 400              | OPERATION\_DENIED\_DISK\_INSTANCE\_NOT\_ADAPTER      | The number of instances does not match the number of disks.                            |
| 400              | OPERATION\_DENIED\_DISK\_IO\_BURST                   | The disk bursting function is not enabled.                                             |
| 400              | OPERATION\_DENIED\_DISK\_SNAPSHOT\_STATUS            | The operation is not supported for current snapshot state.                             |
| 400              | OPERATION\_DENIED\_DISK\_SYSTEM\_TYPE                | The operation is not supported for system disks.                                       |
| 400              | UNSUPPORTED\_OPERATION\_INSTANCE\_STATUS             | Operations on instances in current state are not supported.                            |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.console.zenlayer.com/api-reference/compute/zec/disk/createdisks.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
