> 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/describeinstancetraffic.md).

# DescribeInstanceTraffic

## 1. API Description

This API (DescribeInstanceTraffic) is used to query the data transfer in the 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 data transfer 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 [InstanceTrafficData](/api-reference/compute/vm/datastructure.md#instancetrafficdata) | List of bandwidth data.                                                                                               |
| in95                    | Integer                                                                                        | Inbound burstable 95th bandwidth.                                                                                     |
| in95Time                | String                                                                                         | <p>Time of inbound burstable 95th bandwidth.</p><p>Format: YYYY-MM-DDThh:mm:ssZ.</p>                                  |
| inAvg                   | Integer                                                                                        | Average value of inbound bandwidth.                                                                                   |
| inMax                   | Integer                                                                                        | Maximum value of inbound bandwidth.                                                                                   |
| inMin                   | Integer                                                                                        | Minimum value of inbound bandwidth.                                                                                   |
| inTotal                 | Integer                                                                                        | Total data transfer of inbound bandwidth.                                                                             |
| out95                   | Integer                                                                                        | Outbound burstable 95th bandwidth.                                                                                    |
| out95Time               | String                                                                                         | <p>Time of outbound burstable 95th bandwidth.</p><p>Format: YYYY-MM-DDThh:mm:ssZ.</p>                                 |
| outAvg                  | Integer                                                                                        | Average value of outbound bandwidth.                                                                                  |
| outMax                  | Integer                                                                                        | Maximum value of outbound bandwidth.                                                                                  |
| outMin                  | Integer                                                                                        | Minimum value of outbound bandwidth.                                                                                  |
| outTotal                | Integer                                                                                        | Total data transfer of outbound bandwidth.                                                                            |
| maxBandwidth95ValueMbps | Float                                                                                          | <p>Maximum value of burstable 95th bandwidth.</p><p>Unit: Mbps.</p>                                                   |
| totalUnit               | String                                                                                         | Unit of total data transfer. For example, B.                                                                          |
| unit                    | String                                                                                         | Unit of bandwidth. For example, bps.                                                                                  |

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**Query the data transfer 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: DescribeInstanceTraffic
<Common Request Params>

Request:
{
  "instanceId": "926368879272403391",
  "startTime": "2023-07-11T08:00:011Z",
  "endTime": "2023-07-11T08:10:00Z"
}

Response:
{
  "requestId": "TE1375F34-6DC9-4BED-BDF2-DC9D07E4D3A6",
  "response": {
    "requestId": "TE1375F34-6DC9-4BED-BDF2-DC9D07E4D3A6",
    "dataList": [
      {
        "internetRX": 109096,
        "internetTX": 80,
        "time": "2023-07-11T08:05:00Z"
      },
      {
        "internetRX": 106680,
        "internetTX": 56,
        "time": "2023-07-11T08:10:00Z"
      }
    ],
    "in95": 109096,
    "in95Time": "2023-07-11T08:05:00Z",
    "inAvg": 107888,
    "inMax": 109096,
    "inMin": 106680,
    "inTotal": 8091600,
    "out95": 80,
    "out95Time": "2023-07-11T08:05:00Z",
    "outAvg": 68,
    "outMax": 80,
    "outMin": 56,
    "outTotal": 5100,
    "maxBandwidth95ValueMbps": 0.11,
    "totalUnit": "B",
    "unit": "bps"
  }
}
```

{% 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. |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.console.zenlayer.com/api-reference/compute/vm/virtual-machine-instance/describeinstancetraffic.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
