JXWAFJXWAF
首页
JXWAF标准版
JXWAF专业版
JXWAF云WAF
WebTDS
GitHub
首页
JXWAF标准版
JXWAF专业版
JXWAF云WAF
WebTDS
GitHub
  • JXWAF云WAF文档

    • 产品介绍
    • 部署教程
    • 模型服务私有化部署
    • 操作指南(管理控制台)
    • API 调用
    • 用户控制台定制开发指南
    • 性能测试报告
    • 防护能力测试报告

API 调用

概述

JXWAF 云 WAF 管理控制台提供 Admin API(/admin_api/),用于自动化运维与二次开发,包括子账号(业务部门)批量开通、网站接入配置管理、域名接入、全局名单维护、业务数据查询等。

用户控制台对接接口(/user/ API)详见 用户控制台定制开发指南。


一、启用与认证

1.1 启用配置

环境变量默认值说明
ADMIN_API_ENABLEfalse是否启用 Admin API,设为 true 才可访问
ADMIN_API_WHITELISTagent.jxwaf.com调用方白名单(IP/域名,逗号分隔)
  • 管理控制台出厂 docker-compose.yml 默认已设 ADMIN_API_ENABLE: "false",生产环境如需调用请改为 "true"
  • 白名单项可为 IP 或域名;域名会被解析为 IP 后匹配,解析结果缓存 300 秒

1.2 认证方式

通过 HTTP 请求头 jxwaf-waf-auth 携带主账号 waf_auth:

jxwaf-waf-auth: <waf_auth_token>

waf_auth 可在管理控制台 系统管理 → 基础配置 查看。请求头名称使用连字符(下划线请求头会被丢弃)。

1.3 请求与响应格式

  • Method:POST(约定使用 POST)
  • Content-Type:application/json
  • Body:JSON 格式,参数通过 JSON Body 传递

请求示例:

curl -X POST http://<host>/admin_api/get_sub_account_list \
  -H "jxwaf-waf-auth: <your_waf_auth>" \
  -H "Content-Type: application/json" \
  -d '{"page": 1}'

响应格式(统一 HTTP 200,通过 result 判断成败):

响应类型格式
操作成功{"result": true, "message": "create success"}
操作失败{"result": false, "message": "错误原因"}
分页列表{"result": true, "records": [...], "page": 1, "total_pages": 5, "total_records": 250}
单条详情{"result": true, "message": {记录对象}}

通用错误响应:

场景响应 Body
Admin API 未启用{"result": false, "message": "admin api is not enabled"}
客户端 IP 不在白名单{"result": false, "message": "ip not allowed"}
waf_auth 缺失或无效{"result": false, "message": "waf_auth fail"}
必填参数缺失{"result": false, "message": "param is null"}

二、接口清单

以下接口路径前需加 /admin_api 前缀。除特别说明外,所有接口均需 jxwaf-waf-auth 认证。

子账号管理

接口路径说明
/get_sub_account_list子账号列表(分页,含域名数/证书数/引擎状态)
/get_sub_account_search_list搜索子账号列表
/get_sub_account获取单个子账号详情
/create_sub_account创建子账号
/delete_sub_account删除子账号
/edit_sub_account编辑子账号
/edit_sub_account_waf_auth重置子账号 waf_auth
/api_get_sub_account_list批量获取所有子账号(无分页,含 waf_auth)
/reset_sub_account_otp主账号代重置子账号 OTP 密钥

网站接入配置管理

接口路径说明
/get_website_access_conf_list / /api_get_website_access_conf_list接入配置列表(后者含全部字段)
/get_website_access_conf获取单个接入配置
/create_website_access_conf / /edit_website_access_conf / /delete_website_access_conf创建/编辑/删除接入配置
/website_access_conf_connect_testDNS 凭据连接测试
/get_resource_quota_template获取资源配额模板
/get_domain_cname_ip_list / /domain_cname_edit / /website_access_conf_update_syncCNAME IP 与同步管理

域名管理

接口路径说明
/get_domain_list / /get_domain_search_list域名列表 / 搜索
/get_domain / /api_get_domain_list域名详情 / 批量获取
/create_domain / /edit_domain / /delete_domain创建(CNAME 自动接入)/ 编辑 / 删除

防护配置(子账号维度)

