> 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/bmc/bare-metal-instance/describeinstances.md).

# DescribeInstances

## 1. API Description

This API (DescribeInstances) is used to query the details of instances. You can filter the query results with the instance ID, name, or billing method.

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name     | Required | Type                                                                                 | Description                                                                                                                                          |
| ------------------ | -------- | ------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| instanceIds        | No       | Array of String                                                                      | <p>Instance IDs.</p><p>You can query up to 100 instances in each request.</p>                                                                        |
| zoneId             | No       | String                                                                               | Zone ID to which the instances belong.                                                                                                               |
| resourceGroupId    | No       | String                                                                               | <p>Resource group ID.</p><p>If the value is null, then return all the instances in the authorized resource groups.</p>                               |
| instanceTypeId     | No       | String                                                                               | Instance model ID.btain the latest specification.                                                                                                    |
| internetChargeType | No       | [InternetChargeType](/api-reference/compute/bmc/datastructure.md#internetchargetype) | Network pricing model.                                                                                                                               |
| imageId            | No       | String                                                                               | Image ID.                                                                                                                                            |
| subnetId           | No       | String                                                                               | Subnet ID.uery information on subnet.                                                                                                                |
| instanceStatus     | No       | [InstanceStatus](/api-reference/compute/bmc/datastructure.md#instancestatus)         | Instance status.                                                                                                                                     |
| instanceName       | No       | String                                                                               | <p>Instance name.</p><p>If the value ends with \* , a fuzzy match will be performed on instanceName, otherwise an exact match will be performed.</p> |
| hostname           | No       | String                                                                               | <p>Instance hostname.</p><p>If the value ends with \* , a fuzzy match will be performed on hostname, otherwise an exact match will be performed.</p> |
| publicIpAddresses  | No       | Array of String                                                                      | List of public IPs of the instance.                                                                                                                  |
| privateIpAddresses | No       | Array of String                                                                      | List of private IPs of the instance.                                                                                                                 |
| pageNum            | No       | Integer                                                                              | <p>Number of pages returned.</p><p>Default value: 1</p><p>Default value: 1</p>                                                                       |
| pageSize           | No       | Integer                                                                              | <p>Number of items in the current page result.</p><p>Default value: 20</p><p>Maximum value: 1000</p>                                                 |
| tagKeys            | No       | Array of String                                                                      | <p>Query according to tag key.</p><p>You can query up to 20 tag keys in each request.</p>                                                            |
| tags               | No       | Array of [Tag](/api-reference/compute/bmc/datastructure.md#tag)                      | <p>Query according to tag.</p><p>You can query up to 20 tags in each request.</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> |
| totalCount     | Integer                                                                           | Number of instances meeting the filtering conditions.                                                                 |
| dataSet        | Array of [InstanceInfo](/api-reference/compute/bmc/datastructure.md#instanceinfo) | Information on an instance.                                                                                           |

## 4. Code Example

{% tabs %}
{% tab title="Example" %}

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

Request:
{
  "pageNum": 1,
  "pageSize": 1
}

Response:
{
  "requestId": "TEEFDCA5B-76FB-4E91-A18E-DF7F5D2CE41F",
  "response": {
    "requestId": "TEEFDCA5B-76FB-4E91-A18E-DF7F5D2CE41F",
    "totalCount": 6,
    "dataSet": [
      {
        "instanceId": "instanceId",
        "zoneId": "HKG-A",
        "instanceName": "TEST",
        "hostname": "M7D-HKG-A-01",
        "instanceTypeId": "M7D",
        "imageId": "imageId",
        "imageName": "Ubuntu18.04-x86_64",
        "instanceChargeType": "POSTPAID",
        "bandwidthOutMbps": 0,
        "internetChargeType": "ByClusterBandwidth95",
        "period": null,
        "primaryPublicIpAddress": "1.1.1.1",
        "publicIpAddresses": [
          "1.1.1.1",
          "2.2.2.2"
        ],
        "privateIpAddresses": [
          "10.0.0.1"
        ],
        "ipv6Addresses": [
          "2602:ffe4:1:11::1"
        ],
        "subnetIds": [
          "subnetId"
        ],
        "createTime": "2023-01-01T00:00:00Z",
        "expiredTime": null,
        "resourceGroupId": "resourceGroupId",
        "instanceStatus": "RUNNING",
        "trafficPackageSize": 1.5,
        "raidConfig": {
          "raidType": null,
          "customRaids": [
            {
              "raidType": 1,
              "diskSequence": [
                12,
                13
              ]
            }
          ]
        },
        "partitions": [
          {
            "fsPath": "/",
            "fsType": "ext2",
            "size": 1100
          }
        ],
        "nic": {
          "wanName": "wan0",
          "lanName": "lan0"
        },
        "autoRenew": true
      }
    ]
  }
}
```

{% 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\_TYPE\_NOT\_FOUND | Instance type not found. |
| 404              | INVALID\_ZONE\_NOT\_FOUND           | Zone not found.          |
