# InquiryPriceCreateEipAddress

## 1. API Description

This API is used to query the price of creating elastic IP.

## 2. Input Parameters

The following request parameter list only provides API request parameters.

<table><thead><tr><th width="171.17578125">Parameter Name</th><th width="114.54296875">Required</th><th width="87.625">Type</th><th>Description</th></tr></thead><tbody><tr><td>zoneId</td><td>Yes</td><td>String</td><td>Zone ID to which the elastic IP belongs.</td></tr><tr><td>eipChargeType</td><td>Yes</td><td>String</td><td><p>Elastic IP <a href="https://docs.console.zenlayer.com/welcome/pricing/bare-metal-cloud-pricing/billing-method#elastic-ip">pricing model</a>.</p><p>PREPAID: subscription</p><p>POSTPAID: pay-as-you-go</p></td></tr><tr><td>eipChargePrepaid</td><td>No</td><td><a href="../../datastructure#chargeprepaid">ChargePrepaid</a></td><td>Details of the monthly subscription, including the purchase period, auto-renewal. It is required if the <code>eipChargeType</code> is <code>PREPAID</code>.</td></tr><tr><td>amount</td><td>No</td><td>Integer</td><td><p>Quantity of elastic IPs.</p><p>Value range: 1-100.</p><p>Default value: 1.</p></td></tr><tr><td>netmask</td><td>No</td><td>Integer</td><td><p>The CIDR block of the elastic IP.</p><p>You can call <a href="describeeipavailableresources">DescribeEipAvailableResources</a> to retrieve the list of supported values.</p><p>Valid values: <code>1</code> to <code>32</code>. Default value: <code>32</code>.</p></td></tr></tbody></table>

## 3. Output Parameters

| Parameter Name | Type                                                                                 | Description                                                                                              |
| -------------- | ------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------- |
| requestId      | String                                                                               | The unique request ID, which is returned for each request. RequestId is required for locating a problem. |
| eipPrice       | [Price](https://docs.console.zenlayer.com/api-reference/compute/datastructure#price) | Price of the elastic IP.                                                                                 |

## 4. Code Example

{% tabs %}
{% tab title="Example 1" %}
**Query the pay-as-you-go price of creating an elastic IP**

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

Request：
{
    "zoneId": "SEL-A"，
    "eipChargeType": "POSTPAID"
}

Response：
{
  "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
  "response": { 
    "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
    "eipPrice": {
      "discount": 100.0,
      "discountPrice": null,
      "originalPrice": null,
      "unitPrice": 0.63,
      "discountUnitPrice": 0.63,
      "chargeUnit": "HOUR",
      "stepPrices": null
    },
  }
}
```

{% endtab %}

{% tab title="Example 2" %}
**Query the subscription price of creating two elastic IPs**

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

Request：
{
    "zoneId": "SEL-A"，
    "eipChargeType": "PREPAID",
    "eipChargePrepaid" {
        "period": 1
    },
    "amount": 2
}

Response：
{
  "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
  "response": { 
    "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3"，
    "eipPrice": {
        "discount": 95.0,
        "discountPrice": 426.55,
        "originalPrice": 449.0,
        "unitPrice": null,
        "discountUnitPrice": null,
        "chargeUnit": null,
        "stepPrices": null
    },
  }
}
```

{% endtab %}
{% endtabs %}

## 5. Developer Resources

Zenlayer Cloud API 2.0 integrates [SDKs](https://docs.console.zenlayer.com/api-reference/api-introduction/toolkit/api-sdk) 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).​

| HTTP Status Code | Error Code                         | Description                                 |
| ---------------- | ---------------------------------- | ------------------------------------------- |
| 404              | INVALID\_ZONE\_NOT\_FOUND          | Zone does not exist.                        |
| 400              | INVALID\_EIP\_TYPE\_ZONE\_NO\_SELL | Elastic IPs not available for sale in zone. |
| 400              | MISSING\_PARAMETER                 | The parameter is empty.                     |
