> 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/vpc-network/unassociatevpccidrblock.md).

# UnassociateVpcCidrBlock

## 1. API Description

This API (UnassociateVpcCidrBlock) is used to remove a secondary IPv4 CIDR block from a VPC.

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

* Concurrent CIDR block operations on the same VPC are not supported. Please call the interface serially.
  {% endhint %}

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name | Required | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| -------------- | -------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| vpcId          | Yes      | String | <p>ID of the VPC.</p><p>The default VPC does not support removing secondary CIDR blocks.</p><p>It can be obtained by calling <a href="/api-reference/zec/vpc-network/describevpcs.md">DescribeVpcs</a>.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| cidrBlock      | Yes      | String | <p>Secondary IPv4 CIDR block to be removed.</p><p>It must be exactly the same as one of the existing secondary CIDR blocks of this VPC.</p><p>Only secondary CIDR blocks can be removed: passing in the primary CIDR block is rejected. The primary CIDR block cannot be deleted and can only be expanded or shrunk within the original CIDR block through <a href="/api-reference/zec/vpc-network/modifyvpcattribute.md">ModifyVpcAttribute</a>.</p><p>No subnet may exist under this secondary CIDR block, otherwise the request is rejected. Delete all subnets under this CIDR block first.</p><p>Secondary CIDR blocks cannot be modified. To adjust the size, remove the CIDR block first and then call <a href="/api-reference/zec/vpc-network/associatevpccidrblock.md">AssociateVpcCidrBlock</a> again to add it.</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" %}
**1. Remove a secondary CIDR block from a VPC.**

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

Request：
{
  "vpcId": "<vpcId>",
  "cidrBlock": "172.16.0.0/16"
}

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](/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\_VPC\_NOT\_FOUND                           | The global VPC does not exist.                          |
| 404              | INVALID\_VPC\_SECONDARY\_CIDR\_NOT\_FOUND          | The specified secondary CIDR block does not exist.      |
| 400              | INVALID\_CIDR\_BLOCK\_FORMAT                       | Invalid CIDR block format.                              |
| 400              | INVALID\_CIDR\_BLOCK\_NOT\_EMPTY                   | CIDR block cannot be empty.                             |
| 400              | OPERATION\_DENIED\_DEFAULT\_VPC                    | The default global VPC cannot be modified.              |
| 400              | OPERATION\_DENIED\_VPC\_CIDR\_HAS\_SUBNET          | The CIDR block still has subnets and cannot be removed. |
| 400              | OPERATION\_DENIED\_VPC\_PRIMARY\_CIDR\_UNASSOCIATE | The primary CIDR block cannot be deleted.               |
