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

# InquiryModifyIPTransitPrice

## 1. 接口描述

本接口(InquiryModifyIPTransitPrice)用于IP Transit变配询价。

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

* BFD、BGP 相关操作（`BFD`、`BGP_ROUTE_TYPE`、`BGP_ASN_AS_SET`、`BGP_PASSWORD`）以及 HA 切换操作（`HA_SWITCH_PRIMARY`、`HA_SWITCH_MODE`）不涉及计价变化，传入此接口会返回 `INVALID_RIPT_CONFIG_TYPE_NO_PRICE_CHANGE` 错误，无需询价可直接调用 `ModifyIPTransitConfig`。
* `type=BANDWIDTH` 时须传 `bandwidth`，返回 `privateConnectPrice`（专线价格）和 `iptPrice`（带宽价格）。
* 95 计费（`internetType=ByInstanceBandwidth95`）的 IP Transit，价格只由 `commitBandwidth` 决定：`type=BANDWIDTH` 时必须显式传入 `commitBandwidth`，不能用 `bandwidth` 代替；若 `commitBandwidth` 相比当前值未变化，价格不变，会返回 `INVALID_RIPT_CONFIG_TYPE_NO_PRICE_CHANGE` 错误，无需询价可直接调用 `ModifyIPTransitConfig`。`bandwidth` 必须大于等于 `commitBandwidth`，否则返回 `INVALID_RIPT_BANDWIDTH_LESS_THAN_COMMIT` 错误。
* `type=ADD_CIDR_BLOCK` 或 `EXPAND_CIDR_BLOCK` 时须传 `publicIPv4BlockSize`，返回 `iptIpPrices`（公网 IP 块价格）。普通 BGP 档位（`bgp.tier=STANDARD`）的 IP Transit 不支持 `ADD_CIDR_BLOCK`，否则返回 `OPERATION_DENIED_STANDARD_BGP_ADD_CIDR` 错误。
* `type=DEL_CIDR_BLOCK` 或 `SHRINK_CIDR_BLOCK` 时须传 `ipUuid`，表示退订或缩减的目标 IP 块。
  {% endhint %}

## 2. 请求参数

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