接口路径说明
/get_sub_account_web_engine_protection / /edit_...Web 防护引擎
/get_sub_account_web_rule_protection_list / create / edit / delete / edit_status / exchange_priorityWeb 防护规则
/get_sub_account_web_white_rule_*Web 白名单规则
/get_sub_account_web_page_tamper_proof_*网页防篡改
/get_sub_account_flow_engine_protection / /edit_...流量防护引擎
/get_sub_account_flow_rule_protection_*流量防护规则
/get_sub_account_flow_white_rule_*流量白名单规则
/get_sub_account_flow_ip_region_block / /edit_...IP 区域封禁

自定义配置(子账号维度):/get_sub_account_custom_request_header_*、/get_sub_account_custom_response_header_*、/get_sub_account_custom_response_content_*、/get_sub_account_custom_upstream_address_*(每类含 list/get/create/edit/delete/edit_status/exchange_priority)

SSL 证书:/get_sub_account_ssl_manage_list、/create_sub_account_ssl_manage、/request_wildcard_cert、/retry_sub_account_ssl_cert、/edit_sub_account_ssl_cert_config 等

缓存管理:/get_sub_account_cache_policy_*、/get_sub_account_no_cache_policy_*、/get_sub_account_cache_bypass_policy_*、/create_cache_warmup_task、/get_cache_warmup_list、/create_cache_refresh_task、/get_cache_refresh_list 等

全局名单与防护组件

接口路径说明
/get_global_name_list_list / create / edit / delete / edit_status / exchange_priority全局名单
/get_name_list_item_list_list / create_global_name_list_item / delete_global_name_list_item / search_global_name_list_item名单条目
/get_component_list / create / edit / delete / edit_status / exchange_priority防护组件
/get_global_ssl_protection / /edit_global_ssl_protection全局 SSL 协议防护

系统配置:/get_sys_log_conf / /edit_sys_log_conf(日志传输)、/get_sys_report_conf_conf / /edit_sys_report_conf_conf / /test_sys_report_conf_conf(日志查询)、/get_sys_custom_page_conf / /edit_sys_custom_page_conf(拦截页面)、/get_sys_webtds_check_conf / /edit_sys_webtds_check_conf(WebTDS)、/waf_conf_backup / /waf_conf_load(配置备份/加载)

SOC 安全运营:/get_soc_usage_stat_*、/get_soc_web_attack_*、/get_soc_flow_attack_*、/get_soc_attack_event_list、/get_soc_log_query_list、/get_soc_network_ip_* 等

节点监控:/get_node_monitor_list、/delete_node_monitor


三、关键接口详解

3.1 创建子账号

接口地址:POST /admin_api/create_sub_account

请求参数:

参数名类型必填说明
sub_user_namestring是子账号用户名(唯一)
user_passwordstring是子账号密码(MD5 后存库)
sub_otp_authstring是是否启用 OTP("true" / "false")
website_access_confstring是绑定的网站接入配置名(需提前创建,不能为空)

请求示例:

curl -X POST http://<host>/admin_api/create_sub_account \
  -H "jxwaf-waf-auth: <your_waf_auth>" \
  -H "Content-Type: application/json" \
  -d '{
    "sub_user_name": "client01",
    "user_password": "password123",
    "sub_otp_auth": "false",
    "website_access_conf": "default_conf"
  }'

返回示例:

{
  "result": true,
  "message": "create success"
}

当 sub_otp_auth 为 "true" 时,返回额外包含 OTP 绑定信息:

{
  "result": true,
  "message": "create success",
  "otp_secret_key": "<base32密钥>",
  "otp_auth_url": "otpauth://totp/..."
}

错误示例:

响应 Body说明
{"result": false, "message": "sub_user_name is exist"}子账号名已存在
{"result": false, "message": "website_access_conf is required"}接入配置为空

3.2 获取子账号列表

接口地址:POST /admin_api/get_sub_account_list

请求参数:

参数名类型必填说明
pageinteger是页码,pageSize 固定 50

返回参数:

参数名类型说明
resultboolean是否成功
recordsarray子账号列表
records[].sub_user_namestring子账号用户名
records[].waf_authstring子账号认证密钥
records[].sub_otp_authstring是否启用 OTP
records[].website_access_confstring绑定的接入配置名
records[].domain_countinteger域名数量
records[].ssl_cert_countintegerSSL 证书数量
records[].web_engine_statusstringWeb 防护引擎状态
records[].flow_engine_statusstring流量防护引擎状态
page / total_pages / total_recordsinteger分页信息

