# DescribeImages

## 1. API Description

This API (DescribeImages) is used to query the details of images.

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name | Required | Type                                                                                             | Description                                                                                            |
| -------------- | -------- | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ |
| zoneId         | Yes      | String                                                                                           | <p>Availability zone ID.</p><p>Call DescribeZones and find zoneId in the response.</p>                 |
| imageIds       | No       | Array of String                                                                                  | <p>ID list of images.</p><p>Call DescribeImages and find imageId in the response.</p>                  |
| imageName      | No       | String                                                                                           | Image name.                                                                                            |
| category       | No       | String                                                                                           | Image category.                                                                                        |
| imageType      | No       | [ImageType](https://docs.console.zenlayer.com/api-reference/compute/datastructure#imagetype)     | Image type.                                                                                            |
| imageSource    | No       | [ImageSource](https://docs.console.zenlayer.com/api-reference/compute/datastructure#imagesource) | Image source.                                                                                          |
| osType         | No       | [ImageOsType](https://docs.console.zenlayer.com/api-reference/compute/datastructure#imageostype) | Operating system type.                                                                                 |
| imageStatus    | No       | [ImageStatus](https://docs.console.zenlayer.com/api-reference/compute/datastructure#imagestatus) | Image status.                                                                                          |
| pageNum        | No       | Integer                                                                                          | <p>Number of pages returned.</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 using tag keys.</p><p>A maximum of 20 tag keys can be used.</p>                               |
| tags           | No       | Array of [Tag](https://docs.console.zenlayer.com/api-reference/compute/datastructure#tag)        | <p>Query using tags.</p><p>A maximum of 20 tags can be used.</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 images meeting the filtering conditions.                                                                    |
| dataSet        | Array of [Image](https://docs.console.zenlayer.com/api-reference/compute/datastructure#image) | Information on an image.                                                                                              |

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**Query images with `linux` images installed in availability zone of `asia-east-1a`.**

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

Request：
{
  "zoneId": "asia-east-1a",
  "osType": "linux",
  "pageSize": 3
}

Response：
{
  "requestId": "TD67947F8-9B29-451F-9965-58AEDB4E5B7C",
  "response": {
    "requestId": "TD67947F8-9B29-451F-9965-58AEDB4E5B7C",
    "dataSet": [
      {
        "imageId": "ubuntu2404_20240712",
        "imageName": "Ubuntu Server 24.04 LTS",
        "imageType": "PUBLIC_IMAGE",
        "imageSource": "OFFICIAL",
        "imageSize": "20",
        "imageDescription": null,
        "imageVersion": "Server 24.04 LTS",
        "imageStatus": "AVAILABLE",
        "nicNetworkType": ["FailOver","VirtioOnly"],
        "category": "Ubuntu",
        "osType": "linux",
        "tags":null
      },
      {
        "imageId": "ubuntu2204_20240712",
        "imageName": "Ubuntu Server 22.04 LTS",
        "imageType": "PUBLIC_IMAGE",
        "imageSource": "OFFICIAL",
        "imageSize": "20",
        "imageDescription": null,
        "imageVersion": "Server 22.04 LTS",
        "imageStatus": "AVAILABLE",
        "nicNetworkType": ["FailOver","VirtioOnly"],
        "category": "Ubuntu",
        "osType": "linux",
        "tags":null
      },
      {
        "imageId": "ubuntu2004_20240712",
        "imageName": "Ubuntu Server 20.04 LTS",
        "imageType": "PUBLIC_IMAGE",
        "imageSource": "MARKETING",
        "imageSize": "20",
        "imageDescription": null,
        "imageVersion": "Server 20.04 LTS",
        "imageStatus": "AVAILABLE",
        "nicNetworkType": ["FailOver","VirtioOnly"],
        "category": "Ubuntu",
        "osType": "linux",
        "tags":null
      }
    ],
    "totalCount": 16
  }
}
```

{% endtab %}
{% endtabs %}

## 5. Developer Resources

Zenlayer Cloud API 2.0 integrates [SDKs](https://docs.console.zenlayer.com/api-reference/api-introduction/toolkit/api-sdk)，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](https://docs.console.zenlayer.com/api-reference/api-introduction/instruction/commonerrorcode).

| HTTP Status Code | Error Code                | Description            |
| ---------------- | ------------------------- | ---------------------- |
| 404              | INVALID\_ZONE\_NOT\_FOUND | Region does not exist. |
