> 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/bmc/vpc/subnet/unassociatesubnetinstance.md).

# UnAssociateSubnetInstance

## 1. API Description

This API (UnAssociateSubnetInstance) is used to remove an instance from a subnet.

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

* <mark style="color:blue;">This API is an async API. A request ID is returned after the request is sent. However, it does not mean the unbinding has been completed. You can use</mark> [<mark style="color:purple;">`DescribeSubnets`</mark>](/api-reference/bmc/vpc/subnet/describesubnets.md) <mark style="color:blue;">to query the status.</mark>
  * <mark style="color:blue;">If</mark> <mark style="color:blue;">`privateIpStatus`</mark> <mark style="color:blue;">is</mark> <mark style="color:blue;">`UNBINDING`</mark><mark style="color:blue;">, it means that the instance is being unbound.</mark>
  * <mark style="color:blue;">If no such instance in the subnet, it means that the instance has been unbound.</mark>
* <mark style="color:blue;">Operations on the instance with a</mark> <mark style="color:blue;">`BINDED`</mark> <mark style="color:blue;">`privateIpStatus`</mark> <mark style="color:blue;">are supported.</mark>
* <mark style="color:blue;">No action will be made against</mark> <mark style="color:blue;">the instance not in the subnet.</mark>
  {% endhint %}

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name | Required | Type   | Description  |
| -------------- | -------- | ------ | ------------ |
| subnetId       | Yes      | String | Subnet ID.   |
| instanceId     | Yes      | String | Instance ID. |

## 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" %}
Remove an instance from the subnet.

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

Request:
{
  "subnetId": "833049815985166808",
  "instanceId": "820653960707704280"
}

Response:
{
  "requestId": "T5B77142F-C218-4AD1-89A4-70082816CA6B",
  "response": {
    "requestId": "T5B77142F-C218-4AD1-89A4-70082816CA6B"
  }
}
```

{% 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                |
| ---------------- | ------------------------------------------------ | -------------------------- |
| 404              | INVALID\_SUBNET\_NOT\_FOUND                      | Subnet not found.          |
| 403              | OPERATION\_DENIED\_SUBNET\_ASSOCIATING\_INSTANCE | Instance is being removed. |
