> 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/disk/detachdisks.md).

# DetachDisks

## 1. API Description

This API (DetachDisks) is used to detach one or more disks from an instance.

{% hint style="info" %}
**Notes**

* Up to 10 disks can be detached in a single request.
* If a disk is already in the detached status, it is regarded as having reached the target status and is skipped directly.
* If a disk does not meet the detachment conditions (the disk type is not `DATA`, it is not pluggable, its status is not `IN_USE`, or the instance it is attached to is not shut down when `instanceCheckFlag` is `true`, and so on), only this disk fails to be detached and its ID appears in the `failedDiskIds` in the response, which does not affect the normal detachment of the other disks.
* Disk IDs that do not exist in the request are silently ignored, which neither causes the request to fail nor appears in `failedDiskIds`.
  {% endhint %}

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name    | Required | Type            | Description                                                                                                                                                                                                                                                           |
| ----------------- | -------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| diskIds           | Yes      | Array of String | <p>ID list of the disks to be detached.</p><p>It can be obtained by calling <a href="/api-reference/zec/disk/describedisks.md">DescribeDisks</a>.</p>                                                                                                                 |
| instanceCheckFlag | No       | Boolean         | <p>Whether to check the running status of the instance.</p><p>When it is enabled, the instance that the disk is attached to must be shut down before the disk can be detached. When it is disabled, the instance status is not checked.</p><p>Default value: true</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> |
| failedDiskIds  | Array of String | Disks failed to be detached.                                                                                          |

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**Detach one or more disks from an instance.**

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

Request:
{
  "diskIds": [
    "your-disk-id"
  ]
}

Response:
{
  "requestId": "T86A56634-582A-4615-BBE2-ABFE192EE7CE",
  "response": {
    "requestId": "T86A56634-582A-4615-BBE2-ABFE192EE7CE",
    "failedDiskIds": []
  }
}
```

{% 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 |
| ---------------- | ---------- | ----------- |
