itecdn 5.x / 用户 API
查询历史黑名单记录
GET
/v1/monitor/site/history-blackip分页查询 MySQL black_ip 表的历史黑名单,包含已过期记录,按创建时间倒序返回。接口要求登录。普通用户仅能查询自身 uid;管理员可查询全量或用 uid 筛选指定用户。时间条件仅在 start 与 end 同时传入时生效。传 action=export 时返回全部匹配记录的去重 IP 纯文本。
身份认证
access-token
api-key + api-secret
认证定义
{
"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 同时发送。"
}
}请求参数
| 参数 | 位置 | 类型 | 必填 | 说明与约束 |
|---|---|---|---|---|
page | query | integer | 可选 | 页码,必须为数字,默认 1。 完整参数定义 |
limit | query | integer | 可选 | 每页条数,必须为数字,默认 10。action=export 时服务端忽略该值并查询全部。 完整参数定义 |
uid | query | integer | 可选 | 仅管理员有效:按黑名单所属用户 ID 精确筛选;普通用户传入时仍仅查询自身。 完整参数定义 |
ip | query | string | 可选 | 黑名单 IP 精确筛选。 完整参数定义 |
site_id | query | integer | 可选 | 网站 ID 精确筛选。 完整参数定义 |
start | query | string | 可选 | 创建时间下界;只有同时传 end 才生效,直接交给数据库比较。 完整参数定义 |
end | query | string | 可选 | 创建时间上界(不含);只有同时传 start 才生效,直接交给数据库比较。 完整参数定义 |
action | query | string | 可选 | 传 export 时下载所有匹配 IP 的去重文本;其他值按普通查询处理。 完整参数定义 |
响应
HTTP 200
普通查询返回 JSON;导出返回 text/plain 附件。
application/json
object
| 字段 | 类型 | 必填 | 说明与约束 | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
code | integer | 必填 | 历史黑名单列表查询成功时固定为 0。 约束 / 默认值 / 示例 | ||||||||||||||||||||||||||||||||||||||||||||
count | integer | 必填 | 未应用分页前的匹配历史记录总数。 约束 / 默认值 / 示例 | ||||||||||||||||||||||||||||||||||||||||||||
data | array <object> | 必填 | 当前页历史黑名单。 展开字段结构当前页历史黑名单。 数组元素 · object
|
完整 Schema
{
"type": "object",
"required": [
"code",
"count",
"data"
],
"properties": {
"code": {
"type": "integer",
"enum": [
0
],
"description": "历史黑名单列表查询成功时固定为 0。"
},
"count": {
"type": "integer",
"minimum": 0,
"description": "未应用分页前的匹配历史记录总数。"
},
"data": {
"type": "array",
"description": "当前页历史黑名单。",
"items": {
"type": "object",
"required": [
"site_id",
"ip",
"filter",
"uid",
"exp",
"create_at",
"position",
"auto_unlock",
"domain",
"fname"
],
"properties": {
"site_id": {
"type": "integer",
"nullable": true,
"description": "网站 ID。"
},
"ip": {
"type": "string",
"nullable": true,
"description": "被封禁 IP。"
},
"filter": {
"type": "string",
"nullable": true,
"description": "关联 CC 过滤器 ID 原始值。"
},
"uid": {
"type": "integer",
"nullable": true,
"description": "黑名单所属用户 ID。"
},
"exp": {
"description": "过期时间,保持数据库原始类型。"
},
"create_at": {
"type": "string",
"format": "date-time",
"nullable": true,
"description": "创建时间。"
},
"position": {
"type": "string",
"nullable": true,
"description": "黑名单位置描述。"
},
"auto_unlock": {
"type": "integer",
"enum": [
0,
1
],
"nullable": true,
"description": "自动解锁标记的数据库布尔值。"
},
"domain": {
"type": "string",
"nullable": true,
"description": "关联网站域名;网站不存在时为空。"
},
"fname": {
"type": "string",
"nullable": true,
"description": "关联 CC 过滤器名称;过滤器不存在时为空。"
}
},
"additionalProperties": false
}
}
},
"additionalProperties": false
}示例
{
"code": 0,
"count": 1,
"data": [
{
"site_id": 123,
"ip": "192.0.2.10",
"filter": "8",
"uid": 12,
"exp": 1767312000,
"create_at": "2026-01-01T12:00:00",
"position": "",
"auto_unlock": 1,
"domain": "www.example.invalid",
"fname": "默认 CC 过滤器"
}
]
}text/plain
string
仅 action=export 返回:去重后的 IP 列表,每行一个。
完整 Schema
{
"type": "string",
"description": "仅 action=export 返回:去重后的 IP 列表,每行一个。"
}示例
192.0.2.10
198.51.100.20
cURL 示例
根据文档生成;请替换主控地址、路径参数和凭证,并按上表补充查询参数。
curl --request GET \
"https://master.example.invalid/v1/monitor/site/history-blackip" \
--header "access-token: YOUR_ACCESS_TOKEN"