> 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/cn/networking/zga/accelerator/describeacceleratortraffic.md).

# DescribeAcceleratorTraffic

## 1. 接口描述

本接口(DescribeAcceleratorTraffic)用于查询加速器流量。

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

* 带宽返回值时间颗粒度为 300s。
* 带宽和流量数据是通过加速日志汇总得到。由于日志采集得延时性，当前带宽值可能出现 0 或者不准的情况。一般情况下，15 分钟前数据完整性没有问题，可设置 endTime=(当前时间-15 分钟)再向前取 5 的倍数时间查询（详见入参说明）。由于可能会遇到一些数据收集延迟的情况，每个点的数据在 24 小时内有几率被修正。如果对数据完整性要求是 100%，可以在 24 小时后调用，进行数据覆盖。
  {% endhint %}

## 2. 请求参数

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

| 参数名称               | 必选 | 类型                                                                      | 描述                                                                                                                                                                                                                                                                           |
| ------------------ | -- | ----------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| acceleratorId      | 是  | String                                                                  | 加速器 Id                                                                                                                                                                                                                                                                       |
| accelerateRegionId | 否  | String                                                                  | 加速区域 Id                                                                                                                                                                                                                                                                      |
| listener           | 否  | String                                                                  | <p>加速规则</p><ul><li>单端口: $protocol:$port, 例如: http:80。</li><li>端口段: $protocol:$portRange, 例如: tcp:80/100。</li></ul>                                                                                                                                                           |
| startTime          | 是  | [Timestamp](/api-reference/cn/api-introduction/instruction/datatype.md) | <p>查询开始时间。</p><p>按照<code>ISO8601</code>标准表示，并且使用<code>UTC</code>时间。格式为：<code>YYYY-MM-DDThh:mm:00Z</code>。</p><p>mm 必须为 5 的倍数，如：0/5/10/15/20/25/30/35/40/45/55。示例：2025-06-11T00:05:00Z</p><p>注意：</p><ul><li>开始时间必须小于结束时间</li><li>返回值时间颗粒度: 300s。</li><li>时间范围：左闭右开。</li></ul> |
| endTime            | 是  | [Timestamp](/api-reference/cn/api-introduction/instruction/datatype.md) | <p>查询结束时间。</p><p>按照<code>ISO8601</code>标准表示，并且使用<code>UTC</code>时间。格式为：<code>YYYY-MM-DDThh:mm:00Z</code>。</p><p>mm 必须为 5 的倍数，如：0/5/10/15/20/25/30/35/40/45/55。例子：2025-06-11T00:25:00Z</p><p>注意：</p><ul><li>开始时间必须小于结束时间</li><li>返回值时间颗粒度: 300s。</li><li>时间范围：左闭右开。</li></ul> |

## 3. 响应结果

| 参数名称      | 类型                                                                                                          | 描述                                         |
| --------- | ----------------------------------------------------------------------------------------------------------- | ------------------------------------------ |
| requestId | String                                                                                                      | 唯一请求 ID，每次请求都会返回。定位问题时需要提供该次请求的 requestId。 |
| dataList  | Array of [AcceleratorTrafficData](/api-reference/cn/networking/zga/datastructure.md#acceleratortrafficdata) | 带宽数据列表                                     |
| inMax     | Integer                                                                                                     | 入口带宽最大值                                    |
| inMin     | Integer                                                                                                     | 入口带宽最小值                                    |
| inTotal   | Integer                                                                                                     | 入口带宽总流量                                    |
| outMax    | Integer                                                                                                     | 出口带宽最大值                                    |
| outMin    | Integer                                                                                                     | 出口带宽最小值                                    |
| outTotal  | Integer                                                                                                     | 出口带宽总流量                                    |
| unit      | String                                                                                                      | 带宽值单位。例如：bps                               |
| totalUnit | String                                                                                                      | 流量值单位。例如：B                                 |

## 4. 代码示例

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

1. **查询加速器流量**

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

Request:
{
  "acceleratorId": "acceleratorIdxxxxx",
  "startTime": "2025-06-11T01:25:00Z",
  "endTime": "2025-06-11T02:25:00Z",
  "listener": "tcp:80/88",
  "accelerateRegionId": "DE"
}

Response:
{
  "requestId": "TEEFDCA5B-76FB-4E91-A18E-DF7F5D2CE41F",
  "response": {
    "requestId": "TEEFDCA5B-76FB-4E91-A18E-DF7F5D2CE41F",
      "dataList": [
          {
              "time": "2025-06-11T01:25:00Z",
              "in": 11.351999,
              "out": 105.423996
          },
          {
              "time": "2025-06-11T01:30:00Z",
              "in": 65.706665,
              "out": 360.82935
          },
          {
              "time": "2025-06-11T01:35:00Z",
              "in": 18.450666,
              "out": 108.328
          },
          {
              "time": "2025-06-11T01:40:00Z",
              "in": 48.86933,
              "out": 9.269333
          },
          {
              "time": "2025-06-11T01:45:00Z",
              "in": 0,
              "out": 0
          },
          {
              "time": "2025-06-11T01:50:00Z",
              "in": 26.605333,
              "out": 20.855999
          },
          {
              "time": "2025-06-11T01:55:00Z",
              "in": 0,
              "out": 0
          },
          {
              "time": "2025-06-11T02:00:00Z",
              "in": 119.856,
              "out": 609.51733
          },
          {
              "time": "2025-06-11T02:05:00Z",
              "in": 0,
              "out": 0
          },
          {
              "time": "2025-06-11T02:10:00Z",
              "in": 68.669334,
              "out": 110.088005
          },
          {
              "time": "2025-06-11T02:15:00Z",
              "in": 101.64,
              "out": 468.776
          },
          {
              "time": "2025-06-11T02:20:00Z",
              "in": 60.72,
              "out": 479.21866
          }
      ],
    "inMax": 119.856,
    "outMax": 609.51733,
    "inMin": 0,
    "outMin": 0,
    "inTotal": 19570.099762499998,
    "outTotal": 85211.5002375,
    "totalUnit": "B",
    "unit": "bps"
  }
}
```

{% 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 状态码 | 错误码                                           | 说明            |
| -------- | --------------------------------------------- | ------------- |
| 400      | INVALID\_START\_TIME\_MUST\_BEFORE\_END\_TIME | 开始时间必须在结束时间之前 |
