# CreateCrossRegionBandwidth

## 1. API Description

This API is used to create a private cross-region bandwidth.

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

<mark style="color:blue;">Region A and Region Z must be different regions within the same global VPC.</mark>
{% endhint %}

## 2. Input Parameters

The following request parameter list only provides API request parameters.

<table><thead><tr><th width="179.805419921875">Parameter Name</th><th width="111.67047119140625">Required</th><th width="133.78131103515625">Type</th><th>Description</th></tr></thead><tbody><tr><td>vpcId</td><td>Yes</td><td>String</td><td>Global VPC ID where the private cross-region bandwidth is located.</td></tr><tr><td>internetChargeType</td><td>Yes</td><td><a href="../../../datastructure#internetchargetype">InternetChargeType</a></td><td>Network billing model.</td></tr><tr><td>crossRegionBandwidthName</td><td>Yes</td><td>String</td><td><p>The name of cross-region bandwidth.</p><p>The length is 2 to 63 characters.</p><p>Only letters, numbers, -/_ and periods (.) are supported.</p><p>The name must start and end with a number or a letter.</p></td></tr><tr><td>regionA</td><td>Yes</td><td>String</td><td>One end of the cross-region bandwidth.</td></tr><tr><td>regionZ</td><td>Yes</td><td>String</td><td>The other end of the cross-region bandwidth.</td></tr><tr><td>bandwidth</td><td>Yes</td><td>Integer</td><td>Bandwidth cap.</td></tr><tr><td>marketingInfo</td><td>No</td><td><a href="../../../datastructure#marketinginfo">MarketingInfo</a></td><td>Information on marketing campaigns.</td></tr><tr><td>bandwidthCap</td><td>No</td><td>Integer</td><td><p>Burst bandwidth.</p><p>Unit: Mbps.</p><p>This field is required only when internetChargeType is set to <code>ByInstanceBandwidth95</code>.</p><p>Available range: [1, +).</p></td></tr></tbody></table>

## 3. Output Parameters

<table><thead><tr><th width="214.01422119140625">Parameter Name</th><th width="82.8643798828125">Type</th><th>Description</th></tr></thead><tbody><tr><td>requestId</td><td>String</td><td>The unique request ID, which is returned for each request. RequestId is required for locating a problem.</td></tr><tr><td>orderNumber</td><td>String</td><td>Order number.</td></tr><tr><td>crossRegionBandwidthId</td><td>String</td><td>Unique ID of cross-region bandwidth.</td></tr></tbody></table>

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**1. Create a cross-region bandwidth from Shanghai to Beijing, with the network billing model of Flat Rate. Burst bandwidth is 100 Mbps.**

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

Request：
{
  "vpcId": "<your vpc id>",
  "internetChargeType": "ByBandwidth",
  "crossRegionBandwidthName": "Test-Cross1",
  "regionA": "asia-east-1",
  "regionZ": "asia-north-1",
  "bandwidth": 100
}

Response：
{
  "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
  "response": {
    "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
    "crossRegionBandwidthId": "<crossId1>",
    "orderNumber": "<orderNumber>"
  }
}
```

**2. Create a cross-region bandwidth from Beijing to Shanghai, with the network billing model of Burstable 95th. Bandwidth commitment is 100 Mbps and the burst bandwidth is 120 Mbps.**

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

Request：
{
  "vpcId": "<your vpc id>",
  "internetChargeType": "ByInstanceBandwidth95",
  "crossRegionBandwidthName": "Test-Cross2",
  "regionA": "asia-north-1",
  "regionZ": "asia-east-1",
  "bandwidth": 100,
  "bandwidthCap": 120
}

Response：
{
  "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
  "response": {
    "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
    "crossRegionBandwidthId": "<crossId2>",
    "orderNumber": "<orderNumber>"
  }
}
```

{% endtab %}
{% endtabs %}

## 5. Developer Resources

Zenlayer Cloud API 2.0 [SDKs](https://github.com/zenlayer/zenlayercloud-api-doc-en/blob/main/api-introduction/software-toolkit/sdk/introduction.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](https://docs.console.zenlayer.com/api/api-introduction/instruction/commonerrorcode).

<table><thead><tr><th width="172.274169921875">HTTP Status Code</th><th>Error Code</th><th>Description</th></tr></thead><tbody><tr><td>404</td><td>INVALID_REGION_NOT_FOUND</td><td>Region does not exist.</td></tr><tr><td>400</td><td>INVALID_VPC_BANDWIDTH_REGION_AZ_IS_EXIST</td><td>Both region A and region Z of cross-region bandwidth already exist.</td></tr><tr><td>400</td><td>INVALID_VPC_BANDWIDTH_REGION_AZ_IS_SAME</td><td>Region A and region Z of the cross-region bandwidth are the same.</td></tr><tr><td>404</td><td>INVALID_VPC_NOT_FOUND</td><td>VPC does not exist.</td></tr></tbody></table>
