> 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/zec/elastic-ip/describeeipprice.md).

# DescribeEipPrice

## 1. 接口描述

本接口(DescribeEipPrice)用于查询创建弹性公网IP的价格。

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

* 保底流量包大小仅对计费周期为月有效。
  {% endhint %}

## 2. 请求参数

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

| 参数名称               | 必选 | 类型                                                                              | 描述                                                                                                                                                                    |
| ------------------ | -- | ------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| regionId           | 是  | String                                                                          | <p>创建EIP所在的节点ID。</p><p>可通过调用 <a href="/api-reference/cn/zec/location/describeregions.md">DescribeRegions</a> 获取。</p>                                                  |
| internetChargeType | 是  | [InternetChargeType](/api-reference/cn/zec/datastructure.md#internetchargetype) | 公网弹性IP的网络计费方式。                                                                                                                                                        |
| amount             | 否  | Integer                                                                         | <p>需要创建EIP的数量。</p><p>可选值范围：\[1, +)</p><p>默认值：1</p>                                                                                                                    |
| eipV4Type \[已废弃]   | 否  | [EipNetworkType](/api-reference/cn/zec/datastructure.md#eipnetworktype)         | <p>公网弹性IP的线路类型。</p><p>已废弃，请使用<code>networkLineType</code>。</p>                                                                                                        |
| networkLineType    | 否  | [NetworkLineType](/api-reference/cn/zec/datastructure.md#networklinetype)       | 公网弹性IP的线路类型。                                                                                                                                                          |
| bandwidth          | 否  | Integer                                                                         | <p>公网弹性IP的带宽限速。</p><p>单位：Mbps。</p><p>可选值范围：\[1, +)</p>                                                                                                                |
| flowPackage        | 否  | Float                                                                           | <p>弹性公网IP的流量包大小。</p><p>单位为TB。</p><p>值要求为0或0.1的倍数。</p><p>当网络计费方式为流量计费(<code>ByTrafficPackage</code>)时需要指定。</p><p>可选值范围：\[0.0, +)</p>                                   |
| cidrId             | 否  | String                                                                          | <p>指定CIDR ID，使用CIDR内分配弹性IP。</p><p>该字段和<code>eipV4Type</code>不能同时指定。</p><p>可通过调用 <a href="/api-reference/cn/zec/cidr-block/describecidrs.md">DescribeCidrs</a> 获取。</p> |
| clusterId          | 否  | String                                                                          | <p>共享带宽包ID。</p><p>当指定<code>peerRegionId</code>且网络计费方式为共享带宽包计费(<code>BandwidthCluster</code>)时需要指定。</p>                                                                |
| peerRegionId       | 否  | String                                                                          | 远端的节点ID。                                                                                                                                                              |

## 3. 响应结果

| 参数名称                 | 类型                                                                                                       | 描述                                                                                                    |
| -------------------- | -------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| requestId            | String                                                                                                   | <p>唯一请求 ID。</p><p>每次请求都会返回。定位问题时需要提供该次请求的 requestId。</p>                                              |
| eipPrice             | [PriceItem](/api-reference/cn/zec/datastructure.md#priceitem)                                            | <p>公网弹性IP的保留价格。</p><p>如果是通过cidr创建，则保留价格为null。</p>                                                     |
| bandwidthPrice       | [PriceItem](/api-reference/cn/zec/datastructure.md#priceitem)                                            | 公网弹性IP的带宽价格。                                                                                          |
| bandwidthPrices      | Array of [BandwidthPriceResponseItem](/api-reference/cn/zec/datastructure.md#bandwidthpriceresponseitem) | <p>各流量方向的带宽价格明细。</p><p>PathBasedBandwidthIP线路返回多项（bandwidthPrice为null）；其他线路返回单项（trafficType=ALL）。</p> |
| remoteBandwidthPrice | [PriceItem](/api-reference/cn/zec/datastructure.md#priceitem)                                            | Remote IPT的带宽价格。                                                                                      |

## 4. 代码示例

{% tabs %}
{% tab title="示例" %}
**1. 查询一个BGP公网IP的价格，网络计费采用流量包计费。流量包大小为10TB。**

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

Request：
{
  "regionId": "asia-east-1",
  "amount": 1,
  "internetChargeType": "ByTrafficPackage",
  "networkLineType": "PremiumBGP",
  "bandwidth": 50,
  "flowPackage": 10
}


Response：
{
  "requestId": "TBFC01FCF-6439-4530-ADBC-16809F0C3E8F",
  "response": {
    "requestId": "TBFC01FCF-6439-4530-ADBC-16809F0C3E8F",
    "eipPrice": {
      "discount": 95.0,
      "discountPrice": 100.0,
      "originalPrice": 100.0,
      "unitPrice": null,
      "discountUnitPrice": null,
      "chargeUnit": null,
      "stepPrices": null
    },
    "bandwidthPrice": {
      "discount": 95.0,
      "discountPrice": 100.0,
      "originalPrice": 100.0,
      "unitPrice": null,
      "discountUnitPrice": null,
      "chargeUnit": null,
      "stepPrices": null
    },
    "bandwidthPrices": [
      {
        "trafficType": "ALL",
        "price": {
          "discount": 95.0,
          "discountPrice": 100.0,
          "originalPrice": 100.0,
          "unitPrice": null,
          "discountUnitPrice": null,
          "chargeUnit": null,
          "stepPrices": null
        }
      }
    ],
    "remoteBandwidthPrice": null
  }
}
```

**2. 查询一个PathBasedBandwidthIP的价格，网络计费采用按带宽计费，带宽50Mbps。境内和境外带宽分别返回价格，bandwidthPrice为null。**

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

Request：
{
  "regionId": "asia-east-1",
  "amount": 1,
  "internetChargeType": "ByBandwidth",
  "networkLineType": "PathBasedBandwidthIP",
  "bandwidth": 50
}


Response：
{
  "requestId": "TBFC01FCF-6439-4530-ADBC-16809F0C3E8F",
  "response": {
    "requestId": "TBFC01FCF-6439-4530-ADBC-16809F0C3E8F",
    "eipPrice": {
      "discount": 95.0,
      "discountPrice": 100.0,
      "originalPrice": 100.0,
      "unitPrice": null,
      "discountUnitPrice": null,
      "chargeUnit": null,
      "stepPrices": null
    },
    "bandwidthPrice": null,
    "bandwidthPrices": [
      {
        "trafficType": "LOCAL",
        "price": {
          "discount": 100.0,
          "discountPrice": 80.0,
          "originalPrice": 80.0,
          "unitPrice": null,
          "discountUnitPrice": null,
          "chargeUnit": null,
          "stepPrices": null
        }
      },
      {
        "trafficType": "INTERNATIONAL",
        "price": {
          "discount": 100.0,
          "discountPrice": 120.0,
          "originalPrice": 120.0,
          "unitPrice": null,
          "discountUnitPrice": null,
          "chargeUnit": null,
          "stepPrices": null
        }
      }
    ],
    "remoteBandwidthPrice": 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     | OPERATION\_DENIED\_EIP\_NETWORK\_LINE\_TYPE\_NOT\_ON\_SALE     | IP线路类型在该节点不可售。            |
| 400     | OPERATION\_DENIED\_EIP\_INTERNET\_CHARGE\_TYPE\_NOT\_AVAILABLE | 该节点下指定IP线路类型不支持此网络计费方式。   |
| 400     | OPERATION\_DENIED\_INTERNET\_CHARGE\_TYPE\_NOT\_SUPPORT        | IP网络计费方式不支持。              |
| 400     | INVALID\_PREFIX\_LENGTH\_OUT\_OF\_RANGE                        | EIP掩码长度不合法。               |
| 400     | OPERATION\_DENIED\_FLOW\_PACKAGE\_NOT\_SUPPORTED\_HOUR\_PERIOD | 当前产品周期为小时计费，不支持设置保底流量包大小。 |
