> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nexalayer.net/llms.txt
> Use this file to discover all available pages before exploring further.

# 动态流量与提取

> 动态代理提取、剩余流量和流量查询接口。基础地址：https://backend.ztproxy.net/api

# 动态流量与提取

本页说明动态代理提取、剩余流量查询和动态代理流量明细接口。

## 提取动态代理

```bash theme={null}
curl -X POST "https://backend.ztproxy.net/api/business/dynamic-proxy/extract" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "productNo": "<dynamic_product_no>",
    "proxyType": 104,
    "username": "target_user",
    "extractConfig": {
      "method": "api"
    }
  }'
```

字段说明：

| 字段                     | 类型     |  必填 | 说明                  |
| ---------------------- | ------ | :-: | ------------------- |
| `productNo`            | string |  是  | 动态代理产品编号。           |
| `proxyType`            | number |  是  | 动态代理通常为 `104`。      |
| `username`             | string |  否  | 指定目标用户；不传则使用当前登录用户。 |
| `extractConfig.method` | string |  否  | 提取方式，默认 `api`。      |

## 查询用户所有产品剩余流量

```bash theme={null}
curl -X GET "https://backend.ztproxy.net/api/user/1001/products-flow" \
  -H "Authorization: Bearer <token>"
```

权限规则：

* 代理商可查询自己和下级用户。
* 普通用户只能查询自己。

## 查询指定产品剩余流量

```bash theme={null}
curl -X GET "https://backend.ztproxy.net/api/user/1001/remaining-flow/<dynamic_product_no>" \
  -H "Authorization: Bearer <token>"
```

`product_no` 使用动态代理产品编号。

## 查询动态子账户流量信息

```bash theme={null}
curl -X GET "https://backend.ztproxy.net/api/agent/childAccount/user/sub001" \
  -H "Authorization: Bearer <token>"
```

响应会将流量换算为 GB，并返回：

| 字段                 | 说明          |
| ------------------ | ----------- |
| `limit_flow`       | 总流量，单位 GB。  |
| `download_flow`    | 下载流量，单位 GB。 |
| `upload_flow`      | 上传流量，单位 GB。 |
| `used_flow`        | 已用流量，单位 GB。 |
| `remaining_flow`   | 剩余流量，单位 GB。 |
| `usage_percentage` | 使用百分比。      |

## 按日期查询流量消费明细

```bash theme={null}
curl -X GET "https://backend.ztproxy.net/api/agent/getFlowConsumeDetail?startDate=2026-05-01&endDate=2026-05-26" \
  -H "Authorization: Bearer <token>"
```

日期格式为 `YYYY-MM-DD`，开始日期不能大于结束日期。

## 查询账户总流量

```bash theme={null}
curl -X GET "https://backend.ztproxy.net/api/agent/getFlowTotalFull" \
  -H "Authorization: Bearer <token>"
```

该接口查询账户多类型流量总计。

## 修改动态子账号密码

子账号密码修改请使用动态子账户管理能力。对外路径请以 ZTProxy 支持团队提供的中性路径为准。
