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

# ModifyIPTransitConfig

## 1. API Description

This API (ModifyIPTransitConfig) is used to modifies IP Transit configuration.

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

* Configuration changes can only be made when the IP Transit state is **AVAILABLE**.
* This is an asynchronous API. After the request succeeds, the IP Transit state changes to **UPDATING**. You can poll the state via [DescribeIPTransits](https://github.com/zenlayer/zenlayercloud-api-doc-en/tree/main/ipt/ip-transit/describe-iptransits.md); when it changes back to **AVAILABLE**, the change has succeeded.
* No other operations are allowed on this IP Transit during the change.
* **About type:**
  * `BANDWIDTH`: Modifies the bandwidth cap. Requires `bandwidth`. You can pass `commitBandwidth` to set the committed bandwidth; otherwise, it defaults to the same value as the bandwidth cap. Under 95th percentile billing (`internetType=ByInstanceBandwidth95`), `bandwidth` must be greater than or equal to the effective committed bandwidth; otherwise the `INVALID_RIPT_BANDWIDTH_LESS_THAN_COMMIT` error is returned.
  * `BFD`: Modifies the BFD configuration. Requires `bfd`. Pass `null` to disable BFD. BFD cannot be disabled for a high-availability IP Transit: passing `null` or an incomplete `bfd` returns the `OPERATION_DENIED_HA_BFD_DISABLE` error.
  * `BGP_ROUTE_TYPE`: Modifies the BGP inbound route type. Requires `bgp.routeType`. Supported only for IP Transits with BGP routing; otherwise the `INVALID_RIPT_ROUTING_TYPE_NOT_BGP` error is returned.
  * `BGP_ASN_AS_SET`: Modifies the allowed ASN/AS-SET list for BGP. `asn` cannot be modified after creation. You must provide either `asnList` or `asSetList` in `bgp`; otherwise the `INVALID_RIPT_BGP_ASN_LIST_MISSING` error is returned. Supported only for IP Transits with BGP routing; otherwise the `INVALID_RIPT_ROUTING_TYPE_NOT_BGP` error is returned.
  * `BGP_PASSWORD`: Modifies the BGP MD5 password. Requires `bgp.password`. Supported only for IP Transits with BGP routing; otherwise the `INVALID_RIPT_ROUTING_TYPE_NOT_BGP` error is returned.
  * `ADD_CIDR_BLOCK`: Adds a public IPv4 CIDR block. Requires `publicIPv4BlockSize`. You can optionally pass `ipNetworkType`, which defaults to `BGP_IP`. You can optionally pass `marketingInfo.usePocVoucher=true` to use a POC voucher; if no POC voucher is available in the system, the order will fail. Not supported for IP Transits with the Standard BGP tier (`bgp.tier=STANDARD`); otherwise the `OPERATION_DENIED_STANDARD_BGP_ADD_CIDR` error is returned.
  * `DEL_CIDR_BLOCK`: Deletes a public IPv4 CIDR block. Requires `ipUuid`.
  * `EXPAND_CIDR_BLOCK`: Expands an existing CIDR block (smaller netmask). Requires `ipUuid` and `publicIPv4BlockSize`. The target netmask cannot be smaller than the minimum netmask that the IP block can actually be expanded to at the underlying layer; otherwise the `OPERATION_DENIED_INVALID_CIDR_SIZE` error is returned.
  * `SHRINK_CIDR_BLOCK`: Shrinks an existing CIDR block (larger netmask). Requires `ipUuid` and `publicIPv4BlockSize`. The target netmask likewise cannot be smaller than the minimum netmask that the IP block can actually be expanded to at the underlying layer.
  * `HA_SWITCH_PRIMARY`: HA primary/secondary switchover. Available only for HA-mode IP Transits.
  * `HA_SWITCH_MODE`: Switches the HA mode (active/standby ↔ active/active). Available only for HA-mode IP Transits.
    {% endhint %}

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name      | Required | Type                                                                                 | Description                                                                                                                                                                                                               |
| ------------------- | -------- | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| iptId               | Yes      | String                                                                               | IP Transit instance ID.                                                                                                                                                                                                   |
| type                | Yes      | [IPTransitConfigType](/api-reference/ipt/datastructure.md#iptransitconfigtype)       | Configuration change operation type.                                                                                                                                                                                      |
| bandwidth           | No       | Integer                                                                              | <p>Target bandwidth (Mbps).</p><p>Required when type is BANDWIDTH.</p>                                                                                                                                                    |
| commitBandwidth     | No       | Integer                                                                              | <p>Committed bandwidth (Mbps).</p><p>Effective when type is BANDWIDTH. If not specified, defaults to the same value as bandwidth.</p>                                                                                     |
| bfd                 | No       | [BFDConfig](/api-reference/ipt/datastructure.md#bfdconfig)                           | <p>BFD configuration.</p><p>Required when type is BFD. Pass null to disable BFD.</p>                                                                                                                                      |
| bgp                 | No       | [BgpConfigParam](/api-reference/ipt/datastructure.md#bgpconfigparam)                 | <p>BGP configuration parameters.</p><p>Fill in the corresponding sub-fields when type is BGP\_ROUTE\_TYPE, BGP\_ASN\_AS\_SET, or BGP\_PASSWORD.</p>                                                                       |
| publicIPv4BlockSize | No       | Integer                                                                              | <p>IPv4 CIDR netmask length (24-32).</p><p>Required when type is ADD\_CIDR\_BLOCK, EXPAND\_CIDR\_BLOCK, or SHRINK\_CIDR\_BLOCK.</p>                                                                                       |
| ipUuid              | No       | String                                                                               | <p>UUID of the target IP block.</p><p>Required when type is DEL\_CIDR\_BLOCK, EXPAND\_CIDR\_BLOCK, or SHRINK\_CIDR\_BLOCK.</p>                                                                                            |
| ipNetworkType       | No       | [IPTransitIpNetworkType](/api-reference/ipt/datastructure.md#iptransitipnetworktype) | <p>IP network type.</p><p>Effective when type is ADD\_CIDR\_BLOCK. Default: BGP\_IP.</p>                                                                                                                                  |
| marketingInfo       | No       | [MarketingInfo](/api-reference/ipt/datastructure.md#marketinginfo)                   | <p>Marketing activity information, including whether to use a POC voucher.</p><p>Valid only when type is ADD\_CIDR\_BLOCK. If no POC voucher is available in the system, the order for adding the IP block will fail.</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. Modify the bandwidth of an IP Transit to 200 Mbps, with a committed bandwidth of 100 Mbps.**

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

Request:
{
  "iptId": "your-ipt-id",
  "type": "BANDWIDTH",
  "bandwidth": 200,
  "commitBandwidth": 100
}

Response:
{
  "requestId": "T12345678-ABCD-1234-EFGH-000000000004",
  "response": {
    "requestId": "T12345678-ABCD-1234-EFGH-000000000004"
  }
}
```

**2. Modify the BGP inbound route type to receive only default routes.**

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

Request:
{
  "iptId": "your-ipt-id",
  "type": "BGP_ROUTE_TYPE",
  "bgp": {
    "routeType": "DEFAULT_ROUTES"
  }
}

Response:
{
  "requestId": "T12345678-ABCD-1234-EFGH-000000000005",
  "response": {
    "requestId": "T12345678-ABCD-1234-EFGH-000000000005"
  }
}
```

**3. Add a /28 public IPv4 CIDR block.**

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

Request:
{
  "iptId": "your-ipt-id",
  "type": "ADD_CIDR_BLOCK",
  "publicIPv4BlockSize": 28,
  "marketingInfo": {
    "usePocVoucher": true
  }
}

Response:
{
  "requestId": "T12345678-ABCD-1234-EFGH-000000000006",
  "response": {
    "requestId": "T12345678-ABCD-1234-EFGH-000000000006"
  }
}
```

**4. Disable BFD detection.**

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

Request:
{
  "iptId": "your-ipt-id",
  "type": "BFD",
  "bfd": null
}

Response:
{
  "requestId": "T12345678-ABCD-1234-EFGH-000000000007",
  "response": {
    "requestId": "T12345678-ABCD-1234-EFGH-000000000007"
  }
}
```

{% 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\_FOUND                     | The IP Transit instance does not exist.                                                                    |
| 409              | INVALID\_RIPT\_HA\_ROLE                       | The IP Transit's HA role does not apply to this operation.                                                 |
| 400              | INVALID\_RIPT\_STATE                          | The IP Transit state does not support this operation.                                                      |
| 400              | INVALID\_RIPT\_IP\_INVALID\_RANGE             | Invalid IP mask range.                                                                                     |
| 400              | INVALID\_RIPT\_BANDWIDTH\_LESS\_THAN\_COMMIT  | `bandwidth` must be greater than or equal to `commitBandwidth` when internetType is ByInstanceBandwidth95. |
| 403              | OPERATION\_DENIED\_LAST\_CIDR                 | The last CIDR block cannot be deleted.                                                                     |
| 409              | INVALID\_RIPT\_INTERCONNECT\_BLOCK\_IMMUTABLE | The IP Transit interconnect address block cannot be modified after creation.                               |
| 403              | OPERATION\_DENIED\_CIDR\_STATUS               | The CIDR block state does not support this operation.                                                      |
| 403              | OPERATION\_DENIED\_INVALID\_CIDR\_SIZE        | Invalid CIDR block size.                                                                                   |
| 403              | OPERATION\_DENIED\_IP\_IN\_USE                | Some IP addresses are still in use.                                                                        |
| 409              | INVALID\_RIPT\_HA\_MODE\_NOT\_ACTIVE\_STANDBY | Primary/secondary switchover is only allowed in active/standby mode.                                       |
| 404              | INVALID\_RIPT\_HA\_CHILD\_NOT\_FOUND          | The sub-IP Transit does not belong to this HA parent instance.                                             |
| 409              | INVALID\_RIPT\_HA\_STATUS\_NOT\_RUNNING       | The IP Transit state must be RUNNING to perform HA operations.                                             |
| 403              | OPERATION\_DENIED\_HA\_BFD\_DISABLE           | BFD cannot be disabled for an HA IP Transit.                                                               |
| 400              | INVALID\_RIPT\_ROUTING\_TYPE\_NOT\_BGP        | Modifying BGP configuration is not supported because the routing type of the IP Transit is not BGP.        |
| 403              | OPERATION\_DENIED\_STANDARD\_BGP\_ADD\_CIDR   | IP Transits with the Standard BGP tier do not support adding public IP blocks.                             |
| 400              | INVALID\_RIPT\_BGP\_ASN\_LIST\_MISSING        | At least one of `bgp.asnList` and `bgp.asSetList` must be specified.                                       |
