> 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/zec/instance/inquirypricecreateinstance.md).

# InquiryPriceCreateInstance

## 1. API Description

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

* When querying the price for a GPU instance, pass the `instanceType` field returned by [`DescribeZoneGpuInstanceConfigInfos`](/api-reference/compute/zec/instance/describezonegpuinstanceconfiginfos.md) to `instanceType`. In this case, `gpuPrice` in the response is the GPU instance type fee, and `specPrice`/`acceleratorPrice` are null.
* When querying the price for an accelerator instance, pass the `instanceType` field returned by [`DescribeZoneAcceleratorConfigInfos`](https://github.com/zenlayer/zenlayercloud-api-doc-en/tree/main/zec/instance/describezoneacceleratorconfiginfos.md) to `instanceType`. In this case, `acceleratorPrice` in the response is the accelerator instance type fee, and `specPrice`/`gpuPrice` are null.
* When querying the price for a standard instance, pass the `instanceType` field returned by [`DescribeZoneInstanceConfigInfos`](/api-reference/compute/zec/instance/describezoneinstanceconfiginfos.md) to `instanceType`. In this case, `specPrice` in the response is the instance type fee, and `gpuPrice`/`acceleratorPrice` are null.
* The size of the guaranteed traffic package is only valid for billing periods of one month.

## 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                                                                               | Instance type. For VM instances, the value can be obtained through [DescribeZoneInstanceConfigInfos](/api-reference/compute/zec/instance/describezoneinstanceconfiginfos.md). For GPU instances, the value can be obtained through [DescribeZoneGpuInstanceConfigInfos](/api-reference/compute/zec/instance/describezonegpuinstanceconfiginfos.md). |
| 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](/api-reference/compute/zec/datastructure.md#systemdisk)                 | Boot disk.                                                                                                                                                                                                                                                                                                                                          |
| eipV4Type \[Deprecated] | No       | [EipNetworkType](/api-reference/compute/zec/datastructure.md#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](/api-reference/compute/zec/datastructure.md#networklinetype)       | Network line type of the public IPv4. Required when `internetChargeType` is specified.                                                                                                                                                                                                                                                              |
| internetChargeType      | No       | [InternetChargeType](/api-reference/compute/zec/datastructure.md#internetchargetype) | Network billing method of the public IP. If not specified, the public IP price will not be queried.                                                                                                                                                                                                                                                 |
| 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](/api-reference/compute/zec/datastructure.md#datadisk)                     | Data disk information. Only 1 data disk can be configured here; to configure multiple data disks, use `dataDisks` instead. If both are specified, `dataDisks` takes precedence.                                                                                                                                                                     |
| dataDisks               | No       | Array of [DataDisk](/api-reference/compute/zec/datastructure.md#datadisk)            | Data disk information; supports multiple data disks. If not specified, falls back to `dataDisk`.                                                                                                                                                                                                                                                    |

## 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](/api-reference/compute/zec/datastructure.md#priceitem)                                            | Price of specifications.                                                                                                                                                                                                                                                                                                 |
| gpuPrice            | [PriceItem](/api-reference/compute/zec/datastructure.md#priceitem)                                            | GPU price.                                                                                                                                                                                                                                                                                                               |
| acceleratorPrice    | [PriceItem](/api-reference/compute/zec/datastructure.md#priceitem)                                            | Price of the accelerator instance type.                                                                                                                                                                                                                                                                                  |
| ipv4Price           | [PriceItem](/api-reference/compute/zec/datastructure.md#priceitem)                                            | The reserved price for public IPv4. Only returned when `internetChargeType` is specified.                                                                                                                                                                                                                                |
| ipv4BandwidthPrice  | [PriceItem](/api-reference/compute/zec/datastructure.md#priceitem)                                            | The bandwidth price for public IPv4. Only returned when `internetChargeType` is specified.                                                                                                                                                                                                                               |
| ipv4BandwidthPrices | Array of [BandwidthPriceResponseItem](/api-reference/compute/zec/datastructure.md#bandwidthpriceresponseitem) | <p>Detailed pricing for IPv4 bandwidth by traffic direction.</p><p>Only returned when <code>internetChargeType</code> has a value.</p><p>PathBasedBandwidthIP lines return multiple entries (ipv4BandwidthPrice is null); other lines have this field as null, with the bandwidth price given in ipv4BandwidthPrice.</p> |
| ipv6Price           | [PriceItem](/api-reference/compute/zec/datastructure.md#priceitem)                                            | The price for public IPv6. Only returned when `internetChargeType` is specified.                                                                                                                                                                                                                                         |
| ipv6BandwidthPrice  | [PriceItem](/api-reference/compute/zec/datastructure.md#priceitem)                                            | The bandwidth price for public IPv6. Only returned when `internetChargeType` is specified.                                                                                                                                                                                                                               |
| systemDiskPrice     | [PriceItem](/api-reference/compute/zec/datastructure.md#priceitem)                                            | Price of the boot disk.                                                                                                                                                                                                                                                                                                  |
| dataDiskPrice       | [PriceItem](/api-reference/compute/zec/datastructure.md#priceitem)                                            | The price of the data disk. Only returned when exactly 1 data disk is configured. See `dataDiskPrices` for the full price breakdown.                                                                                                                                                                                     |
| dataDiskPrices      | Array of [PriceItem](/api-reference/compute/zec/datastructure.md#priceitem)                                   | The price breakdown of data disks, corresponding one-to-one, in order, with `dataDisks` in the request.                                                                                                                                                                                                                  |

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**1. Query the price of creating an instance (without public IP).**

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

Request：
{
  "zoneId":"asia-east-1a",
  "instanceType":"z2a.cpu.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": null,
      "acceleratorPrice": null,
      "ipv4Price": null,
      "ipv4BandwidthPrice": null,
      "ipv4BandwidthPrices": null,
      "ipv6Price": null,
      "ipv6BandwidthPrice": null,
      "systemDiskPrice": {
          "discount": 95.0,
          "discountPrice": 1444.0,
          "originalPrice": 1520.0,
          "unitPrice": null,
          "discountUnitPrice": null,
          "chargeUnit": null,
          "stepPrices": null
      },
      "dataDiskPrice": null,
      "dataDiskPrices": null
  }
}
```

**2. Query the price of creating an instance (PremiumBGP line, billed by bandwidth).**

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

Request：
{
  "zoneId":"asia-east-1a",
  "instanceType":"z2a.cpu.1",
  "networkLineType": "PremiumBGP",
  "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": null,
      "acceleratorPrice": null,
      "ipv4Price": {
          "discount": 100,
          "discountPrice": null,
          "originalPrice": null,
          "unitPrice": 0.076389,
          "discountUnitPrice": 0.076389,
          "chargeUnit": "HOUR",
          "stepPrices": null
      },
      "ipv4BandwidthPrice": {
          "discount": 100,
          "discountPrice": null,
          "originalPrice": null,
          "unitPrice": 0.061112,
          "discountUnitPrice": 0.061112,
          "chargeUnit": "HOUR",
          "stepPrices": null
      },
      "ipv4BandwidthPrices": null,
      "ipv6Price": null,
      "ipv6BandwidthPrice": null,
      "systemDiskPrice": {
          "discount": 95.0,
          "discountPrice": 1444.0,
          "originalPrice": 1520.0,
          "unitPrice": null,
          "discountUnitPrice": null,
          "chargeUnit": null,
          "stepPrices": null
      },
      "dataDiskPrice": null,
      "dataDiskPrices": null
  }
}
```

**3. Query the price of creating an instance (PathBasedBandwidthIP line, billed by bandwidth). `ipv4BandwidthPrice` is null; see `ipv4BandwidthPrices` for the bandwidth price details.**

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

Request：
{
  "zoneId":"SEA-A",
  "instanceType":"c.1c2g",
  "networkLineType": "PathBasedBandwidthIP",
  "internetChargeType":"ByBandwidth",
  "bandwidth":1,
  "instanceCount": 1,
  "systemDisk":{
    "diskSize":10
  }
}

Response：
{
  "requestId":"T14792277-G757-5G7B-BF7G-7DGG19EF71C4",
  "response":{
      "requestId":"T14792277-G757-5G7B-BF7G-7DGG19EF71C4",
      "specPrice": {
          "discount": 95.0,
          "discountPrice": 1444.0,
          "originalPrice": 1520.0,
          "unitPrice": null,
          "discountUnitPrice": null,
          "chargeUnit": null,
          "stepPrices": null
      },
      "gpuPrice": null,
      "acceleratorPrice": null,
      "ipv4Price": {
          "discount": 100,
          "discountPrice": null,
          "originalPrice": null,
          "unitPrice": 0.076389,
          "discountUnitPrice": 0.076389,
          "chargeUnit": "HOUR",
          "stepPrices": null
      },
      "ipv4BandwidthPrice": null,
      "ipv4BandwidthPrices": [
          {
              "trafficType": "LOCAL",
              "price": {
                  "discount": 100,
                  "discountPrice": null,
                  "originalPrice": null,
                  "unitPrice": 0.042000,
                  "discountUnitPrice": 0.042000,
                  "chargeUnit": "HOUR",
                  "stepPrices": null
              }
          },
          {
              "trafficType": "INTERNATIONAL",
              "price": {
                  "discount": 100,
                  "discountPrice": null,
                  "originalPrice": null,
                  "unitPrice": 0.088000,
                  "discountUnitPrice": 0.088000,
                  "chargeUnit": "HOUR",
                  "stepPrices": null
              }
          }
      ],
      "ipv6Price": null,
      "ipv6BandwidthPrice": null,
      "systemDiskPrice": {
          "discount": 95.0,
          "discountPrice": 1444.0,
          "originalPrice": 1520.0,
          "unitPrice": null,
          "discountUnitPrice": null,
          "chargeUnit": null,
          "stepPrices": null
      },
      "dataDiskPrice": null,
      "dataDiskPrices": null
  }
}
```

**4. Query the price of creating an instance configured with multiple data disks. Here `dataDiskPrice` is null; see `dataDiskPrices` for the full price details.**

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

Request：
{
  "zoneId":"asia-east-1a",
  "instanceType":"z2a.cpu.1",
  "instanceCount": 1,
  "systemDisk":{
    "diskSize":10
  },
  "dataDisks":[
    {
      "diskSize":100,
      "diskCategory":"Standard NVMe SSD"
    },
    {
      "diskSize":200,
      "diskCategory":"Standard NVMe SSD"
    }
  ]
}

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": null,
      "acceleratorPrice": null,
      "ipv4Price": null,
      "ipv4BandwidthPrice": null,
      "ipv4BandwidthPrices": null,
      "ipv6Price": null,
      "ipv6BandwidthPrice": null,
      "systemDiskPrice": {
          "discount": 95.0,
          "discountPrice": 1444.0,
          "originalPrice": 1520.0,
          "unitPrice": null,
          "discountUnitPrice": null,
          "chargeUnit": null,
          "stepPrices": null
      },
      "dataDiskPrice": null,
      "dataDiskPrices": [
          {
              "discount": 95.0,
              "discountPrice": 144.0,
              "originalPrice": 152.0,
              "unitPrice": null,
              "discountUnitPrice": null,
              "chargeUnit": null,
              "stepPrices": null
          },
          {
              "discount": 95.0,
              "discountPrice": 288.0,
              "originalPrice": 304.0,
              "unitPrice": null,
              "discountUnitPrice": null,
              "chargeUnit": null,
              "stepPrices": null
          }
      ]
  }
}
```

**5. Query the price of creating an instance configured with only 1 data disk. Here both `dataDiskPrice` and `dataDiskPrices` return the price of that data disk.**

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

Request：
{
  "zoneId":"asia-east-1a",
  "instanceType":"z2a.cpu.1",
  "instanceCount": 1,
  "systemDisk":{
    "diskSize":10
  },
  "dataDisks":[
    {
      "diskSize":100,
      "diskCategory":"Standard NVMe SSD"
    }
  ]
}

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": null,
      "acceleratorPrice": null,
      "ipv4Price": null,
      "ipv4BandwidthPrice": null,
      "ipv4BandwidthPrices": null,
      "ipv6Price": null,
      "ipv6BandwidthPrice": null,
      "systemDiskPrice": {
          "discount": 95.0,
          "discountPrice": 1444.0,
          "originalPrice": 1520.0,
          "unitPrice": null,
          "discountUnitPrice": null,
          "chargeUnit": null,
          "stepPrices": null
      },
      "dataDiskPrice": {
          "discount": 95.0,
          "discountPrice": 144.0,
          "originalPrice": 152.0,
          "unitPrice": null,
          "discountUnitPrice": null,
          "chargeUnit": null,
          "stepPrices": null
      },
      "dataDiskPrices": [
          {
              "discount": 95.0,
              "discountPrice": 144.0,
              "originalPrice": 152.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                                                                                                    |
| ---------------- | -------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| 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\_UNSUPPORTED\_NETWORK\_TYPE             | The EIP network billing method is not supported.                                                               |
| 400              | OPERATION\_DENIED\_FLOW\_PACKAGE\_NOT\_SUPPORTED\_HOUR\_PERIOD | The current product cycle is based on hourly billing and does not support setting a minimum data package size. |