返回示例:

{
  "result": true,
  "records": [
    {
      "sub_user_name": "client01",
      "waf_auth": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "sub_otp_auth": "false",
      "website_access_conf": "default_conf",
      "domain_count": 3,
      "ssl_cert_count": 2,
      "web_engine_status": "true",
      "flow_engine_status": "false"
    }
  ],
  "page": 1,
  "total_pages": 1,
  "total_records": 1
}

如需一次性获取全部子账号(无分页),可调用 /admin_api/api_get_sub_account_list(无需 page 参数),返回 records 含 user_name, sub_user_name, sub_otp_auth, waf_auth, website_access_conf。

3.3 重置子账号 waf_auth

接口地址:POST /admin_api/edit_sub_account_waf_auth

请求参数:

参数名类型必填说明
sub_user_namestring是子账号用户名

返回示例:

{
  "result": true,
  "message": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}

新 waf_auth 通过 message 字段返回。重置后,原 waf_auth 立即失效,使用该子账号的用户控制台会话需重新登录。

3.4 创建网站接入配置

接口地址:POST /admin_api/create_website_access_conf

请求参数:

参数名类型必填说明
website_access_conf_namestring是配置名称(唯一,不能为 none)
website_access_conf_detailstring是配置描述
website_access_conf_typestring是DNS 服务商:aliyun / tencent / cloudflare
website_access_conf_api_keystring是DNS API Key(阿里云 AccessKey ID / 腾讯云 SecretId / Cloudflare API Token)
website_access_conf_api_secretstring是DNS API Secret(Cloudflare 可空)
website_access_conf_domainstring是接入域名(CNAME 记录使用的根域名,如 acc.jxwaf.com)
website_access_conf_ip_liststring是接入节点 IP 列表(JSON 数组串,如 ["1.1.1.1","2.2.2.2"])
website_access_conf_ttlstring是DNS 记录 TTL(秒,默认 600)
resource_quota_enablestring是是否启用资源配额("true" / "false")
resource_quotastring否配额配置 JSON(仅 resource_quota_enable="true" 时有效,缺省 {})

返回示例:

{
  "result": true,
  "message": "create success"
}

创建接入配置后可调用 /admin_api/website_access_conf_connect_test(参数同上)验证 DNS 凭据是否有效。

3.5 创建域名

接口地址:POST /admin_api/create_domain

请求参数:

参数名类型必填说明
sub_user_namestring是所属子账号
domainstring是域名/IP,支持通配符(如 *.jxwaf.com)
httpstring是是否启用 HTTP("true"/"false")
httpsstring是是否启用 HTTPS
ssl_domainstring是HTTPS 绑定的证书域名
source_ipstring是回源地址(JSON 数组串,支持 IP 与域名)
source_http_portstring是HTTP 回源端口
source_https_portstring是HTTPS 回源端口
origin_protocolstring是回源协议:http / https / follow
balance_typestring是负载均衡:round_robin / ip_hash
pre_proxystring是WAF 前是否存在代理("true"/"false")
real_ip_confstring是真实 IP 请求头(X-Real-IP / X-Forwarded-For)
connect_timeoutstring是连接超时(秒)
send_timeoutstring是发送超时(秒)
read_timeoutstring是读取超时(秒)
detailstring是网站描述

返回示例:

{
  "result": true,
  "message": "create success"
}

创建域名时,系统自动完成 WAF 侧 DNS 配置并生成 CNAME 接入值。子账号必须已绑定接入配置。

错误示例:

响应 Body说明
{"result": false, "message": "domain is exist"}域名已存在
{"result": false, "message": "domain resolver ip count is 0"}回源地址解析失败
{"result": false, "message": "dns api create a record failed: <err>"}云 DNS 创建 A 记录失败

3.6 获取域名列表

接口地址:POST /admin_api/get_domain_list

请求参数:

参数名类型必填说明
pageinteger是页码,pageSize 固定 50
sub_user_namestring是所属子账号

返回 records 字段:

