> 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/networking/cdn/analysis/describetraffic.md).

# DescribeTraffic

## 1. API Description

This API (DescribeTraffic) is used to query CDN traffic, data aggregation internval is 5 minutes.

#### Preparation

* Query Billing Regions: Use [`DescribeBillingRegions`](/api-reference/networking/cdn/common/describebillingregions.md).

## 2. Request Parameters

The following table lists the required request parameters for the API:

| Parameter Name | Required | Type   | Description                                                                                                                                                                                                                         |
| -------------- | -------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| startTime      | Yes      | String | The beginning of the time range to query. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC. For example, 2024-08-22T00:00:00Z.                                                 |
| endTime        | Yes      | String | The end of the time range to query. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC. For example, 2024-08-22T00:10:00Z. Note: The end time must be later than the start time. |
| domain         | No       | String | domain, use commas(,) to separate multiple domain names. By default, all acceleration domains will be queried.                                                                                                                      |
| region         | No       | String | [Billing region](/api-reference/networking/cdn/common/describebillingregions.md)                                                                                                                                                    |
| protocol       | No       | String | [Protocol Type](/api-reference/networking/cdn/datastructure.md#protocolvalue)                                                                                                                                                       |

## 3. Output Parameterss

| Parameter Name | Type                                                                                   | Description                                                                                          |
| -------------- | -------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| dataSet        | Array of [BandwidthData](/api-reference/networking/cdn/datastructure.md#bandwidthdata) | Traffic data(Unit MB)                                                                                |
| requestId      | String                                                                                 | Unique request ID, which is returned with every request. This request ID is needed to locate issues. |

## 4. Code Example

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

1. **Query CDN Traffic.**

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

Request:
{
  "startTime": "2024-08-22T00:00:00Z", 
  "endTime": "2024-08-22T00:10:00Z"
}

Response:
{
  "requestId": "T2E02C6AE-688F-XXXX-8A2C-C9418D1719AF",
  "response": {
    "requestId": "T2E02C6AE-688F-XXXX-8A2C-C9418D1719AF",
    "dataSet": [
      {
        "domain": "www.xxx.com",
        "region": "ALL",
        "data": [
          {
            "time": "2024-08-22T00:00:00Z",
            "value": 156509.32
          },
          {
            "time": "2024-08-22T00:05:00Z",
            "value": 179711.30
          }
        ]
      }
    ]
  }
}
```

{% endtab %}
{% endtabs %}

## 5. Error Codes

The following includes error codes encountered in business logic. For other error codes, see [Common Error Codes](/api-reference/api-introduction/instruction/commonerrorcode.md).
