For the complete documentation index, see llms.txt. This page is also available as Markdown.

报表

获取流量使用报表

GET /residential/data-usage-report

以CSV文件形式返回指定住宅代理用户或子用户的流量使用报表。hash 必须属于当前已认证账号。若日期范围为空,则返回仅包含表头的CSV文件。

Query Parameters

名称
类型
说明

hash

字符串

要生成报表的住宅代理用户或子用户的 app_hash

date_from

字符串

报表范围的开始日期,格式为 Y-m-d

date_to

字符串

报表范围的结束日期,格式为 Y-m-d。必须等于或晚于 date_from

measurement_unit

字符串

流量数值的单位,可选值:B、KB、MB、GB

rounding_decimal

整数

流量数值的小数位数(必须为 0 或更大)

time_zone

字符串

可选。 用于按日期归集流量的 IANA 时区名称(例如 Europe/London、America/New_York、UTC)。不区分大小写。若不提供,则使用默认时区。

除 time_zone 外,所有参数均为必填项。

请求示例:

curl -X GET "https://resi-api.iproyal.com/v1/residential/data-usage-report?hash=asd48w4f5c1s2a5w4f8h5t6r1v&date_from=2026-01-01&date_to=2026-01-31&measurement_unit=GB&rounding_decimal=2" \
    -H "Authorization: Bearer <your_api_token>" \
    -o data-usage-report.csv
<?php
$query = http_build_query([
    'hash' => 'asd48w4f5c1s2a5w4f8h5t6r1v',
    'date_from' => '2026-01-01',
    'date_to' => '2026-01-31',
    'measurement_unit' => 'GB',
    'rounding_decimal' => 2,
]);

$ch = curl_init("https://resi-api.iproyal.com/v1/residential/data-usage-report?{$query}");
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer <your_api_token>']);
curl_setopt($ch, CURLOPT_FILE, fopen('data-usage-report.csv', 'w'));
curl_exec($ch);
curl_close($ch);
import requests

params = {
    "hash": "asd48w4f5c1s2a5w4f8h5t6r1v",
    "date_from": "2026-01-01",
    "date_to": "2026-01-31",
    "measurement_unit": "GB",
    "rounding_decimal": 2,
}
headers = {"Authorization": "Bearer <your_api_token>"}

response = requests.get(
    "https://resi-api.iproyal.com/v1/residential/data-usage-report",
    params=params,
    headers=headers,
    stream=True,
)

with open("data-usage-report.csv", "wb") as f:
    for chunk in response.iter_content(chunk_size=8192):
        f.write(chunk)

响应

该接口以附件形式返回CSV文件。

请求头:

响应示例:

Last updated