字段说明
sub_user_name, domain, detail子账号、域名、描述
http, https, ssl_domain协议与证书
source_ip, waf_update_source_ip原始回源地址、解析后的 IP 数组
source_http_port, source_https_port, origin_protocol, balance_type, pre_proxy, real_ip_conf回源与负载均衡配置
connect_timeout, send_timeout, read_timeout超时配置
cnameCNAME 接入值(格式 <域名>.cname.<接入域名>)
cname_status, cname_check_time接入状态("true" 已接入 / "false" 未接入)、检查时间

3.7 全局名单管理

创建全局名单

接口地址:POST /admin_api/create_global_name_list

请求参数:

参数名类型必填说明
name_list_namestring是名单名称(唯一)
name_list_detailstring是名单描述
name_list_rulestring是匹配规则(匹配参数组合)
name_list_actionstring是执行动作(如 block / reject_response / bot_check / network_block / watch 等)
action_valuestring是动作附加参数(如网络封禁持续时间)
name_list_expirestring是是否过期("false" 永久 / "true" 自定义)
name_list_expire_timeinteger是过期时间(秒,name_list_expire="false" 时传 0)

返回示例:

{
  "result": true,
  "message": "create success"
}

添加名单条目

接口地址:POST /admin_api/create_global_name_list_item

请求参数:

参数名类型必填说明
name_list_namestring是目标名单名称
name_list_itemstring是条目内容(如 IP 地址)

返回示例:

新增成功:

{"result": true, "message": "create_success"}

条目已存在(刷新过期时间):

{"result": true, "message": "edit_success"}

错误示例:

{"result": false, "message": "name_list_name 不存在"}

获取名单条目列表

接口地址:POST /admin_api/get_name_list_item_list_list

请求参数:

参数名类型必填说明
pageinteger是页码,pageSize 固定 50
name_list_namestring是名单名称

返回参数:

参数名类型说明
resultboolean是否成功
recordsarray名单条目列表
records[].name_list_namestring所属名单名称
records[].name_list_itemstring条目内容
records[].name_list_expirestring过期时间配置("false" 表示永不过期)
records[].name_list_item_expire_timeinteger条目过期时间戳(Unix 秒,0 表示永不过期)

返回示例:

{
  "result": true,
  "records": [
    {
      "name_list_name": "blacklist",
      "name_list_item": "192.168.1.100",
      "name_list_expire": "86400",
      "name_list_item_expire_time": 1735776000
    }
  ],
  "page": 1,
  "total_pages": 1,
  "total_records": 1
}

删除名单条目

接口地址:POST /admin_api/delete_global_name_list_item

请求参数:

参数名类型必填说明
name_list_namestring是名单名称
name_list_itemstring是要删除的条目内容

返回示例:

{"result": true, "message": "删除成功"}

3.8 业务数据统计概览

接口地址:POST /admin_api/get_soc_usage_stat_overview

请求参数:

参数名类型必填说明
from_timestring是起始时间(YYYY-MM-DD HH:MM:SS)
to_timestring是结束时间
sub_user_namestring否子账号(空则汇总所有子账号)
domainstring否域名(空则汇总所有域名)

返回参数:

参数名类型说明
resultboolean是否成功
overviewobject统计概览
overview.total_requestinteger总请求数
overview.traffic_in / traffic_outinteger入/出方向流量
overview.status_2xx / 3xx / 4xx / 5xxinteger状态码计数
overview.request_latency_avg / upstream_latency_avginteger请求/回源平均时延(ms)
status_detailobject明细状态码计数({http_code: count})

返回示例:

{
  "result": true,
  "overview": {
    "total_request": 125000,
    "traffic_in": 5242880,
    "traffic_out": 10485760,
    "status_2xx": 120000,
    "status_3xx": 2000,
    "status_4xx": 2500,
    "status_5xx": 500,
    "request_latency_avg": 35,
    "upstream_latency_avg": 120
  },
  "status_detail": {
    "200": 118000,
    "301": 2000,
    "404": 2400,
    "500": 500
  },
  "from_time": "2026-08-01 00:00:00",
  "to_time": "2026-08-01 23:59:59"
}

3.9 节点状态列表

接口地址:POST /admin_api/get_node_monitor_list

请求参数:无(仅需 jxwaf-waf-auth 认证)

返回参数:

