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

# CreateVpc

## 1. API Description

This API (CreateVpc) is used to create a global VPC.

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name  | Required | Type                                                                 | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| --------------- | -------- | -------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| name            | Yes      | String                                                               | <p>Global VPC name to be displayed.</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       | Yes      | String                                                               | <p>Primary IPv4 CIDR block of the VPC.</p><p>After the creation is completed, you can call <a href="/api-reference/zec/vpc-network/associatevpccidrblock.md">AssociateVpcCidrBlock</a> to add secondary CIDR blocks.</p><p>The mask length ranges from 9 to 29, and the starting address of the CIDR block must be specified, for example <code>10.0.0.0/16</code>.</p><p>It cannot overlap with the following reserved CIDR blocks: <code>0.0.0.0/8</code>, <code>100.64.0.0/10</code>, <code>127.0.0.0/8</code>, <code>169.254.0.0/16</code>, and <code>224.0.0.0/4</code>.</p> |
| mtu             | Yes      | Integer                                                              | The MTU (Maximum Transmission Unit) of the VPC. Supported values: 1300, 1500, 9000.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| enablePriIpv6   | No       | Boolean                                                              | <p>Whether to enable private IPv6.</p><p>Once enabled, it cannot be disabled.</p><p>Default value: false</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| resourceGroupId | No       | String                                                               | <p>Resource group ID where the global VPC resides.</p><p>If the value is empty, the global VPC will belong to the Default Resource Group.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| tags            | No       | [TagAssociation](/api-reference/zec/datastructure.md#tagassociation) | Tags to associate when creating the VPC. Tag keys within the same resource cannot be duplicated.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |

## 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> |
| vpcId          | String | Global VPC ID.                                                                                                        |

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**1. Create a VPC.**

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

Request：
{
  "name": "vpcXXX",
  "cidrBlock": "10.0.0.0/9",
  "mtu": 1300
}

Response：
{
  "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
  "response": {
    "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
    "vpcId": "xxxx"
  }
}
```

{% 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\_IP\_BROADCAST\_ADDRESS                     | The IP address cannot be a broadcast address.                                     |
| 400              | OPERATION\_DENIED\_VPC\_CIDR\_RESERVED              | The CIDR block of the VPC overlaps with a reserved CIDR block and cannot be used. |
| 400              | OPERATION\_DENIED\_VPC\_CIDR\_OVERLAP               | The CIDR blocks of the VPC overlap with each other.                               |
| 400              | UNSUPPORTED\_OPERATION\_TEAM\_NETWORK\_COUNT\_LIMIT | Global VPC quantity exceeds limit.                                                |
