> 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/sdn/internet/modifyinternetconfig.md).

# ModifyInternetConfig

## 1. API Description

This API (ModifyInternetConfig) is used to modifies Internet configuration.

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

* Changes can be made only when the Internet state is **AVAILABLE**.
* This is an asynchronous API. After the request succeeds, the Internet state changes to **UPDATING**. You can poll the state via [DescribeInternets](https://docs.console.zenlayer.com/api-reference/sdn/internet/describeinternets.md); when it returns to **AVAILABLE**, the change is successful.
* No other operations are allowed on the Internet during the change.
* **type description:**
  * `BANDWIDTH`: modifies the bandwidth cap. `bandwidth` is required. You can pass `commitBandwidth` to set the committed bandwidth; otherwise the committed bandwidth is the same 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. `bfd` is required; pass `null` to disable BFD. BFD cannot be disabled for a high-availability Internet; passing `null` or an incomplete `bfd` returns the `OPERATION_DENIED_HA_BFD_DISABLE` error.
  * `BGP_ROUTE_TYPE`: modifies the BGP inbound route type. `bgp.routeType` is required. Supported only for Internet instances with BGP routing; otherwise the `INVALID_RIPT_ROUTING_TYPE_NOT_BGP` error is returned.
  * `BGP_ASN_AS_SET`: modifies the allowed BGP ASN/AS-SET list. `asn` cannot be modified after creation. You must pass either `asnList` or `asSetList` in `bgp`; otherwise the `INVALID_RIPT_BGP_ASN_LIST_MISSING` error is returned. Supported only for Internet instances with BGP routing; otherwise the `INVALID_RIPT_ROUTING_TYPE_NOT_BGP` error is returned.
  * `BGP_PASSWORD`: modifies the BGP MD5 password. `bgp.password` is required. Supported only for Internet instances with BGP routing; otherwise the `INVALID_RIPT_ROUTING_TYPE_NOT_BGP` error is returned.
  * `ADD_CIDR_BLOCK`: adds a public IPv4 CIDR block. `publicIPv4BlockSize` is required. `ipNetworkType` is optional and defaults to `BGP_IP`. Optionally pass `marketingInfo.usePocVoucher=true` to use a POC voucher; if no POC voucher is available, the order fails. Not supported for Internet instances 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. `ipUuid` is required.
  * `EXPAND_CIDR_BLOCK`: expands an existing CIDR block (decreases the netmask). `ipUuid` and `publicIPv4BlockSize` are required. The target netmask cannot be smaller than the minimum netmask to which the IP block can actually be expanded; otherwise the `OPERATION_DENIED_INVALID_CIDR_SIZE` error is returned.
  * `SHRINK_CIDR_BLOCK`: shrinks an existing CIDR block (increases the netmask). `ipUuid` and `publicIPv4BlockSize` are required. The target netmask likewise cannot be smaller than the minimum netmask to which the IP block can actually be expanded.
  * `HA_SWITCH_PRIMARY`: switches the primary and secondary links. Available only for Internet instances in HA mode.
  * `HA_SWITCH_MODE`: switches the HA mode (active-standby ↔ load balancing). Available only for Internet instances in HA mode.
    {% endhint %}

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name      | Required | Type                                                                                                                  | Description                                                                                                                                                                                                               |
| ------------------- | -------- | --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| internetId          | Yes      | String                                                                                                                | Internet instance ID.                                                                                                                                                                                                     |
| type                | Yes      | [InternetConfigType](https://docs.console.zenlayer.com/api-reference/sdn/datastructure.md#internetconfigtype)         | 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](https://docs.console.zenlayer.com/api-reference/sdn/datastructure.md#bfdconfig)                           | <p>BFD configuration.</p><p>Specify when type is BFD. Pass null to disable BFD.</p><p>BFD cannot be disabled for a high-availability Internet.</p>                                                                        |
| bgp                 | No       | [InternetBgpConfigParam](https://docs.console.zenlayer.com/api-reference/sdn/datastructure.md#internetbgpconfigparam) | <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       | [InternetIpNetworkType](https://docs.console.zenlayer.com/api-reference/sdn/datastructure.md#internetipnetworktype)   | <p>IP network type.</p><p>Effective when type is ADD\_CIDR\_BLOCK. Default: BGP\_IP.</p>                                                                                                                                  |
| marketingInfo       | No       | [MarketingInfo](https://docs.console.zenlayer.com/api-reference/sdn/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. Change the Internet bandwidth to 200 Mbps and set the committed bandwidth to 100 Mbps.**

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

Request:
{
  "internetId": "your-internet-id",
  "type": "BANDWIDTH",
  "bandwidth": 200,
  "commitBandwidth": 100
}

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

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

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

Request:
{
  "internetId": "your-internet-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/sdn HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: ModifyInternetConfig
<Common Request Params>

Request:
{
  "internetId": "your-internet-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/sdn HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: ModifyInternetConfig
<Common Request Params>

Request:
{
  "internetId": "your-internet-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](https://docs.console.zenlayer.com/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](https://docs.console.zenlayer.com/api-reference/api-introduction/instruction/commonerrorcode.md).

| HTTP Status Code | Error Code                                    | Description                                                                                                |
| ---------------- | --------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| 404              | INVALID\_RIPT\_NOT\_FOUND                     | The Internet instance does not exist.                                                                      |
| 409              | INVALID\_RIPT\_HA\_ROLE                       | The HA role of the Internet is not applicable to this operation.                                           |
| 400              | INVALID\_RIPT\_STATE                          | The Internet state is not as expected.                                                                     |
| 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 Internet 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 child Internet does not belong to this HA parent instance.                                             |
| 409              | INVALID\_RIPT\_HA\_STATUS\_NOT\_RUNNING       | The Internet state must be RUNNING to perform HA operations.                                               |
| 403              | OPERATION\_DENIED\_HA\_BFD\_DISABLE           | BFD cannot be disabled for a high-availability Internet.                                                   |
| 400              | INVALID\_RIPT\_ROUTING\_TYPE\_NOT\_BGP        | The routing type of the Internet is not BGP, so BGP configuration cannot be modified.                      |
| 403              | OPERATION\_DENIED\_STANDARD\_BGP\_ADD\_CIDR   | Internet instances with the Standard BGP tier do not support adding public IP addresses.                   |
| 400              | INVALID\_RIPT\_BGP\_ASN\_LIST\_MISSING        | At least one of `bgp.asnList` and `bgp.asSetList` must be specified.                                       |
