> 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/compute/vm/virtual-machine-instance/inquirypricecreateinstance.md).

# InquiryPriceCreateInstance

## 1. API Description

This API (InquiryPriceCreateInstance) is used to query the price of creating a virtual machine instance.

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name          | Required | Type                                                                                | Description                                                                                                                                                                                                                         |
| ----------------------- | -------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| zoneId                  | Yes      | String                                                                              | ID of zone to which the instance belongs.                                                                                                                                                                                           |
| instanceType            | Yes      | String                                                                              | <p>Instance model.</p><p>To view specific values, you can call DescribeZoneInstanceConfigInfos.</p>                                                                                                                                 |
| instanceChargeType      | Yes      | [ChargeType](/api-reference/compute/vm/datastructure.md#chargetype)                 | <p>Instance pricing model.</p><p>PREPAID: subscription</p><p>POSTPAID: pay-as-you-go.</p>                                                                                                                                           |
| internetChargeType      | Yes      | [InternetChargeType](/api-reference/compute/vm/datastructure.md#internetchargetype) | <p>Network pricing model.</p><p>See InternetChargeType for details.</p>                                                                                                                                                             |
| instanceCount           | Yes      | Integer                                                                             | <p>The number of instances to be purchased.</p><p>Value range: \[1, 100]</p><p>Default value: 1</p>                                                                                                                                 |
| systemDisk              | Yes      | [SystemDisk](/api-reference/compute/vm/datastructure.md#systemdisk)                 | System disk.                                                                                                                                                                                                                        |
| imageId                 | No       | String                                                                              | Image ID.                                                                                                                                                                                                                           |
| instanceChargePrepaid   | No       | [ChargePrepaid](/api-reference/compute/vm/datastructure.md#chargeprepaid)           | Details of the monthly subscription, including the purchase period, auto-renewal. It is required if the instanceChargeType is PREPAID.                                                                                              |
| instanceChargePostpaid  | No       | [ChargePostpaid](/api-reference/compute/vm/datastructure.md#chargepostpaid)         | Postpaid mode parameter settings.                                                                                                                                                                                                   |
| trafficPackageSize      | No       | Float                                                                               | <p>Traffic package size (TB).</p><p>The parameter is valid only when internetChargeType is ByTrafficPackage.</p><p>Value range: \[0.0, +)</p>                                                                                       |
| internetMaxBandwidthOut | No       | Integer                                                                             | <p>Public network bandwidth cap (Mbps).</p><p>Default value: 1 Mbps.</p><p>The parameter value differs by different instance models. See bandwidth configuration for details.</p><p>Value range: \[1, +)</p><p>Default value: 1</p> |
| dataDisks               | No       | Array of [DataDisk](/api-reference/compute/vm/datastructure.md#datadisk)            | Data 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>                                                                             |
| instancePrice   | [PriceItem](/api-reference/compute/vm/datastructure.md#priceitem)          | Instance price.                                                                                                                                                                                   |
| bandwidthPrice  | Array of [PriceItem](/api-reference/compute/vm/datastructure.md#priceitem) | <p>Price of public bandwidth.</p><p>Kinds of prices may exist. For example, traffic package billing method may contain the package price and overage price.</p>                                   |
| eipPrice        | [PriceItem](/api-reference/compute/vm/datastructure.md#priceitem)          | Price of the elastic IP.                                                                                                                                                                          |
| systemDiskPrice | [PriceItem](/api-reference/compute/vm/datastructure.md#priceitem)          | System disk price.                                                                                                                                                                                |
| dataDiskPrice   | [PriceItem](/api-reference/compute/vm/datastructure.md#priceitem)          | <p>Price of data disks.</p><p>When query prices of data disks with different specifications, only discountPrice and originalPrice are valid.</p>                                                  |
| dataDiskPrices  | Array of [DataDisk](/api-reference/compute/vm/datastructure.md#datadisk)   | <p>Prices of data disks with different specifications</p><p>This parameter corresponds to the dataDisks in the input parameter. The similar values will be merged based on size and category.</p> |

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**Query the price of a subscription 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",
    "imageId":"img-yKK4q6XybymPgfx7ynUUqC3N8",
    "instanceChargeType":"PREPAID",
    "internetChargeType":"ByBandwidth",
    "instanceChargePrepaid":{
        "period":1
    },
    "internetMaxBandwidthOut":1,
    "systemDisk":{
        "diskSize":10
    }
}

Response:
{
    "requestId":"T03681166-F646-4F6A-AE6E-6CFF08DE60B3",
    "response":{
        "requestId":"T03681166-F646-4F6A-AE6E-6CFF08DE60B3",
        "instancePrice":{
            "discount":95,
            "discountPrice":13.3,
            "originalPrice":14
        },
        "bandwidthPrice":[
            {
                "discount":95,
                "discountPrice":3.8,
                "originalPrice":4
            }
        ],
        "systemDiskPrice":{
            "discount":96,
            "discountPrice":0.48,
            "originalPrice":0.5
        }
    }
}

```

{% endtab %}
{% endtabs %}

## 5. Developer Resources

Zenlayer Cloud API 2.0 integrates [SDKs](/api-reference/api-introduction/toolkit/api-sdk.md)，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](/api-reference/api-introduction/instruction/commonerrorcode.md).

| HTTP Status Code | Error Code                                   | Description                                             |
| ---------------- | -------------------------------------------- | ------------------------------------------------------- |
| 404              | INVALID\_ZONE\_NOT\_FOUND                    | Zone not found.                                         |
| 404              | INVALID\_INSTANCE\_TYPE\_NOT\_FOUND          | Instance model not found.                               |
| 400              | INVALID\_INSTANCE\_TYPE\_ZONE\_NO\_SELL      | Instance model not available in the zone.               |
| 400              | INVALID\_INSTANCE\_BANDWIDTH\_ZONE\_NO\_SELL | Public network pricing model not supported in zhe zone. |
| 400              | INVALID\_PARAMETER\_TRAFFIC\_PACKAGE         | Invalid data transfer package size.                     |
| 400              | INVALID\_PARAMETER\_TRAFFIC\_PACKAGE\_EXCEED | Data transfer package size exceeds the upper limit.     |
