> 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/sdn/data-center-port/describeporttraffic.md).

# DescribePortTraffic

## 1. API Description

This API (DescribePortTraffic) is used to query Port Traffic

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name | Required | Type                                                                     | Description                                                                                                         |
| -------------- | -------- | ------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------- |
| portId         | Yes      | String                                                                   | Port ID.                                                                                                            |
| startTime      | Yes      | String                                                                   | Query start time, in ISO 8601 UTC format: YYYY-MM-DDThh:flag\_mm:ssZ.                                               |
| endTime        | Yes      | String                                                                   | Query end time, in ISO 8601 UTC format: YYYY-MM-DDThh:flag\_mm:ssZ.                                                 |
| period         | No       | Integer                                                                  | <p>Data sampling period.</p><p>Unit: seconds. Valid values: 20, 40, 60, 120, 300, 900.</p><p>Default value: 300</p> |
| statistic      | No       | [TrafficStatistic](/api-reference/sdn/datastructure.md#trafficstatistic) | <p>Statistical method of traffic data within the sampling period.</p><p>Default value: Average</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 [TrafficData](/api-reference/sdn/datastructure.md#trafficdata) | List of traffic data points.                                                                                          |
| in95           | Integer                                                                 | Inbound 95th percentile peak traffic.                                                                                 |
| inAvg          | Integer                                                                 | Average inbound traffic.                                                                                              |
| inMax          | Integer                                                                 | Maximum inbound traffic.                                                                                              |
| inMin          | Integer                                                                 | Minimum inbound traffic.                                                                                              |
| out95          | Integer                                                                 | Outbound 95th percentile peak traffic.                                                                                |
| outAvg         | Integer                                                                 | Average outbound traffic.                                                                                             |
| outMax         | Integer                                                                 | Maximum outbound traffic.                                                                                             |
| outMin         | Integer                                                                 | Minimum outbound traffic.                                                                                             |
| unit           | String                                                                  | Traffic unit, e.g. bps.                                                                                               |

## 4. Code Example

{% tabs %}
{% tab title="Example" %}

1. **Query a port's bandwidth data for one day.**

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

Request: {
    "portId": "your-port-id",
    "startTime": "YYYY-MM-ddTHH:mm:ssZ",
    "endTime": "YYYY-MM-ddTHH:mm:ssZ"
}

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. **Query a port's maximum traffic per minute over one hour, with a sampling period of 1 minute.**

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

Request:
{
  "portId": "your-port-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. 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 |
| ---------------- | ---------- | ----------- |
