# InquiryPriceCreateInstance

## 1. API Description

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

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name          | Required | Type                                                                                 | Description                                                                                                                                                                                                                            |
| ----------------------- | -------- | ------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| zoneId                  | Yes      | String                                                                               | Zone ID of the instance.                                                                                                                                                                                                               |
| instanceTypeId          | Yes      | String                                                                               | <p>Instance model ID.</p><p>To view specific values, you can call DescribeInstanceTypes .</p>                                                                                                                                          |
| instanceChargeType      | Yes      | [ChargeType](/api-reference/compute/bmc/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/bmc/datastructure.md#internetchargetype) | Network pricing model.                                                                                                                                                                                                                 |
| instanceChargePrepaid   | No       | [ChargePrepaid](/api-reference/compute/bmc/datastructure.md#chargeprepaid)           | Details of the monthly subscription, including the purchase period, auto-renewal. It is required if the `chargeType` is `PREPAID`.                                                                                                     |
| trafficPackageSize      | No       | Float                                                                                | <p>Traffic package size (TB).</p><p>The parameter is valid only when internetChargeType is ByTrafficPackage .</p><p>If not passed in, the default value will be the size of the free traffic package.</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.</p><p>Value range: \[0, +)</p><p>Default value: 1</p>                                             |

## 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/bmc/datastructure.md#priceitem)          | Price of the instance.                                                                                                                                          |
| bandwidthPrice | Array of [PriceItem](/api-reference/compute/bmc/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> |
| primaryIpPrice | [PriceItem](/api-reference/compute/bmc/datastructure.md#priceitem)          | Price of the primary IP.                                                                                                                                        |

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**Query the price of a subscription instance with the billing method of flat rate**

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

Request:
{
  "zoneId": "SEL-A",
  "instanceTypeId": "M6C",
  "instanceChargeType": "PREPAID",
  "instanceChargePrepaid": {
    "period": 1
  },
  "trafficPackageSize": 100,
  "internetMaxBandwidthOut": 200,
  "internetChargeType": "ByBandwidth"
}

Response:
{
  "requestId": "T01F25348-DA67-4726-97C1-538BAE714F8B",
  "response": {
    "requestId": "T01F25348-DA67-4726-97C1-538BAE714F8B",
    "instancePrice": {
      "discount": 95.0,
      "discountPrice": 426.55,
      "originalPrice": 449.0,
      "unitPrice": null,
      "discountUnitPrice": null,
      "chargeUnit": null,
      "stepPrices": null
    },
    "bandwidthPrice": [
      {
        "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](/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 type not found.                                                          |
| 403              | INVALID\_CHARGE\_TYPE\_NOT\_SUPPORT          | The current account does not support the specified pricing model.                 |
| 400              | INVALID\_INSTANCE\_BANDWIDTH\_ZONE\_NO\_SELL | The specified public network billing model is not supported in the selected zone. |
| 400              | INVALID\_INSTANCE\_TYPE\_ZONE\_NO\_SELL      | Traffic package of the specified instance is not currently available for sale.    |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.console.zenlayer.com/api-reference/compute/bmc/bare-metal-instance/inquirypricecreateinstance.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