| 参数名称                | 必选 | 类型                                                                                      | 描述                                                                                                                                                                         |
| ------------------- | -- | --------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| iptId               | 是  | String                                                                                  | IP Transit 实例 ID。                                                                                                                                                          |
| type                | 是  | [IPTransitConfigType](/api-reference/cn/ipt/datastructure.md#iptransitconfigtype)       | <p>变配类型。</p><p>支持 BANDWIDTH、ADD\_CIDR\_BLOCK、DEL\_CIDR\_BLOCK、EXPAND\_CIDR\_BLOCK、SHRINK\_CIDR\_BLOCK，BFD/BGP/HA 操作无费用，不允许传入。</p>                                          |
| bandwidth           | 否  | Integer                                                                                 | <p>目标带宽（Mbps）。</p><p>type=BANDWIDTH 时必填。</p><p>95 计费下必须大于等于 <code>commitBandwidth</code>。</p><p>可选值范围：\[5, +)</p>                                                          |
| commitBandwidth     | 否  | Integer                                                                                 | <p>保底带宽（Mbps）。</p><p>type=BANDWIDTH 时有效，不填则与 <code>bandwidth</code> 相同；95 计费（internetType=ByInstanceBandwidth95）下必填，不能用 <code>bandwidth</code> 代替。</p><p>可选值范围：\[5, +)</p> |
| publicIPv4BlockSize | 否  | Integer                                                                                 | <p>IPv4 CIDR 掩码长度（24–32）。</p><p>type=ADD\_CIDR\_BLOCK、EXPAND\_CIDR\_BLOCK、SHRINK\_CIDR\_BLOCK 时必填。</p>                                                                     |
| ipUuid              | 否  | String                                                                                  | <p>目标 IP 块 UUID。</p><p>type=DEL\_CIDR\_BLOCK、EXPAND\_CIDR\_BLOCK、SHRINK\_CIDR\_BLOCK 时必填。</p>                                                                              |
| ipNetworkType       | 否  | [IPTransitIpNetworkType](/api-reference/cn/ipt/datastructure.md#iptransitipnetworktype) | <p>IP 网络类型。</p><p>type=ADD\_CIDR\_BLOCK 时有效，默认 BGP\_IP。</p>                                                                                                                |
| marketingInfo       | 否  | [MarketingInfo](/api-reference/cn/ipt/datastructure.md#marketinginfo)                   | <p>市场活动相关信息，含是否使用 POC 代金券。</p><p>type=ADD\_CIDR\_BLOCK 时有效；询价口径需与实际下单一致。</p>                                                                                               |

## 3. 响应结果

| 参数名称                      | 类型                                                                                           | 描述                                                                      |
| ------------------------- | -------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| requestId                 | String                                                                                       | <p>唯一请求 ID。</p><p>每次请求都会返回。定位问题时需要提供该次请求的 requestId。</p>                |
| privateConnectPrice       | [PriceItem](/api-reference/cn/ipt/datastructure.md#priceitem)                                | <p>专线（VLL）价格。</p><p>BANDWIDTH 类型时可能有值，Router RIPT 为空。</p>               |
| privateConnectBandwidth   | Integer                                                                                      | <p>专线带宽（Mbps）。</p><p>BANDWIDTH 类型时有值。</p>                               |
| iptPrice                  | [PriceItem](/api-reference/cn/ipt/datastructure.md#priceitem)                                | RIPT 带宽价格。                                                              |
| iptIpPrices               | Array of [IPTransitIpPriceItem](/api-reference/cn/ipt/datastructure.md#iptransitippriceitem) | <p>公网 CIDR 块价格列表。</p><p>ADD\_CIDR\_BLOCK、EXPAND\_CIDR\_BLOCK 类型时有值。</p> |
| publicInterconnectIpPrice | [IPTransitIpPriceItem](/api-reference/cn/ipt/datastructure.md#iptransitippriceitem)          | <p>公网互联块价格。</p><p>启用公网互联时填充，否则为空。</p>                                   |

## 4. 代码示例

{% tabs %}
{% tab title="示例" %}
**1. 查询将带宽升级至 200Mbps 的费用。**

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

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

Response：
{
  "requestId": "T12345678-ABCD-1234-EFGH-000000000002",
  "response": {
    "requestId": "T12345678-ABCD-1234-EFGH-000000000002",
    "privateConnectPrice": {
      "unitPrice": 8.250000,
      "originalPrice": null,
      "discountPrice": null,
      "discount": 100,
      "stepPrices": null,
      "discountUnitPrice": 8.250000,
      "chargeUnit": "DAY",
      "amountUnit": null
    },
    "privateConnectBandwidth": 200,
    "iptPrice": {
      "unitPrice": 6.666668,
      "originalPrice": null,
      "discountPrice": null,
      "discount": 100,
      "stepPrices": null,
      "discountUnitPrice": 6.666668,
      "chargeUnit": "DAY",
      "amountUnit": null
    },
    "iptIpPrices": null,
    "publicInterconnectIpPrice": null
  }
}
```

**2. 查询新增一个 /28 公网 IPv4 CIDR 块的费用。**

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

Request：
{
  "iptId": "your-ipt-id",
  "type": "ADD_CIDR_BLOCK",
  "publicIPv4BlockSize": 28
}

Response：
{
  "requestId": "T12345678-ABCD-1234-EFGH-000000000003",
  "response": {
    "requestId": "T12345678-ABCD-1234-EFGH-000000000003",
    "privateConnectPrice": null,
    "privateConnectBandwidth": null,
    "iptPrice": null,
    "iptIpPrices": [
      {
        "netmask": 28,
        "amount": 1,
        "ipNetworkType": "BGP_IP",
        "price": {
          "unitPrice": 0.233334,
          "originalPrice": null,
          "discountPrice": null,
          "discount": 100,
          "stepPrices": null,
          "discountUnitPrice": 0.233334,
          "chargeUnit": "DAY",
          "amountUnit": null
        }
      }
    ],
    "publicInterconnectIpPrice": null
  }
}
```

{% 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状态码 | 错误码                                            | 说明                                           |
| ------- | ---------------------------------------------- | -------------------------------------------- |
| 400     | INVALID\_RIPT\_CONFIG\_TYPE\_NO\_PRICE\_CHANGE | 该配置类型不涉及价格变更，无需调用此询价接口。                      |
| 400     | INVALID\_RIPT\_BANDWIDTH\_LESS\_THAN\_COMMIT   | 95 计费下 `bandwidth` 必须大于等于 `commitBandwidth`。 |
| 404     | INVALID\_RIPT\_NOT\_FOUND                      | 远程 IP 隧道实例不存在。                               |
| 403     | OPERATION\_DENIED\_STANDARD\_BGP\_ADD\_CIDR    | 普通 BGP 档位的 IP Transit 不支持新增公网 IP。            |
