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

# InquiryCreateIPTransitPrice

## 1. 接口描述

本接口(InquiryCreateIPTransitPrice)用于IP Transit创建询价。

{% hint style="info" %}
**注意事项**

* `internetType=ByInstanceBandwidth95`（95 计费）时须传 `commitBandwidth`；若同时传了 `bandwidth`，必须大于等于 `commitBandwidth`，否则返回 `INVALID_RIPT_BANDWIDTH_LESS_THAN_COMMIT` 错误。
* `routingType=BGP` 时可传 `bgpTier` 指定 BGP 档位（`PREMIUM` 优质，缺省 / `STANDARD` 普通），两档 SKU 与价格不同；普通档仅支持固定带宽计费，`bandwidth` 只能取该数据中心的固定档位值（如 10000/50000/100000，单位 Mbps）。`zbgRegionId` 非空（基于 router 的 IP Transit）时不支持 `STANDARD`。
  {% endhint %}

## 2. 请求参数

以下请求参数列表仅列出了接口中需要的请求参数

| 参数名称                      | 必选 | 类型                                                                                       | 描述                                                                                                                                   |
| ------------------------- | -- | ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| peerPortId                | 是  | String                                                                                   | 对端数据中心端口 ID。                                                                                                                         |
| routingType               | 是  | [IPTransitRouteType](/api-reference/cn/ipt/datastructure.md#iptransitroutetype)          | 路由模式。                                                                                                                                |
| iptDcId                   | 否  | String                                                                                   | <p>本端数据中心 ID。</p><p>为空代表本地连接（Local IPT）。</p>                                                                                         |
| internetType              | 否  | [InternetType](/api-reference/cn/ipt/datastructure.md#internettype)                      | <p>网络计费方式。</p><p>默认值：ByBandwidth</p>                                                                                                 |
| commitBandwidth           | 否  | Integer                                                                                  | <p>保底带宽。</p><p>单位Mbps。</p><p>有且仅当internetType=ByInstanceBandwidth95时该字段必传。</p><p>可选值范围：\[5, +)</p>                                   |
| bandwidth                 | 否  | Integer                                                                                  | <p>带宽限速。</p><p>单位Mbps。</p><p>最小值不能低于5Mbps。</p><p>默认值为5Mbps。</p><p>95 计费下必须大于等于 <code>commitBandwidth</code>。</p><p>可选值范围：\[5, +)</p> |
| publicIPv4BlockSize       | 否  | Array of Integer                                                                         | <p>公网 IPv4 地址段大小列表。</p><p>与 <code>publicIpList</code> 互斥，优先级更低。</p>                                                                  |
| bgpRouteType              | 否  | [RiptBgpRouteType](/api-reference/cn/ipt/datastructure.md#riptbgproutetype)              | BGP入站路由类型。                                                                                                                           |
| bgpTier                   | 否  | [RiptBgpTier](/api-reference/cn/ipt/datastructure.md#riptbgptier)                        | <p>BGP 档位。</p><p>不传默认 PREMIUM（优质档）。</p><p><code>zbgRegionId</code> 非空（基于 router 的 IP Transit）时不支持 STANDARD。</p>                      |
| ipType                    | 否  | [IPTransitIpType](/api-reference/cn/ipt/datastructure.md#iptransitiptype)                | <p>IP 类型（IPV4 / IPV6）。</p><p>默认 IPV4。</p>                                                                                            |
| publicIpList              | 否  | Array of [IPTransitIpRequest](/api-reference/cn/ipt/datastructure.md#iptransitiprequest) | <p>公网 IP 分配列表。</p><p>与 <code>publicIPv4BlockSize</code> 互斥，优先级更高。</p><p>传此字段时 <code>publicIPv4BlockSize</code> 被忽略。</p>              |
| zbgRegionId               | 否  | String                                                                                   | <p>ZBG 接入节点 ID。</p><p>非空时走 Router RIPT 询价流程。</p>                                                                                     |
| haConfig                  | 否  | [IPTransitHaConfig](/api-reference/cn/ipt/datastructure.md#iptransithaconfig)            | <p>HA 高可用配置。</p><p>非空时询价包含 2 条 VLL 价格。</p>                                                                                           |
| publicInterconnectNetmask | 否  | Integer                                                                                  | <p>公网互联块掩码。</p><p>非空时响应包含公网互联 IP 块价格。</p>                                                                                            |

## 3. 响应结果

| 参数名称                      | 类型                                                                 | 描述                                                          |
| ------------------------- | ------------------------------------------------------------------ | ----------------------------------------------------------- |
| requestId                 | String                                                             | <p>唯一请求 ID。</p><p>每次请求都会返回。定位问题时需要提供该次请求的 requestId。</p>    |
| privateConnectPrice       | [PriceItem](/api-reference/cn/ipt/datastructure.md#priceitem)      | <p>二层网络专线价格。</p><p>可能为空。</p>                                |
| iptBandwidthPrice         | [PriceItem](/api-reference/cn/ipt/datastructure.md#priceitem)      | IP Transit带宽价格。                                             |
| publicIpPrices            | Array of [IPPrice](/api-reference/cn/ipt/datastructure.md#ipprice) | 公网 IP 价格列表。                                                 |
| publicInterconnectIpPrice | [IPPrice](/api-reference/cn/ipt/datastructure.md#ipprice)          | <p>公网互联 IP 价格。</p><p>仅 publicInterconnectNetmask 非空时返回。</p> |

## 4. 代码示例

{% tabs %}
{% tab title="示例" %}
**1. 查询创建一条IP Transit，公网地址使用/25的CIDR。带宽限速为50Mbps, 计费方式为固定带宽。**

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

Request：
{
  "peerPortId": "your-port-id",
  "internetType": "ByBandwidth",
  "bandwidth": 50,
  "iptDcId": "AMS1",
  "routingType": "Static",
  "publicIPv4BlockSize": [
    25
  ]
}

Response：
{
    "requestId": "TBE062689-3CF2-429C-BD2A-6CB7BAB39C11",
    "response": {
        "publicIpPrices": [
            {
                "netmask": 25,
                "price": {
                    "unitPrice": 0.233334,
                    "originalPrice": null,
                    "discountPrice": null,
                    "discount": 100,
                    "stepPrices": null,
                    "discountUnitPrice": 0.233334,
                    "chargeUnit": "DAY",
                    "amountUnit": null
                },
                "qty": 1,
                "ipNetworkType": "BGP_IP"
            }
        ],
        "publicInterconnectIpPrice": null,
        "requestId": "TBE062689-3CF2-429C-BD2A-6CB7BAB39C11",
        "privateConnectPrice": {
            "unitPrice": 8.250000,
            "originalPrice": null,
            "discountPrice": null,
            "discount": 100,
            "stepPrices": null,
            "discountUnitPrice": 8.250000,
            "chargeUnit": "DAY",
            "amountUnit": null
        },
        "iptBandwidthPrice": {
            "unitPrice": 3.333334,
            "originalPrice": null,
            "discountPrice": null,
            "discount": 100,
            "stepPrices": null,
            "discountUnitPrice": 3.333334,
            "chargeUnit": "DAY",
            "amountUnit": null
        }
    }
}
```

**2. 使用 publicIpList 询价，指定购买 2 个 /28 IPv4 块。**

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

Request：
{
  "peerPortId": "your-port-id",
  "internetType": "ByBandwidth",
  "bandwidth": 100,
  "iptDcId": "AMS1",
  "routingType": "BGP",
  "publicIpList": [
    { "netmask": 28, "ipType": "IPV4", "ipNetworkType": "BGP_IP", "amount": 2 }
  ]
}

Response：
{
    "requestId": "TC1234567-ABCD-1234-EFGH-000000000020",
    "response": {
        "publicIpPrices": [
            {
                "netmask": 28,
                "price": {
                    "unitPrice": 0.233334,
                    "discountUnitPrice": 0.233334,
                    "chargeUnit": "DAY"
                },
                "qty": 1,
                "ipNetworkType": "BGP_IP"
            },
            {
                "netmask": 28,
                "price": {
                    "unitPrice": 0.233334,
                    "discountUnitPrice": 0.233334,
                    "chargeUnit": "DAY"
                },
                "qty": 1,
                "ipNetworkType": "BGP_IP"
            }
        ],
        "publicInterconnectIpPrice": null,
        "requestId": "TC1234567-ABCD-1234-EFGH-000000000020",
        "privateConnectPrice": {
            "unitPrice": 8.250000,
            "discountUnitPrice": 8.250000,
            "chargeUnit": "DAY"
        },
        "iptBandwidthPrice": {
            "unitPrice": 3.333334,
            "discountUnitPrice": 3.333334,
            "chargeUnit": "DAY"
        }
    }
}
```

{% endtab %}
{% endtabs %}

## 5. 开发者工具

Zenlayer Cloud API 2.0 提供了配套的[开发工具集（SDK）](/api-reference/cn/api-introduction/toolkit.md)，未来会陆续支持更多开发语言，方便快速接入和使用Zenlayer的产品和服务。

## 6. 错误码

下面包含业务逻辑中遇到的错误码，其他错误码见[公共错误码](/api-reference/cn/api-introduction/instruction/commonerrorcode.md)

| HTTP状态码 | 错误码                                            | 说明                                              |
| ------- | ---------------------------------------------- | ----------------------------------------------- |
| 404     | INVALID\_RIPT\_NOT\_SELLABLE                   | 该数据中心不支持远程 IP 隧道。                               |
| 403     | OPERATION\_DENIED\_ZBG\_RIPT\_SAME\_CITY       | ZBG 与 IPT 不能在同一城市。                              |
| 400     | INVALID\_RIPT\_PUBLIC\_IP\_ALLOCATION\_MISSING | `publicIPv4BlockSize` 与 `publicIpList` 至少需要传一个。 |
| 400     | INVALID\_RIPT\_BANDWIDTH\_LESS\_THAN\_COMMIT   | 95 计费下 `bandwidth` 必须大于等于 `commitBandwidth`。    |
