> 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/ipt/ip-transit/createiptransit.md).

# CreateIPTransit

## 1. API Description

This API (CreateIPTransit) is used to creates an IP Transit.

#### Preparation

* **Physical port**: You need to prepare at least one physical port in advance.
* **Query regions supporting IP Transit:**
  * You can call [DescribeIPTransitDatacenters](https://github.com/zenlayer/zenlayercloud-api-doc-en/tree/main/ipt/ip-transit/describe-iptransit-datacenters.md) to query data centers supporting IP Transit.

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

* Due to equipment reasons, some regions only support manual delivery, with a delivery cycle of 1-3 days. You can check the **deliveryType** field of [DescribeIPTransitDatacenters](https://github.com/zenlayer/zenlayercloud-api-doc-en/tree/main/ipt/ip-transit/describe-iptransit-datacenters.md) to determine whether it is automated delivery.
* This is an asynchronous API. After the creation request is successfully submitted, an IP Transit `ID` will be returned. The creation is not immediately completed. During this period, the instance state will be **`DEPLOYING`**. You can call DescribeIpTransit to query the result. If the state (`iptStatus`) changes from **`DEPLOYING`** to **`AVAILABLE`**, the creation is successful. If the state changes to **`FAILED`**, the creation has failed. No operations are allowed on the IP Transit during the creation process.
* When `internetType=ByInstanceBandwidth95` (95th percentile billing), `commitBandwidth` is required. If `bandwidth` is also specified, it must be greater than or equal to `commitBandwidth`; otherwise the `INVALID_RIPT_BANDWIDTH_LESS_THAN_COMMIT` error is returned.
* When creating a high-availability IP Transit with `haConfig`, both `iptDcId` and `bfd` are required. A missing `iptDcId` returns the `MISSING_PARAMETER` error, and a missing or incomplete `bfd` returns the `INVALID_RIPT_HA_BFD_REQUIRED` error. BFD cannot be disabled after a high-availability IP Transit is created.
* When `routingType=BGP`, `bgp` is required and `bgp.asn` must be specified. You must also provide either `bgp.asnList` or `bgp.asSetList` (at least one of them). A missing `bgp` or `bgp.asn` returns the `MISSING_PARAMETER` error; if neither `asnList` nor `asSetList` is provided, the `INVALID_RIPT_BGP_ASN_LIST_MISSING` error is returned; if the ASN does not belong to you, the `INVALID_RIPT_BGP_ASN` error is returned.
* `bgp.tier` specifies the BGP tier: `PREMIUM` (Premium, the default) or `STANDARD` (Standard). The Standard tier is available only in some data centers (see `availableBgpTiers` in [DescribeIPTransitDatacenters](https://github.com/zenlayer/zenlayercloud-api-doc-en/tree/main/ipt/ip-transit/describe-iptransit-datacenters.md)), supports only `internetType=ByBandwidth` (fixed bandwidth), and `bandwidth` must be one of the fixed tier levels of that data center (for example, 10000/50000/100000 Mbps; if a value outside the tier levels is passed, the `INVALID_RIPT_BANDWIDTH_NOT_IN_TIER_LEVELS` error message returns the full list of available tier levels). If these conditions are not met, the `INVALID_RIPT_BGP_TIER_NOT_SUPPORTED`, `INVALID_RIPT_INTERNET_TYPE_FOR_STANDARD_BGP`, or `INVALID_RIPT_BANDWIDTH_NOT_IN_TIER_LEVELS` error is returned respectively. `STANDARD` is not supported when `zbgRegionId` is specified (router-based IP Transit).
* The Zenlayer-side (peer) AS numbers differ between the two tiers: `29752` for Standard BGP and `21859` for Premium BGP. Configure the BGP neighbor on your local router based on the `peerAsns` returned by [DescribeIPTransitDatacenters](https://github.com/zenlayer/zenlayercloud-api-doc-en/tree/main/ipt/ip-transit/describe-iptransit-datacenters.md).
  {% endhint %}

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name            | Required | Type                                                                                  | Description                                                                                                                                                                                                                                                                  |
| ------------------------- | -------- | ------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| peerPortId                | Yes      | String                                                                                | <p>Port ID.</p><p>The port connectivity status must be ACTIVE.</p>                                                                                                                                                                                                           |
| peerPortVlan              | Yes      | Integer                                                                               | <p>VLAN ID.</p><p>Value range: 1000-4000.</p><p>Must be an unallocated VLAN. You can call DescribePortUsableVlan to query available VLANs.</p>                                                                                                                               |
| routingType               | Yes      | [IPTransitRouteType](/api-reference/ipt/datastructure.md#iptransitroutetype)          | Routing type.                                                                                                                                                                                                                                                                |
| iptName                   | No       | String                                                                                | <p>IP Transit name.</p><p>Maximum: 255 characters.</p>                                                                                                                                                                                                                       |
| iptDescription            | No       | String                                                                                | <p>IP Transit description.</p><p>Maximum: 255 characters.</p>                                                                                                                                                                                                                |
| iptDcId                   | No       | String                                                                                | <p>IP Transit destination data center ID.</p><p>If not specified, it means the IP Transit is in the same data center as the port.</p>                                                                                                                                        |
| internetType              | No       | [InternetType](/api-reference/ipt/datastructure.md#internettype)                      | <p>Bandwidth billing method of the IP Transit.</p><p>Default value: ByBandwidth</p>                                                                                                                                                                                          |
| commitBandwidth           | No       | Integer                                                                               | <p>Committed bandwidth.</p><p>Unit: Mbps.</p><p>This field is required if and only if internetType is ByInstanceBandwidth95.</p><p>Value range: \[5, +)</p>                                                                                                                  |
| bandwidth                 | No       | Integer                                                                               | <p>Bandwidth cap.</p><p>Unit: Mbps.</p><p>Minimum value: 5 Mbps.</p><p>Default value: 5 Mbps.</p><p>Value range: \[5, +)</p>                                                                                                                                                 |
| publicIPv4BlockSize       | No       | Array of Integer                                                                      | <p>Public IPv4 address block.</p><p>Netmask range: 24-30.</p><p>This field is required if and only if routing type is Static or Gateway.</p><p>Currently, only one public CIDR is allowed.</p>                                                                               |
| bfd                       | No       | [BFDConfig](/api-reference/ipt/datastructure.md#bfdconfig)                            | <p>Enable BFD configuration.</p><p>If this field is not specified, BFD is disabled by default.</p><p>Gateway mode does not support BFD configuration.</p>                                                                                                                    |
| resourceGroupId           | No       | String                                                                                | <p>Resource group ID.</p><p>If not specified, it will be placed in the default resource group.</p>                                                                                                                                                                           |
| bgp                       | No       | [RiptBgpConfig](/api-reference/ipt/datastructure.md#riptbgpconfig)                    | BGP configurations.                                                                                                                                                                                                                                                          |
| tags                      | No       | [TagAssociation](/api-reference/ipt/datastructure.md#tagassociation)                  | <p>Tags to associate when creating the IP Transit.</p><p>Note: Tag keys must be unique.</p>                                                                                                                                                                                  |
| publicIpList              | No       | Array of [IPTransitIpRequest](/api-reference/ipt/datastructure.md#iptransitiprequest) | <p>List of public IP allocations.</p><p>Mutually exclusive with publicIPv4BlockSize and takes precedence.</p><p>If this field is specified, publicIPv4BlockSize is ignored.</p>                                                                                              |
| zbgRegionId               | No       | String                                                                                | <p>ZBG access node ID.</p><p>If specified, the Router RIPT process is used. Mutually exclusive with <code>haConfig</code>.</p>                                                                                                                                               |
| haConfig                  | No       | [IPTransitHaConfig](/api-reference/ipt/datastructure.md#iptransithaconfig)            | <p>HA configuration.</p><p>If specified, the HA creation process is used. Mutually exclusive with zbgRegionId.</p>                                                                                                                                                           |
| publicInterconnectNetmask | No       | Integer                                                                               | <p>Public interconnect block netmask.</p><p>If specified, public address interconnect is enabled. Only supported for BGP / Static routing.</p><p>For valid values, see availableRoutingTypes\[].publicInterconnectNetmasks in the DescribeIPTransitDatacenters response.</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> |
| orderNumber    | String | Order number generated during creation.                                                                               |
| iptId          | String | IP Transit ID.                                                                                                        |

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**1. Create an IP Transit with static routing, a /28 public CIDR, and BFD configured.**

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

Request：
{
  "iptName": "test_IPT",
  "iptDescription": "test_ipt_desc",
  "peerPortId": "1170556726903057557",
  "peerPortVlan": 1042,
  "internetType": "ByBandwidth",
  "bandwidth": 50,
  "iptDcId": "AMS1",
  "routingType": "Static",
  "publicIPv4BlockSize": [
    28
  ],
  "bfd": {
    "bfdTxInterval": 100,
    "bfdRxInterval": 100,
    "bfdMultiplier": 10
  }
}


Response：
{
  "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
  "response": {
     "requestId": "T98044459-95B2-477E-9A2F-00253A70CC6E",
     "iptId": "your-ipt-id",
     "orderNumber": "xxxx"
  }
}
```

**2. Create an IP Transit and use `publicIpList` to allocate a /28 IPv4 block and a /64 IPv6 block at the same time.**

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

Request：
{
  "iptName": "test_IPT_v4v6",
  "peerPortId": "1170556726903057557",
  "peerPortVlan": 1042,
  "internetType": "ByBandwidth",
  "bandwidth": 100,
  "iptDcId": "AMS1",
  "routingType": "BGP",
  "publicIpList": [
    { "netmask": 28, "ipType": "IPV4", "ipNetworkType": "BGP_IP", "amount": 2 },
    { "netmask": 64, "ipType": "IPV6", "ipNetworkType": "BGP_IP" }
  ]
}

Response：
{
  "requestId": "T12345678-ABCD-1234-EFGH-000000000010",
  "response": {
    "requestId": "T12345678-ABCD-1234-EFGH-000000000010",
    "iptId": "your-ipt-id",
    "orderNumber": "xxxx"
  }
}
```

**3. Create an IP Transit with the Standard BGP tier (`STANDARD`) and a fixed bandwidth of 10 Gbps.**

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

Request：
{
  "iptName": "test_IPT_standard_bgp",
  "peerPortId": "1170556726903057557",
  "peerPortVlan": 1043,
  "internetType": "ByBandwidth",
  "bandwidth": 10000,
  "iptDcId": "SIN1",
  "routingType": "BGP",
  "publicIPv4BlockSize": [
    28
  ],
  "bgp": {
    "routeType": "ALL_ROUTES",
    "tier": "STANDARD",
    "asn": 64500,
    "asnList": [
      64500
    ]
  }
}

Response：
{
  "requestId": "T12345678-ABCD-1234-EFGH-000000000011",
  "response": {
    "requestId": "T12345678-ABCD-1234-EFGH-000000000011",
    "iptId": "your-ipt-id",
    "orderNumber": "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                                                                                                |
| ---------------- | --------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| 404              | INVALID\_RIPT\_NOT\_SELLABLE                        | This data center does not support IP Transit.                                                              |
| 400              | INVALID\_RIPT\_IP\_INVALID\_RANGE                   | Invalid IP mask range.                                                                                     |
| 400              | INVALID\_RIPT\_ROUTING\_TYPE\_MISSING               | The route type parameter is missing.                                                                       |
| 400              | INVALID\_RIPT\_PUBLIC\_IP\_ALLOCATION\_MISSING      | At least one of `publicIPv4BlockSize` and `publicIpList` must be specified.                                |
| 400              | INVALID\_RIPT\_BANDWIDTH\_LESS\_THAN\_COMMIT        | `bandwidth` must be greater than or equal to `commitBandwidth` when internetType is ByInstanceBandwidth95. |
| 404              | INVALID\_RIPT\_BGP\_ASN                             | Invalid ASN number.                                                                                        |
| 400              | INVALID\_RIPT\_BGP\_ASN\_LIST\_MISSING              | At least one of `bgp.asnList` and `bgp.asSetList` must be specified.                                       |
| 400              | INVALID\_RIPT\_BGP\_TIER\_NOT\_SUPPORTED            | The specified data center does not support the selected BGP tier.                                          |
| 400              | INVALID\_RIPT\_INTERNET\_TYPE\_FOR\_STANDARD\_BGP   | Standard BGP supports fixed bandwidth billing only.                                                        |
| 400              | INVALID\_RIPT\_BANDWIDTH\_NOT\_IN\_TIER\_LEVELS     | The bandwidth is not one of the available Standard BGP tier levels.                                        |
| 400              | INVALID\_RIPT\_PUBLIC\_INTERCONNECT\_NOT\_SUPPORTED | Public interconnect addresses are only supported for Static or BGP routing mode.                           |
| 400              | INVALID\_RIPT\_PUBLIC\_INTERCONNECT\_NETMASK        | Invalid public interconnect netmask. Only 30 or 31 is supported.                                           |
| 400              | INVALID\_RIPT\_HA\_DELIVERY\_TYPE\_NOT\_AUTO        | HA only supports the automated delivery type.                                                              |
| 400              | INVALID\_RIPT\_HA\_PORT\_NOT\_SAME\_CITY            | The primary and secondary ports must be in the same city.                                                  |
| 400              | INVALID\_RIPT\_HA\_ROUTING\_TYPE                    | HA only supports static routing.                                                                           |
| 400              | INVALID\_RIPT\_HA\_DUPLICATE\_PORT                  | The primary and secondary ports cannot be the same physical port.                                          |
| 409              | INVALID\_RIPT\_HA\_PORT\_NOT\_UP                    | The HA port connectivity state is not UP.                                                                  |
| 400              | INVALID\_RIPT\_HA\_PORT\_CATEGORY\_MISMATCH         | The primary and secondary ports must have the same specifications.                                         |
| 400              | INVALID\_RIPT\_HA\_BFD\_REQUIRED                    | BFD configuration is required when creating an HA IP Transit.                                              |
| 403              | OPERATION\_DENIED\_ZBG\_RIPT\_SAME\_CITY            | ZBG and IPT cannot be in the same city.                                                                    |
