# DescribeInstanceTypes

## 1. 接口描述

本接口(DescribeInstanceTypes)用于查询实例机型配置。

{% hint style="info" %}
**注意事项**

`DescribeInstanceTypes`仅查询实例机型的配置和性能信息，如果您需要查询具体地域下可购买的实例机型，请查询 `DescribeAvailableResources。`
{% endhint %}

## 2. 请求参数

以下请求参数列表仅列出了接口中需要的请求参数

| 参数名称                | 必选 | 类型               | 描述                                                                 |
| ------------------- | -- | ---------------- | ------------------------------------------------------------------ |
| imageId             | 否  | String           | 查询实例机型时，支持某镜像的机型。                                                  |
| instanceTypeIds     | 否  | Array of String  | <p>实例机型ID。</p><p>数量不超过100个。</p>                                    |
| minimumCpuCoreCount | 否  | Integer          | <p>查询实例机型时，期望最小CPU内核的数目。</p><p>取值范围：正整数。</p>                       |
| maximumCpuCoreCount | 否  | Integer          | <p>查询实例机型时，期望最大CPU内核的数目。</p><p>取值范围：正整数。</p>                       |
| minimumMemorySize   | 否  | Integer          | <p>查询实例机型时，期望最小内存大小。</p><p>取值范围：正整数。</p><p>单位：GB。</p>              |
| maximumMemorySize   | 否  | Integer          | <p>查询实例机型时，期望最大内存大小。</p><p>取值范围：正整数。</p><p>单位：GB。</p>              |
| minimumBandwidth    | 否  | Integer          | <p>查询实例机型时，期望最小公网入方向带宽限制。</p><p>单位：Mbps。</p>                       |
| supportRaids        | 否  | Array of Integer | <p>查询实例机型时，对实例机型做raid时所支持的raid类型。</p><p>Raid可选值包括：0, 1, 5, 10。</p> |
| supportSubnet       | 否  | Boolean          | 查询实例机型时，机型是否支持内网组网。                                                |
| minimumDiskSize     | 否  | Integer          | <p>查询实例机型时，期望最小磁盘大小。</p><p>取值范围：正整数。</p><p>单位：GB。</p>              |
| maximumDiskSize     | 否  | Integer          | <p>查询实例机型时，期望最大磁盘大小。</p><p>取值范围：正整数。</p><p>单位：GB。</p>              |
| isHA                | 否  | Boolean          | 查询实例机型时，是否是高可用机型。                                                  |

## 3. 响应结果

| 参数名称          | 类型                                                                                   | 描述                                                       |
| ------------- | ------------------------------------------------------------------------------------ | -------------------------------------------------------- |
| requestId     | String                                                                               | <p>唯一请求 ID。</p><p>每次请求都会返回。定位问题时需要提供该次请求的 requestId。</p> |
| instanceTypes | Array of [InstanceType](/api-reference/cn/compute/bmc/datastructure.md#instancetype) | 查询的机型信息。                                                 |

## 4. 代码示例

{% tabs %}
{% tab title="示例" %}

1. **获取所有的机型。**

```json
POST /api/v2/bmc HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: DescribeInstanceTypes
Response:
{
  "requestId": "TE056C563-E5B1-46B5-9C5A-514B7501F420",
  "response": {
    "requestId": "TE056C563-E5B1-46B5-9C5A-514B7501F420",
    "instanceTypes": [
      {
        "imageIds": [
          "e3f1cf2e-8929-4b8a-8747-d0b779b770f7",
          "6059cf45-daf7-4954-80a2-346e8c3c5fd7"
        ],
        "instanceTypeId": "M9O",
        "description": "2x6248",
        "cpuCoreCount": 80,
        "cpuDetail": "1 × Intel® Xeon® CPU E3-1230 v5",
        "cpuCores": 2,
        "cpuThreads": 8,
        "baseFrequency": "3.40 GHz (Turbo 3.80 GHz)",
        "memorySize": 256,
        "maximumBandwidth": 10000,
        "supportRaids": [0,1,5,10],
        "supportSubnet": true,
        "isHA": true,
        "diskInfo": {
          "totalDiskSize": 4000,
          "diskDescription": "4x1.2TB SAS",
          "disks": [
            {
              "diskSize": 1000,
              "diskCount": 4
            }
          ]
        }
      },
      {
        "imageIds": [
          "f9f9f8a2-24a1-44dd-9f60-36c3bc5c0dae"
        ],
        "instanceTypeId": "MGI",
        "description": "2x6248",
        "cpuCoreCount": 80,
        "cpuDetail": "1 × Intel® Xeon® CPU E3-1230 v5",
        "cpuCores": 2,
        "cpuThreads": 8,
        "baseFrequency": "3.40 GHz (Turbo 3.80 GHz)",
        "memorySize": 256,
        "maximumBandwidth": 10000,
        "supportRaids": [0,1],
        "supportSubnet": true,
        "isHA": true,
        "diskInfo": {
          "totalDiskSize": 2000,
          "diskDescription": "2x1.2TB SAS",
          "disks": [
            {
              "diskSize": 1000,
              "diskCount": 2
            }
          ]
        }
      }
    ]
  }
}
```

{% endtab %}
{% endtabs %}

## 5. 开发者工具

Zenlayer Cloud API 2.0 提供了配套的[开发工具集（SDK）](/api-reference/cn/api-introduction/toolkit.md)，未来会陆续支持更多开发语言，方便快速接入和使用Zenlayer的产品和服务。

## 6. 错误码

下面包含业务逻辑中遇到的错误码，其他错误码见[公共错误码](/api-reference/cn/api-introduction/instruction/commonerrorcode.md)

| HTTP状态码 | 错误码 | 说明 |
| ------- | --- | -- |


---

# 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/cn/compute/bmc/bare-metal-instance/describeinstancetypes.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.
