> 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/vm/virtual-machine-instance/describeinstancecpumonitor.md).

# DescribeInstanceCpuMonitor

## 1. API Description

This API (DescribeInstanceCpuMonitor) is used to query CPU utilization in a specified date range.

{% hint style="info" %} <mark style="color:blue;">**Note**</mark>

* <mark style="color:blue;">The date range of 24 hours are supported.</mark>
* <mark style="color:blue;">Only the CPU utilization within 30 days are supported to query.</mark>
  {% endhint %}

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name | Required | Type   | Description                                                                                            |
| -------------- | -------- | ------ | ------------------------------------------------------------------------------------------------------ |
| instanceId     | Yes      | String | Instance ID.                                                                                           |
| startTime      | Yes      | String | <p>Start time.</p><p>Use UTC time according to the ISO8601 standard. Format: YYYY-MM-DDThh:mm:ssZ.</p> |
| endTime        | Yes      | String | <p>End time.</p><p>Use UTC time according to the ISO8601 standard. Format: YYYY-MM-DDThh:mm:ssZ.</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> |
| dataList       | Array of [DescribeInstanceCpuMonitorData](/api-reference/compute/vm/datastructure.md#describeinstancecpumonitordata) | List of CPU utilization information.                                                                                  |

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**Query the CPU utilization of the instance in one day.**

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

Request:
{
  "instanceId": "932237369560662463",
  "startTime": "2023-07-12T00:00:00Z",
  "endTime": "2023-07-12T01:00:00Z"
}

Response:
{
  "requestId": "T1B3DDE46-6FAA-4380-80A2-842F1B3186B7",
  "response": {
    "requestId": "T1B3DDE46-6FAA-4380-80A2-842F1B3186B7",
    "dataList": [
      {
        "cpu": "0.0089",
        "time": "2023-07-12T00:00:00Z"
      },
      {
        "cpu": "0.0083",
        "time": "2023-07-12T00:05:00Z"
      },
      {
        "cpu": "0.0082",
        "time": "2023-07-12T00:10:00Z"
      },
      {
        "cpu": "0.0085",
        "time": "2023-07-12T00:15:00Z"
      },
      {
        "cpu": "0.0067",
        "time": "2023-07-12T00:20:00Z"
      },
      {
        "cpu": "0.0068",
        "time": "2023-07-12T00:25:00Z"
      },
      {
        "cpu": "0.0079",
        "time": "2023-07-12T00:30:00Z"
      },
      {
        "cpu": "0.0094",
        "time": "2023-07-12T00:35:00Z"
      },
      {
        "cpu": "0.0092",
        "time": "2023-07-12T00:40:00Z"
      },
      {
        "cpu": "0.0088",
        "time": "2023-07-12T00:45:00Z"
      },
      {
        "cpu": "0.0090",
        "time": "2023-07-12T00:50:00Z"
      },
      {
        "cpu": "0.0090",
        "time": "2023-07-12T00:55:00Z"
      }
    ]
  }
}
```

{% 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 does not exist.                            |
| 400              | INVALID\_START\_TIME\_MUST\_BEFORE\_END\_TIME | The start time should be earlier than the end time. |
