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

# DescribeIPTransitAvailableCidrBlocks

## 1. API Description

This API (DescribeIPTransitAvailableCidrBlocks) is used to queries available public address blocks of an IP Transit.

{% 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.
* In the **creation scenario**, `iptDcId` is required; `routingType` is optional.
* In the **expansion/reduction scenario**, only `ipUuid` is required; `iptDcId` and `routingType` can be omitted, as the API automatically infers them from the RIPT 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 the ZBG scenario, `zbgRegionId` must also be passed. IPv6 CIDR blocks are not returned in the ZBG scenario.
  {% endhint %}

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name | Required | Type                                                                         | Description                                                                                                                                                                                                     |
| -------------- | -------- | ---------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| iptDcId        | 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       | [IPTransitRouteType](/api-reference/ipt/datastructure.md#iptransitroutetype) | <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 [CidrBlock](/api-reference/ipt/datastructure.md#cidrblock) | List of available IPv4 CIDR blocks.                                                                                   |
| ipv6CidrBlocks | Array of [CidrBlock](/api-reference/ipt/datastructure.md#cidrblock) | List of available IPv6 CIDR blocks.                                                                                   |

## 4. Code Example

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

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

Request:
{
  "iptDcId": "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. Expansion/reduction scenario: pass only `ipUuid`; the data center and routing type are inferred automatically. Returns options with the same network type as the current IP block and a netmask different from the current block.**

```json
POST /api/v2/ipt HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: DescribeIPTransitAvailableCidrBlocks
<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](/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 |
| ---------------- | ---------- | ----------- |
