# 回源流量

`GET /cdn/data/{domain}/traffic_origin`

按时间段统计 CDN 回源（从存储桶或自定义源站拉取）的流量。

Base URL: https://api.bitiful.com

Authentication: API key in header `Authorization`

## Path parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `domain` | string | yes | CDN 加速域名。 |

## Query parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `start_time` | integer | yes | 统计起始时间，Unix 时间戳，单位**秒**。 |
| `end_time` | integer | yes | 统计截止时间，Unix 时间戳，单位**秒**，必须大于 `start_time`。 |
| `period` | enum | no | 统计粒度：按 5 分钟、小时、天或月聚合。按天、按月以北京时间划分。部分早期创建的加速域名不支持 `monthly`。 |

## Example request

```bash
curl -X GET https://api.bitiful.com/cdn/data/cdn.example.com/traffic_origin
```

## Responses

- **200**: 按 `period` 聚合的流量，单位 MB（1 MB = 1000000 字节）。
- **401**: API Token 缺失或无效。
- **403**: 参数不合法、域名不属于当前账户、额度不足或账户欠费等，原因见 `message`。
- **500**: 服务端错误，请稍后重试。

### Example response (200)

```json
{
  "data": [
    {
      "timestamp": 1735660800,
      "value": 128.5
    },
    {
      "timestamp": 1735664400,
      "value": 96.2
    }
  ]
}
```