参数名类型说明
resultboolean是否成功
messagearray节点列表(注意:数组位于 message 字段)
message[].node_uuidstring节点唯一标识
message[].node_hostnamestring节点主机名
message[].node_ipstring节点 IP
message[].node_statusstring健康状态("true" 正常 / "false" 异常,超过 10 分钟无心跳为异常)
message[].node_status_update_timeinteger心跳时间
message[].waf_conf_update_timeinteger配置同步时间

返回示例:

{
  "result": true,
  "message": [
    {
      "node_uuid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "node_hostname": "node-01",
      "node_ip": "1.1.1.1",
      "node_status": "true",
      "node_status_update_time": 1722470400,
      "waf_conf_update_time": 1722470300
    }
  ]
}

四、使用场景

场景1:批量开通部门

IT 运维团队通过 API 自动化开通部门:先创建接入配置,再创建子账号并绑定。

# 1. 创建网站接入配置
curl -X POST http://<host>/admin_api/create_website_access_conf \
  -H "jxwaf-waf-auth: <your_waf_auth>" \
  -H "Content-Type: application/json" \
  -d '{
    "website_access_conf_name": "default_conf",
    "website_access_conf_detail": "默认接入配置",
    "website_access_conf_type": "aliyun",
    "website_access_conf_api_key": "<AccessKey ID>",
    "website_access_conf_api_secret": "<AccessKey Secret>",
    "website_access_conf_domain": "acc.jxwaf.com",
    "website_access_conf_ip_list": "[\"1.1.1.1\",\"2.2.2.2\"]",
    "website_access_conf_ttl": "600",
    "resource_quota_enable": "false"
  }'

# 2. 创建子账号并绑定接入配置
curl -X POST http://<host>/admin_api/create_sub_account \
  -H "jxwaf-waf-auth: <your_waf_auth>" \
  -H "Content-Type: application/json" \
  -d '{
    "sub_user_name": "client01",
    "user_password": "password123",
    "sub_otp_auth": "false",
    "website_access_conf": "default_conf"
  }'

场景2:通过外部系统自动封禁攻击 IP

当安全设备检测到攻击行为时,调用名单条目接口自动将攻击 IP 加入黑名单:

# 添加攻击 IP 到黑名单(已存在则刷新过期时间)
curl -X POST http://<host>/admin_api/create_global_name_list_item \
  -H "jxwaf-waf-auth: <your_waf_auth>" \
  -H "Content-Type: application/json" \
  -d '{
    "name_list_name": "auto_blacklist",
    "name_list_item": "203.0.113.50"
  }'

解封特定 IP:

curl -X POST http://<host>/admin_api/delete_global_name_list_item \
  -H "jxwaf-waf-auth: <your_waf_auth>" \
  -H "Content-Type: application/json" \
  -d '{
    "name_list_name": "auto_blacklist",
    "name_list_item": "203.0.113.50"
  }'

场景3:域名接入自动化

通过 Admin API 为子账号创建域名:

curl -X POST http://<host>/admin_api/create_domain \
  -H "jxwaf-waf-auth: <your_waf_auth>" \
  -H "Content-Type: application/json" \
  -d '{
    "sub_user_name": "client01",
    "domain": "demo.jxwaf.com",
    "http": "true",
    "https": "true",
    "ssl_domain": "demo.jxwaf.com",
    "source_ip": "[\"1.2.3.4\"]",
    "source_http_port": "80",
    "source_https_port": "443",
    "origin_protocol": "http",
    "balance_type": "round_robin",
    "pre_proxy": "false",
    "real_ip_conf": "X-Real-IP",
    "connect_timeout": "5",
    "send_timeout": "60",
    "read_timeout": "60",
    "detail": "演示站点"
  }'

创建后调用 /admin_api/get_domain_list 获取 cname 值。部门在用户控制台配置 DNS 自动接入后,系统自动完成 CNAME 解析。

场景4:查询业务运行数据

查询指定部门某时间段的业务统计概览:

curl -X POST http://<host>/admin_api/get_soc_usage_stat_overview \
  -H "jxwaf-waf-auth: <your_waf_auth>" \
  -H "Content-Type: application/json" \
  -d '{
    "from_time": "2026-08-01 00:00:00",
    "to_time": "2026-08-01 23:59:59",
    "sub_user_name": "client01"
  }'
Prev
操作指南(管理控制台)
Next
用户控制台定制开发指南