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

# InquiryPriceModifyInstanceType

## 1. API Description

This API (InquiryPriceModifyInstanceType) is used to inquire the price after changing the instance type. The currently effective price of each billing item before the change is also returned through previousPrices, so that you can compare which billing items have price changes.

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name | Required | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                         |
| -------------- | -------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| instanceId     | Yes      | String | <p>ID of the instance whose instance type is to be changed.</p><p>It can be obtained by calling <a href="/api-reference/zec/instance/describeinstances.md">DescribeInstances</a>.</p>                                                                                                                                                                                                               |
| instanceType   | Yes      | String | <p>Target instance type to change to.</p><p>The value for a regular instance can be obtained through <a href="/api-reference/zec/instance/describezoneinstanceconfiginfos.md">DescribeZoneInstanceConfigInfos</a>, and the value for a GPU instance can be obtained through <a href="/api-reference/zec/instance/describezonegpuinstanceconfiginfos.md">DescribeZoneGpuInstanceConfigInfos</a>.</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>                                                                                                                     |
| specPrice        | [PriceItem](/api-reference/zec/datastructure.md#priceitem)                                   | <p>Price of the instance type after the change.</p><p>It is returned when the instance type of a VM instance is changed, and is null when the instance type of a GPU or accelerator instance is changed.</p>                              |
| gpuPrice         | [PriceItem](/api-reference/zec/datastructure.md#priceitem)                                   | <p>Price of the GPU instance type after the change.</p><p>It is returned when the instance type of a GPU instance is changed, and is null when the instance type of a VM or accelerator instance is changed.</p>                          |
| acceleratorPrice | [PriceItem](/api-reference/zec/datastructure.md#priceitem)                                   | <p>Price of the accelerator instance type after the change.</p><p>It is returned when the instance type of an accelerator instance is changed, and is null when the instance type of a VM or GPU instance is changed.</p>                 |
| systemDiskPrice  | [PriceItem](/api-reference/zec/datastructure.md#priceitem)                                   | Price of the system disk.                                                                                                                                                                                                                 |
| previousPrices   | [InstanceTypePreviousPrices](/api-reference/zec/datastructure.md#instancetypepreviousprices) | <p>Currently effective price of each billing item before the change. The fields correspond one by one to those above and are used to compare which billing items have price changes.</p><p>It is null when the instance has no order.</p> |

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**Query the price after changing the instance type. A VM instance returns specPrice, a GPU instance returns gpuPrice, and an accelerator instance returns acceleratorPrice.**

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

Request (VM instance):
{
  "instanceId": "instanceId-xxx",
  "instanceType": "z2a.cpu.1"
}

Response (VM instance):
{
  "requestId": "T12345678-A123-4B5C-DE67-8F9G01234567",
  "response": {
    "requestId": "T12345678-A123-4B5C-DE67-8F9G01234567",
    "specPrice": {
      "discount": 95.0,
      "discountPrice": 1444.0,
      "originalPrice": 1520.0,
      "unitPrice": null,
      "discountUnitPrice": null,
      "chargeUnit": null,
      "stepPrices": null
    },
    "gpuPrice": null,
    "acceleratorPrice": null,
    "systemDiskPrice": {
      "discount": 100.0,
      "discountPrice": 20.0,
      "originalPrice": 20.0,
      "unitPrice": null,
      "discountUnitPrice": null,
      "chargeUnit": null,
      "stepPrices": null
    },
    "previousPrices": {
      "specPrice": {
        "discount": 100.0,
        "discountPrice": 1200.0,
        "originalPrice": 1200.0,
        "unitPrice": null,
        "discountUnitPrice": null,
        "chargeUnit": null,
        "stepPrices": null
      },
      "gpuPrice": null,
      "acceleratorPrice": null,
      "systemDiskPrice": {
        "discount": 100.0,
        "discountPrice": 20.0,
        "originalPrice": 20.0,
        "unitPrice": null,
        "discountUnitPrice": null,
        "chargeUnit": null,
        "stepPrices": null
      }
    }
  }
}

In the example above, the specification price changes from 1200.0 to 1444.0 (with a new 5% discount) while the system disk remains the same, which means only the specification has a price change.

Request (GPU instance):
{
  "instanceId": "instanceId-yyy",
  "instanceType": "z3a.g.C49.c8m32.1"
}

Response (GPU instance):
{
  "requestId": "T12345678-A123-4B5C-DE67-8F9G01234568",
  "response": {
    "requestId": "T12345678-A123-4B5C-DE67-8F9G01234568",
    "specPrice": null,
    "gpuPrice": {
      "discount": 100.0,
      "discountPrice": 3000.0,
      "originalPrice": 3000.0,
      "unitPrice": null,
      "discountUnitPrice": null,
      "chargeUnit": null,
      "stepPrices": null
    },
    "acceleratorPrice": null,
    "systemDiskPrice": {
      "discount": 100.0,
      "discountPrice": 20.0,
      "originalPrice": 20.0,
      "unitPrice": null,
      "discountUnitPrice": null,
      "chargeUnit": null,
      "stepPrices": null
    },
    "previousPrices": {
      "specPrice": null,
      "gpuPrice": {
        "discount": 100.0,
        "discountPrice": 2500.0,
        "originalPrice": 2500.0,
        "unitPrice": null,
        "discountUnitPrice": null,
        "chargeUnit": null,
        "stepPrices": null
      },
      "acceleratorPrice": null,
      "systemDiskPrice": {
        "discount": 100.0,
        "discountPrice": 18.0,
        "originalPrice": 18.0,
        "unitPrice": null,
        "discountUnitPrice": null,
        "chargeUnit": null,
        "stepPrices": null
      }
    }
  }
}

In the example above, both the GPU specification and the system disk billing items have price changes, so each of them needs to be displayed.

Request (accelerator instance):
{
  "instanceId": "instanceId-zzz",
  "instanceType": "z2a.v.T1U.c16m64.1"
}

Response (accelerator instance):
{
  "requestId": "T12345678-A123-4B5C-DE67-8F9G01234569",
  "response": {
    "requestId": "T12345678-A123-4B5C-DE67-8F9G01234569",
    "specPrice": null,
    "gpuPrice": null,
    "acceleratorPrice": {
      "discount": 100.0,
      "discountPrice": 1200.0,
      "originalPrice": 1200.0,
      "unitPrice": null,
      "discountUnitPrice": null,
      "chargeUnit": null,
      "stepPrices": null
    },
    "systemDiskPrice": {
      "discount": 100.0,
      "discountPrice": 20.0,
      "originalPrice": 20.0,
      "unitPrice": null,
      "discountUnitPrice": null,
      "chargeUnit": null,
      "stepPrices": null
    },
    "previousPrices": null
  }
}

In the example above, the instance has no corresponding order (for example, an internal instance that is not billed), so previousPrices is null and whether the price has changed cannot be determined.
```

{% 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\_INSTANCE\_NOT\_FOUND | Instance not found.                        |
| 404              | INVALID\_PRODUCT\_NOT\_FOUND  | The product is not on sale or is sold out. |
