{
  "tags": [
    "网站监控"
  ],
  "description": "按 IP、国家、省份、运营商、URL、域名端口、TLS 指纹或 Referer 聚合访问日志。需要登录；普通用户仅查询自己的 uid 且传入域名必须属于自己，管理员查询全量。榜单条数由系统 `res_rank_size` 配置决定。",
  "operationId": "user_get_v1_monitor_site_top",
  "security": [
    {
      "AccessToken": []
    },
    {
      "ApiKey": [],
      "ApiSecret": []
    }
  ],
  "responses": {
    "200": {
      "description": "成功、参数和域名权限错误均返回 HTTP 200。日志库异常或无聚合时成功返回空数组。",
      "content": {
        "application/json": {
          "schema": {
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "code",
                  "msg",
                  "data"
                ],
                "properties": {
                  "code": {
                    "type": "integer",
                    "enum": [
                      0
                    ],
                    "description": "网站资源排行查询成功时固定为 0。"
                  },
                  "msg": {
                    "type": "string",
                    "enum": [
                      ""
                    ],
                    "description": "网站资源排行查询成功时固定为空字符串。"
                  },
                  "data": {
                    "type": "array",
                    "description": "排行数据。",
                    "items": {
                      "type": "object",
                      "required": [
                        "traffic",
                        "up_recv",
                        "count",
                        "res"
                      ],
                      "properties": {
                        "traffic": {
                          "type": "number",
                          "description": "bytes_sent 总和。"
                        },
                        "up_recv": {
                          "type": "number",
                          "description": "up_recv 总和。"
                        },
                        "count": {
                          "type": "integer",
                          "minimum": 0,
                          "description": "请求文档数。"
                        },
                        "res": {
                          "type": "string",
                          "description": "资源值：IP、地理字段、运营商、URL、域名端口、TLS 指纹或 Referer，由 type 决定。"
                        }
                      },
                      "additionalProperties": false
                    }
                  }
                },
                "additionalProperties": false
              },
              {
                "type": "object",
                "required": [
                  "code",
                  "msg",
                  "data"
                ],
                "properties": {
                  "code": {
                    "type": "string",
                    "enum": [
                      "monitor_top-1",
                      "monitor_top-2",
                      "monitor_top-3",
                      "monitor_top-4",
                      "monitor_top-5",
                      "monitor_top-6",
                      "monitor_top-7",
                      "monitor_top-8",
                      "monitor_top-9",
                      "login_required"
                    ],
                    "description": "域名权限、类型、时间、recent_time、端口或认证失败的业务错误码。"
                  },
                  "msg": {
                    "type": "string",
                    "description": "排行类型、时间范围、域名权限或认证失败的具体原因。"
                  },
                  "data": {
                    "type": "string",
                    "enum": [
                      ""
                    ],
                    "description": "发生业务错误时固定返回空字符串。"
                  }
                },
                "additionalProperties": false
              }
            ]
          },
          "examples": {
            "success": {
              "summary": "Top IP",
              "value": {
                "code": 0,
                "msg": "",
                "data": [
                  {
                    "traffic": 1048576,
                    "up_recv": 1024,
                    "count": 42,
                    "res": "192.0.2.10"
                  }
                ]
              }
            }
          },
          "example": {
            "code": 0,
            "msg": "",
            "data": [
              {
                "traffic": 1048576,
                "up_recv": 1024,
                "count": 42,
                "res": "192.0.2.10"
              }
            ]
          }
        }
      }
    }
  },
  "x-python-handler": "monitor.TopAPI",
  "x-python-route-line": 744,
  "x-audience": "user",
  "x-auth": "user",
  "x-reviewed": true,
  "parameters": [
    {
      "name": "type",
      "in": "query",
      "required": true,
      "description": "排行维度。",
      "schema": {
        "type": "string",
        "enum": [
          "top-ip",
          "top-country",
          "top-province",
          "top-isp",
          "top-url",
          "top-domain",
          "top-tls-fp",
          "top-referer"
        ]
      }
    },
    {
      "name": "recent_time",
      "in": "query",
      "required": false,
      "description": "最近时间窗口；提供时忽略 start/end，仅支持 10m、30m、60m。",
      "schema": {
        "type": "string",
        "enum": [
          "10m",
          "30m",
          "60m"
        ]
      }
    },
    {
      "name": "start",
      "in": "query",
      "required": false,
      "description": "自定义开始时间（含）；未传 recent_time 时与 end 一同必填，格式 YYYY-MM-DD HH:mm:ss，跨度不超过 1.5 小时。",
      "schema": {
        "type": "string",
        "example": "2026-01-01 00:00:00"
      }
    },
    {
      "name": "end",
      "in": "query",
      "required": false,
      "description": "自定义结束时间（不含）；未传 recent_time 时与 start 一同必填。",
      "schema": {
        "type": "string",
        "example": "2026-01-01 01:00:00"
      }
    },
    {
      "name": "domain",
      "in": "query",
      "required": false,
      "description": "空格分隔域名筛选；普通用户只能传自身域名。",
      "schema": {
        "type": "string",
        "example": "www.example.invalid"
      }
    },
    {
      "name": "server_port",
      "in": "query",
      "required": false,
      "description": "源站端口精确筛选，必须为合法端口。",
      "schema": {
        "type": "string",
        "example": "443"
      }
    },
    {
      "name": "cc",
      "in": "query",
      "required": false,
      "description": "攻击流量模式：0（默认）全部流量；1 仅统计窗口内出现过 HTTP 444 的 IP。管理员生成攻击 IP 候选集时不应用域名和端口筛选。",
      "schema": {
        "type": "string",
        "enum": [
          "0",
          "1"
        ],
        "default": "0"
      }
    }
  ],
  "x-itecdn-source-reviewed": true,
  "extensions": [
    {
      "key": "x-python-handler",
      "value": "monitor.TopAPI"
    },
    {
      "key": "x-python-route-line",
      "value": 744
    },
    {
      "key": "x-audience",
      "value": "user"
    },
    {
      "key": "x-auth",
      "value": "user"
    },
    {
      "key": "x-reviewed",
      "value": true
    },
    {
      "key": "x-itecdn-source-reviewed",
      "value": true
    }
  ],
  "method": "get",
  "path": "/v1/monitor/site/top",
  "servers": [
    {
      "url": "https://master.example.invalid",
      "description": "不可调用的示例地址；复制示例后替换为自己的主控域名。"
    }
  ],
  "securitySchemes": {
    "AccessToken": {
      "type": "apiKey",
      "in": "header",
      "name": "access-token",
      "description": "通过登录接口获得的短期访问令牌。"
    },
    "ApiKey": {
      "type": "apiKey",
      "in": "header",
      "name": "api-key",
      "description": "API Key；必须和 api-secret 同时发送。"
    },
    "ApiSecret": {
      "type": "apiKey",
      "in": "header",
      "name": "api-secret",
      "description": "API Secret；必须和 api-key 同时发送。"
    }
  },
  "info": {
    "title": "itecdn v5 用户 API",
    "version": "5.x",
    "description": "itecdn v5.x Python 主控用户 API。本文档不适用于 v6 或其它实现。"
  },
  "postman": {
    "name": "查询网站访问 Top 排行榜",
    "description": {
      "content": "按 IP、国家、省份、运营商、URL、域名端口、TLS 指纹或 Referer 聚合访问日志。需要登录；普通用户仅查询自己的 uid 且传入域名必须属于自己，管理员查询全量。榜单条数由系统 `res_rank_size` 配置决定。",
      "type": "text/plain"
    },
    "url": {
      "path": [
        "v1",
        "monitor",
        "site",
        "top"
      ],
      "host": [
        "{{baseUrl}}"
      ],
      "query": [
        {
          "disabled": false,
          "description": {
            "content": "(Required) 排行维度。",
            "type": "text/plain"
          },
          "key": "type",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "最近时间窗口；提供时忽略 start/end，仅支持 10m、30m、60m。",
            "type": "text/plain"
          },
          "key": "recent_time",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "自定义开始时间（含）；未传 recent_time 时与 end 一同必填，格式 YYYY-MM-DD HH:mm:ss，跨度不超过 1.5 小时。",
            "type": "text/plain"
          },
          "key": "start",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "自定义结束时间（不含）；未传 recent_time 时与 start 一同必填。",
            "type": "text/plain"
          },
          "key": "end",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "空格分隔域名筛选；普通用户只能传自身域名。",
            "type": "text/plain"
          },
          "key": "domain",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "源站端口精确筛选，必须为合法端口。",
            "type": "text/plain"
          },
          "key": "server_port",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "攻击流量模式：0（默认）全部流量；1 仅统计窗口内出现过 HTTP 444 的 IP。管理员生成攻击 IP 候选集时不应用域名和端口筛选。",
            "type": "text/plain"
          },
          "key": "cc",
          "value": ""
        }
      ],
      "variable": []
    },
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "method": "GET",
    "auth": {
      "type": "apikey",
      "apikey": [
        {
          "type": "any",
          "value": "access-token",
          "key": "key"
        },
        {
          "type": "any",
          "value": "{{apiKey}}",
          "key": "value"
        },
        {
          "type": "any",
          "value": "header",
          "key": "in"
        }
      ]
    }
  }
}