itecdn 5.x用户文档
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 同时发送。"
  }
}

请求参数

参数位置类型必填说明与约束
pagequeryinteger可选

页码,必须为数字,默认 1。

完整参数定义
{
  "name": "page",
  "in": "query",
  "required": false,
  "description": "页码,必须为数字,默认 1。",
  "schema": {
    "type": "integer",
    "minimum": 1,
    "default": 1
  }
}
limitqueryinteger可选

每页条数,必须为数字,默认 10。action=export 时服务端忽略该值并查询全部。

完整参数定义
{
  "name": "limit",
  "in": "query",
  "required": false,
  "description": "每页条数,必须为数字,默认 10。action=export 时服务端忽略该值并查询全部。",
  "schema": {
    "type": "integer",
    "minimum": 0,
    "default": 10
  }
}
uidqueryinteger可选

仅管理员有效:按黑名单所属用户 ID 精确筛选;普通用户传入时仍仅查询自身。

完整参数定义
{
  "name": "uid",
  "in": "query",
  "required": false,
  "description": "仅管理员有效:按黑名单所属用户 ID 精确筛选;普通用户传入时仍仅查询自身。",
  "schema": {
    "type": "integer",
    "example": 12
  }
}
ipquerystring可选

黑名单 IP 精确筛选。

完整参数定义
{
  "name": "ip",
  "in": "query",
  "required": false,
  "description": "黑名单 IP 精确筛选。",
  "schema": {
    "type": "string",
    "example": "192.0.2.10"
  }
}
site_idqueryinteger可选

网站 ID 精确筛选。

完整参数定义
{
  "name": "site_id",
  "in": "query",
  "required": false,
  "description": "网站 ID 精确筛选。",
  "schema": {
    "type": "integer",
    "example": 123
  }
}
startquerystring可选

创建时间下界;只有同时传 end 才生效,直接交给数据库比较。

完整参数定义
{
  "name": "start",
  "in": "query",
  "required": false,
  "description": "创建时间下界;只有同时传 end 才生效,直接交给数据库比较。",
  "schema": {
    "type": "string",
    "example": "2026-01-01 00:00:00"
  }
}
endquerystring可选

创建时间上界(不含);只有同时传 start 才生效,直接交给数据库比较。

完整参数定义
{
  "name": "end",
  "in": "query",
  "required": false,
  "description": "创建时间上界(不含);只有同时传 start 才生效,直接交给数据库比较。",
  "schema": {
    "type": "string",
    "example": "2026-01-02 00:00:00"
  }
}
actionquerystring可选

传 export 时下载所有匹配 IP 的去重文本;其他值按普通查询处理。

完整参数定义
{
  "name": "action",
  "in": "query",
  "required": false,
  "description": "传 export 时下载所有匹配 IP 的去重文本;其他值按普通查询处理。",
  "schema": {
    "type": "string",
    "enum": [
      "export"
    ]
  }
}

响应

HTTP 200

普通查询返回 JSON;导出返回 text/plain 附件。

application/json

object

字段类型必填说明与约束
codeinteger必填

历史黑名单列表查询成功时固定为 0。

约束 / 默认值 / 示例
{
  "enum": [
    0
  ]
}
countinteger必填

未应用分页前的匹配历史记录总数。

约束 / 默认值 / 示例
{
  "minimum": 0
}
dataarray <object>必填

当前页历史黑名单。

展开字段结构

当前页历史黑名单。

数组元素 · object
字段类型必填说明与约束
site_idinteger必填

网站 ID。

约束 / 默认值 / 示例
{
  "nullable": true
}
ipstring必填

被封禁 IP。

约束 / 默认值 / 示例
{
  "nullable": true
}
filterstring必填

关联 CC 过滤器 ID 原始值。

约束 / 默认值 / 示例
{
  "nullable": true
}
uidinteger必填

黑名单所属用户 ID。

约束 / 默认值 / 示例
{
  "nullable": true
}
expany必填

过期时间,保持数据库原始类型。

create_atstring (date-time)必填

创建时间。

约束 / 默认值 / 示例
{
  "format": "date-time",
  "nullable": true
}
positionstring必填

黑名单位置描述。

约束 / 默认值 / 示例
{
  "nullable": true
}
auto_unlockinteger必填

自动解锁标记的数据库布尔值。

约束 / 默认值 / 示例
{
  "enum": [
    0,
    1
  ],
  "nullable": true
}
domainstring必填

关联网站域名;网站不存在时为空。

约束 / 默认值 / 示例
{
  "nullable": true
}
fnamestring必填

关联 CC 过滤器名称;过滤器不存在时为空。

约束 / 默认值 / 示例
{
  "nullable": true
}
完整 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"

查看完整接口 JSON