# InquiryPriceCreateInstance

## 1. API Description

This API (InquiryPriceCreateInstance) is used to query the price of creating an elastic compute instance.

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name          | Required | Type                                                                                                           | Description                                                                                                                                                                                                     |
| ----------------------- | -------- | -------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| zoneId                  | Yes      | String                                                                                                         | Zone ID to which the instance belongs.                                                                                                                                                                          |
| instanceType            | Yes      | String                                                                                                         | <p>Instance type.</p><p>Specific values can be obtained by calling the interface DescribeZoneInstanceConfigInfos .</p>                                                                                          |
| internetChargeType      | Yes      | [InternetChargeType](https://docs.console.zenlayer.com/api-reference/compute/datastructure#internetchargetype) | Network billing method.                                                                                                                                                                                         |
| instanceCount           | Yes      | Integer                                                                                                        | <p>Quantity.</p><p>Default value: 1.</p><p>Value range: \[1, 100]</p><p>Default value: 1</p>                                                                                                                    |
| systemDisk              | Yes      | [SystemDisk](https://docs.console.zenlayer.com/api-reference/compute/datastructure#systemdisk)                 | Boot disk.                                                                                                                                                                                                      |
| eipV4Type \[Deprecated] | No       | [EipNetworkType](https://docs.console.zenlayer.com/api-reference/compute/datastructure#eipnetworktype)         | <p>The network type of the public IPv4. Ensure that the stack type of the selected subnet supports IPv4.</p><p>ThreeLine are not currently supported.</p><p>Deprecated. Please use networkLineType instead.</p> |
| networkLineType         | No       | [NetworkLineType](https://docs.console.zenlayer.com/api-reference/compute/datastructure#networklinetype)       | <p>The network type of the public IPv4. Ensure that the stack type of the selected subnet supports IPv4.</p><p>ThreeLine are not currently supported.</p>                                                       |
| trafficPackageSize      | No       | Float                                                                                                          | <p>Data transfer package size (TB).</p><p>The unit is TB. The parameter is only required when internetChargeType is ByTrafficPackage .</p><p>Value range: \[0.0, +)</p>                                         |
| bandwidth               | No       | Integer                                                                                                        | <p>Outbound public network bandwidth cap (Mbps).</p><p>Unit: Mbps.</p><p>The value differs with different instance types.</p><p>Value range: \[1, +)</p>                                                        |
| dataDisk                | No       | [DataDisk](https://docs.console.zenlayer.com/api-reference/compute/datastructure#datadisk)                     | The size of the attached disk.                                                                                                                                                                                  |

## 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> |
| specPrice          | [PriceItem](https://docs.console.zenlayer.com/api-reference/compute/datastructure#priceitem) | Price of specifications.                                                                                              |
| gpuPrice           | [PriceItem](https://docs.console.zenlayer.com/api-reference/compute/datastructure#priceitem) | GPU price.                                                                                                            |
| ipv4Price          | [PriceItem](https://docs.console.zenlayer.com/api-reference/compute/datastructure#priceitem) | IPv4 price.                                                                                                           |
| ipv4BandwidthPrice | [PriceItem](https://docs.console.zenlayer.com/api-reference/compute/datastructure#priceitem) | Public network IPv4 bandwidth price.                                                                                  |
| ipv6Price          | [PriceItem](https://docs.console.zenlayer.com/api-reference/compute/datastructure#priceitem) | IPv6 price.                                                                                                           |
| ipv6BandwidthPrice | [PriceItem](https://docs.console.zenlayer.com/api-reference/compute/datastructure#priceitem) | Public network IPv6 bandwidth price.                                                                                  |
| systemDiskPrice    | [PriceItem](https://docs.console.zenlayer.com/api-reference/compute/datastructure#priceitem) | Price of the boot disk.                                                                                               |
| dataDiskPrice      | [PriceItem](https://docs.console.zenlayer.com/api-reference/compute/datastructure#priceitem) | The price of the attached disk.                                                                                       |

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**Query the price of a pay-as-you-go instance with the public network billing method of flat rate.**

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

Request:
{
    "zoneId":"SAO-A",
    "instanceType":"c.1c2g",
    "eipV4Type": "xxx",
    "internetChargeType":"ByBandwidth",
    "bandwidth":1,
    "instanceCount": 1,
    "systemDisk":{
        "diskSize":10
    }
}

Response:
{
    "requestId":"T03681166-F646-4F6A-AE6E-6CFF08DE60B3",
    "response":{
        "requestId":"T03681166-F646-4F6A-AE6E-6CFF08DE60B3",
        "specPrice": {
            "discount": 95.0,
            "discountPrice": 1444.0,
            "originalPrice": 1520.0,
            "unitPrice": null,
            "discountUnitPrice": null,
            "chargeUnit": null,
            "stepPrices": null
        },
        "gpuPrice": {
            "discount": 95.0,
            "discountPrice": 1444.0,
            "originalPrice": 1520.0,
            "unitPrice": null,
            "discountUnitPrice": null,
            "chargeUnit": null,
            "stepPrices": null
        },
        "ipv4Price": {
            "discount": 95.0,
            "discountPrice": 1444.0,
            "originalPrice": 1520.0,
            "unitPrice": null,
            "discountUnitPrice": null,
            "chargeUnit": null,
            "stepPrices": null
        },
        "ipv6Price": {
            "discount": 95.0,
            "discountPrice": 1444.0,
            "originalPrice": 1520.0,
            "unitPrice": null,
            "discountUnitPrice": null,
            "chargeUnit": null,
            "stepPrices": null
        },
        "ipv4BandwidthPrice": {
            "discount": 95.0,
            "discountPrice": 1444.0,
            "originalPrice": 1520.0,
            "unitPrice": null,
            "discountUnitPrice": null,
            "chargeUnit": null,
            "stepPrices": null
        },
        "ipv6BandwidthPrice": {
            "discount": 95.0,
            "discountPrice": 1444.0,
            "originalPrice": 1520.0,
            "unitPrice": null,
            "discountUnitPrice": null,
            "chargeUnit": null,
            "stepPrices": null
        },
        "systemDiskPrice": {
            "discount": 95.0,
            "discountPrice": 1444.0,
            "originalPrice": 1520.0,
            "unitPrice": null,
            "discountUnitPrice": null,
            "chargeUnit": null,
            "stepPrices": null
        },
        "dataDiskPrice": {
            "discount": 95.0,
            "discountPrice": 1444.0,
            "originalPrice": 1520.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                                        |
| ---------------- | ------------------------------------------------ | -------------------------------------------------- |
| 400              | INVALID\_DISK\_CATEGORY\_TYPE                    | Disk type error.                                   |
| 404              | INVALID\_INSTANCE\_TYPE\_NOT\_FOUND              | Instance type not found.                           |
| 404              | INVALID\_ZONE\_NOT\_FOUND                        | Region does not exist.                             |
| 400              | OPERATION\_DENIED\_EIP\_UNSUPPORT\_NETWORK\_TYPE | Elastic IP network billing model is not supported. |
