> 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/ipt/ip-transit/describeiptransittraffic.md).

# DescribeIPTransitTraffic

## 1. 接口描述

本接口(DescribeIPTransitTraffic)用于查询IP Transit流量。

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

* 只能查询30天内的流量数据。
  {% endhint %}

## 2. 请求参数

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

| 参数名称      | 必选 | 类型                                                                          | 描述                                                                                                                                            |
| --------- | -- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| iptId     | 是  | String                                                                      | IP Transit ID。                                                                                                                                |
| startTime | 是  | String                                                                      | <p>查询开始时间。</p><p>ISO8601 UTC 格式：YYYY-MM-DDThh<span data-gb-custom-inline data-tag="emoji" data-code="1f1f2-1f1f2">🇲🇲</span>ssZ。</p>         |
| endTime   | 否  | String                                                                      | <p>查询结束时间。</p><p>ISO8601 UTC 格式：YYYY-MM-DDThh<span data-gb-custom-inline data-tag="emoji" data-code="1f1f2-1f1f2">🇲🇲</span>ssZ，默认为当前时间。</p> |
| period    | 否  | Integer                                                                     | <p>数据采样周期。</p><p>单位为秒，可选值：20、40、60、120、300、900。</p><p>默认值：300</p>                                                                             |
| statistic | 否  | [TrafficStatistic](/api-reference/cn/ipt/datastructure.md#trafficstatistic) | <p>采样周期内流量数据的统计方式。</p><p>默认值：Average</p>                                                                                                      |

## 3. 响应结果

| 参数名称      | 类型                                                                         | 描述                                                       |
| --------- | -------------------------------------------------------------------------- | -------------------------------------------------------- |
| requestId | String                                                                     | <p>唯一请求 ID。</p><p>每次请求都会返回。定位问题时需要提供该次请求的 requestId。</p> |
| dataList  | Array of [TrafficData](/api-reference/cn/ipt/datastructure.md#trafficdata) | 带宽数据列表。                                                  |
| in95      | Integer                                                                    | 入口带宽95值。                                                 |
| inAvg     | Integer                                                                    | 入口带宽平均值。                                                 |
| inMax     | Integer                                                                    | 入口带宽最大值。                                                 |
| inMin     | Integer                                                                    | 入口带宽最小值。                                                 |
| out95     | Integer                                                                    | 出口带宽95值。                                                 |
| outAvg    | Integer                                                                    | 出口带宽平均值。                                                 |
| outMax    | Integer                                                                    | 出口带宽最大值。                                                 |
| outMin    | Integer                                                                    | 出口带宽最小值。                                                 |
| unit      | String                                                                     | 带宽值单位。例如：bps。                                            |

## 4. 代码示例

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

1. **查询IP Transit一天内的流量数据。**

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

Request:
{
  "iptId": "your-ipt-id",
  "startTime": "2024-01-01T00:00:00Z",
  "endTime": "2024-01-01T23:59:59Z"
}

Response:
{
  "requestId": "T4C35327C-7B13-47B8-A815-5E5213D4A9F9",
  "response": {
    "requestId": "T4C35327C-7B13-47B8-A815-5E5213D4A9F9",
    "dataList": [
      {
        "internetRX": 873034,
        "internetTX": 11971,
        "time": "2023-01-01T00:00:00Z"
      },
      {
        "internetRX": 873034,
        "internetTX": 11971,
        "time": "2023-01-01T00:05:00Z"
      },
      {
        "internetRX": 635218,
        "internetTX": 9028,
        "time": "2023-01-01T00:10:00Z"
      }
    ],
    "in95": 873034,
    "inAvg": 793762,
    "inMax": 873034,
    "inMin": 635218,
    "out95": 11971,
    "outAvg": 10990,
    "outMax": 11971,
    "outMin": 9028,
    "unit": "bps"
  }
}
```

2. **以 1 分钟为采样周期，查询IP Transit一小时内每分钟的最大流量。**

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

Request:
{
  "iptId": "your-ipt-id",
  "startTime": "2026-01-01T00:00:00Z",
  "endTime": "2026-01-01T01:00:00Z",
  "period": 60,
  "statistic": "Maximum"
}

Response:
{
  "requestId": "T4C35327C-7B13-47B8-A815-5E5213D4A9F9",
  "response": {
    "requestId": "T4C35327C-7B13-47B8-A815-5E5213D4A9F9",
    "dataList": [
      {
        "internetRX": 912480,
        "internetTX": 12630,
        "time": "2026-01-01T00:00:00Z"
      },
      {
        "internetRX": 887215,
        "internetTX": 12104,
        "time": "2026-01-01T00:01:00Z"
      },
      {
        "internetRX": 701336,
        "internetTX": 9875,
        "time": "2026-01-01T00:02:00Z"
      }
    ],
    "in95": 912480,
    "inAvg": 833677,
    "inMax": 912480,
    "inMin": 701336,
    "out95": 12630,
    "outAvg": 11536,
    "outMax": 12630,
    "outMin": 9875,
    "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状态码 | 错误码 | 说明 |
| ------- | --- | -- |
