# ModifyVpcAttribute

## 1. API Description

This API (ModifyVpcAttribute) is used to modify the attributes of a global VPC.

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name  | Required | Type    | Description                                                                                                                                                                                                                                                                                                  |
| --------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| vpcId           | Yes      | String  | Global VPC ID.                                                                                                                                                                                                                                                                                               |
| vpcName         | No       | String  | <p>Global VPC name.</p><p>This parameter must start and end with a number or a letter, containing 2 to 63 characters. Only letters, numbers, -/\_ and periods (.) are supported.</p>                                                                                                                         |
| cidrBlock       | No       | String  | <p>IPv4 CIDR block to be modified.</p><p>The IPv4 CIDR block should be a valid subnet within these ranges:</p><p>10.0.0.0/9 10.128.0.0/9 172.16.0.0/12 192.168.0.0/16</p><p>If the global VPC has subnets, the new CIDR must include the original CIDR.</p><p>The default global VPC cannot be modified.</p> |
| enableIPv6      | No       | Boolean | Whether to enable the private IPv6 CIDR block. Currently, only enabling ( true ) is allowed. Once enabled, private IPv6 CIDR block function cannot be disabled.                                                                                                                                              |
| securityGroupId | No       | String  | <p>Modifies the security group ID associated to the VPC.</p><p>If not specified, no changes will be made.</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" %}
**Modify the information of a global VPC, and enable the private IPv6 CIDR block.**

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

Request：
{
    "vpcId": "<vpcId>",
    "vpcName": "TestVpcName",
    "enableIpv6": true
}

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                                                        |
| ---------------- | ------------------------------------------- | ------------------------------------------------------------------ |
| 400              | INVALID\_CIDR\_BLOCK\_FORMAT                | Invalid CIDR block format.                                         |
| 400              | INVALID\_CIDR\_BLOCK\_NETMASK\_RANGE        | CIDR block range is invalid.                                       |
| 400              | INVALID\_CIDR\_BLOCK\_NOT\_EMPTY            | CIDR block cannot be empty.                                        |
| 400              | INVALID\_CIDR\_BLOCK\_NOT\_LAN\_IP          | CIDR block must be a private IP range.                             |
| 400              | INVALID\_IP\_BROADCAST\_ADDRESS             | The IP address cannot be a broadcast address.                      |
| 404              | INVALID\_SECURITY\_GROUP\_NOT\_FOUND        | The specified security group does not exist.                       |
| 404              | INVALID\_VPC\_NOT\_FOUND                    | The global VPC does not exist.                                     |
| 400              | OPERATION\_DENIED\_DEFAULT\_VPC             | The default global VPC cannot be modified.                         |
| 400              | OPERATION\_DENIED\_VPC\_CANT\_DISABLE\_IPV6 | Once enabled, IPv6 CIDR block function cannot be disabled.         |
| 400              | OPERATION\_DENIED\_VPC\_CIDR\_CONFLICT      | CIDR blocks conflict. The new CIDR must include the original CIDR. |


---

# 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/vpc-network/modifyvpcattribute.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.
