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

# DescribeInternetAvailableCidrBlocks

## 1. API Description

This API (DescribeInternetAvailableCidrBlocks) is used to queries available public address blocks of an Internet.

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

* `routingType` affects the returned netmask range: Static and BGP routing support IPv4 netmasks from /24 to /32; Gateway routing supports only /24 to /30. If not specified, all netmasks are returned.
* If `internetDcId` is specified, the query is performed for that data center, and `routingType` is optional.
* If `ipUuid` is specified, `internetDcId` and `routingType` can be omitted, as the API automatically infers them from the Internet to which the IP block belongs. Only options with the same protocol stack type and network type as the current IP block, and a netmask different from the current block, are returned.
* In ZBG scenarios, `zbgRegionId` must also be specified. IPv6 CIDR blocks are not returned in ZBG scenarios.
  {% endhint %}

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name | Required | Type                                                                                                        | Description                                                                                                                                                                                                     |
| -------------- | -------- | ----------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| internetDcId   | No       | String                                                                                                      | <p>Target data center ID.</p><p>Required in the creation scenario. Can be omitted in the expansion/reduction scenario (when ipUuid is passed), as it will be inferred from the data center of the IP block.</p> |
| routingType    | No       | [InternetRouteType](https://docs.console.zenlayer.com/api-reference/sdn/datastructure.md#internetroutetype) | <p>Routing type.</p><p>The available netmask range differs by routing type. If not specified, all netmasks are returned.</p>                                                                                    |
| zbgRegionId    | No       | String                                                                                                      | <p>ZBG region ID.</p><p>Required in ZBG scenarios.</p>                                                                                                                                                          |
| ipUuid         | No       | String                                                                                                      | <p>IP address UUID.</p><p>Passed in the expansion scenario. Only options with a netmask length no smaller than the current IP block are returned.</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> |
| ipv4CidrBlocks | Array of [InternetCidrBlock](https://docs.console.zenlayer.com/api-reference/sdn/datastructure.md#internetcidrblock) | List of available IPv4 CIDR blocks.                                                                                   |
| ipv6CidrBlocks | Array of [InternetCidrBlock](https://docs.console.zenlayer.com/api-reference/sdn/datastructure.md#internetcidrblock) | List of available IPv6 CIDR blocks.                                                                                   |

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**1. Query the available public CIDR netmasks under BGP routing in the AMS1 data center.**

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

Request:
{
  "internetDcId": "AMS1",
  "routingType": "BGP"
}

Response:
{
    "requestId": "T12345678-ABCD-1234-EFGH-000000000030",
    "response": {
        "requestId": "T12345678-ABCD-1234-EFGH-000000000030",
        "ipv4CidrBlocks": [
            { "netmask": 24, "ipNetworkType": "BGP_IP" },
            { "netmask": 25, "ipNetworkType": "BGP_IP" },
            { "netmask": 26, "ipNetworkType": "BGP_IP" },
            { "netmask": 27, "ipNetworkType": "BGP_IP" },
            { "netmask": 28, "ipNetworkType": "BGP_IP" },
            { "netmask": 29, "ipNetworkType": "BGP_IP" },
            { "netmask": 30, "ipNetworkType": "BGP_IP" }
        ],
        "ipv6CidrBlocks": [
            { "netmask": 48, "ipNetworkType": "BGP_IP" },
            { "netmask": 56, "ipNetworkType": "BGP_IP" },
            { "netmask": 64, "ipNetworkType": "BGP_IP" }
        ]
    }
}
```

**2. Specify only ipUuid: the data center and routing type are inferred automatically, and options with the same network type as the current IP block and a netmask different from the current block are returned.**

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

Request:
{
  "ipUuid": "your-ip-uuid"
}

Response:
{
    "requestId": "T12345678-ABCD-1234-EFGH-000000000031",
    "response": {
        "requestId": "T12345678-ABCD-1234-EFGH-000000000031",
        "ipv4CidrBlocks": [
            { "netmask": 24, "ipNetworkType": "BGP_IP" },
            { "netmask": 25, "ipNetworkType": "BGP_IP" },
            { "netmask": 26, "ipNetworkType": "BGP_IP" },
            { "netmask": 27, "ipNetworkType": "BGP_IP" },
            { "netmask": 29, "ipNetworkType": "BGP_IP" },
            { "netmask": 30, "ipNetworkType": "BGP_IP" }
        ],
        "ipv6CidrBlocks": []
    }
}
```

{% 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 |
| ---------------- | ---------- | ----------- |
