API Docs

ipx.ee API 提供纯文本 IP 接口与 GeoIP JSON 接口,支持脚本调用与业务接入。

ipx.ee API provides plain-text IP endpoints and GeoIP JSON endpoints for script and service integration.

IP (Plain Text)

返回访客公网出口 IP(纯文本),适用于自动化脚本与网络通道检测。

Returns the visitor public egress IP in plain text, designed for automation and network path checks.

一、功能说明 Overview
  • 返回访客公网 IP(Public Egress IP)。
  • 响应格式为纯文本(text/plain),不包含 JSON 包装。
  • 支持 IPv4 IPv6。
  • Dual Stack 指同一入口可同时响应 IPv4 与 IPv6,请求最终返回值取决于客户端实际连通通道。
  • Returns the visitor public IP address.
  • Response format is plain text (text/plain) without JSON envelope.
  • Supports IPv4 and IPv6.
  • Dual Stack means one endpoint serves both IPv4 and IPv6; output depends on the client's active network path.
二、接口地址 Endpoints
三、使用示例 Examples

curl 示例

curl ipx.ee
curl -4 ipx.ee
curl -6 ipx.ee
curl -4 ipx.ee
curl -6 ipx.ee

Linux shell 示例(变量赋值)

#!/bin/sh
ip="$(curl -fsS https://ipx.ee)"
echo "Current public IP: ${ip}"

Node.js

const res = await fetch('https://ipx.ee');
const ip = (await res.text()).trim();
console.log(ip);

Python

import requests
ip = requests.get('https://ipx.ee', timeout=5).text.strip()
print(ip)

PHP

<?php
$ip = trim(file_get_contents('https://ipx.ee'));
echo $ip;
四、注释说明 Notes
  • 返回值是访问者当前公网出口 IP,不是内网地址。
  • 若客户端启用 VPN Proxy,返回对应出口节点 IP。
  • 双栈环境中,结果取决于客户端实际请求走的 IPv4 或 IPv6 通道。
  • 不建议对结果做长期缓存,建议按业务实时获取。
五、应用场景 Use Cases
  • DDNS 自动更新
  • 服务器公网 IP 检测
  • IPv6 连通性测试
  • 自动防火墙白名单
  • CI CD 出口确认

JSON IP

返回访客公网 IP 的 JSON 格式数据,支持 JSONP 回调。

Returns visitor public IP in JSON format with optional JSONP callback support.

一、功能说明 Overview
  • 输出结构化 JSON,适合前端脚本直接消费。
  • 成功响应仅包含一个字段:ip
  • 支持 callback 参数返回 JSONP。
  • 返回值为访问者当前公网出口 IP。
二、接口地址 Endpoint
三、请求示例 Request Examples
curl "https://ipx.ee/api/jsonip"
curl "https://ipx.ee/api/jsonip?callback=getip"
四、返回示例 Response Example
{
  "ip": "8.8.8.8"
}
getip({"ip":"8.8.8.8"});
五、注释说明 Notes
  • 成功 JSON 响应固定为 {\"ip\":\"...\"},不附加其它元字段。
  • 未传 callback 时返回 application/json
  • 传 callback 时返回 application/javascript
  • callback 仅允许合法函数名。

GeoIP (JSON)

查询目标 IP 或域名对应的 GeoIP 与网络信息,返回结构化 JSON 数据。

Query GeoIP and network attributes for an IP or domain, returned as structured JSON.

一、功能说明 Overview
  • 用于获取 IP 地理位置与网络归属信息。
  • 响应格式为 JSON(application/json)。
  • 输出结构固定为 5 个顶层字段:ipgeonetworkflagsmeta
  • 支持 IPv4 IPv6 Domain。
  • 传入域名时,服务会先执行 DNS 解析,再返回解析到的 IP 信息。
二、接口地址 Endpoint
GET https://ipx.ee/api/geoip/{target}
  • {target} 支持 IPv4、IPv6 或域名 Domain。
  • IPv4 示例:8.8.8.8
  • IPv6 示例:2001:4860:4860::8888
  • Domain 示例:example.com
三、请求示例 Request Examples
curl "https://ipx.ee/api/geoip/8.8.8.8"
curl "https://ipx.ee/api/geoip/2001:4860:4860::8888"
curl "https://ipx.ee/api/geoip/example.com"
curl "https://ipx.ee/api/geoip/8.8.8.8?callback=getgeoip"
四、返回示例 Response Example JSON
{
  "ip": "8.8.8.8",
  "geo": {
    "continent": "North America",
    "country": "United States",
    "country_code": "US",
    "region": "CA",
    "region_name": "California",
    "city": "Mountain View",
    "zip": "94043",
    "latitude": 37.38605,
    "longitude": -122.08385,
    "timezone": "America/Los_Angeles"
  },
  "network": {
    "reverse": "dns.google",
    "isp": "Google LLC",
    "org": "Google LLC",
    "as_name": "GOOGLE",
    "asn": 15169,
    "as_org": "Google LLC"
  },
  "flags": {
    "hosting": true,
    "proxy": false,
    "mobile": false
  },
  "meta": {
    "source": "ipapi.is",
    "requested_at": "2026-02-16T08:10:00+08:00",
    "cached": false,
    "cache_group": "ip",
    "cache_saved_at": "",
    "ok": true
  }
}
五、字段说明 Field Description
  • ip:目标 IP(由上游 query 映射而来)。
  • geo:地理信息分组,包含 continent/country/country_code/region/region_name/city/zip/latitude/longitude/timezone
  • network:网络信息分组,包含 reverse/isp/org/as_name/asn/as_org
  • flags:属性标记分组,包含 hosting/proxy/mobile
  • meta:请求元信息分组,包含 source/requested_at/cached/cache_group/cache_saved_at/ok
  • meta.ok=false 时,返回 meta.error.codemeta.error.message
六、注释说明 Notes
Please note that the IP location database may not contain all information about a given IP. In this case, only the available data is displayed.
  • 地理位置为 IP 归属地推断,不是精确定位。
  • 域名查询会先进行 DNS 解析。
  • 建议缓存 GeoIP 数据 7-30 天。
  • 返回 Content-Type: application/json。
  • 上游 status 字段不会透出,错误统一在 meta.error 返回。
七、应用场景 Use Cases
  • 访客地理展示
  • 统计分析
  • 基础风控
  • 日志增强

Rate Limits

频率限制策略用于保证 API 服务稳定性与公平使用,避免滥用与瞬时流量冲击。

Rate limiting policy ensures API stability and fair usage while preventing abuse and burst overload.

一、概览 Overview

为保证服务稳定性与公平使用,IP 与 GeoIP REST API 实施频率限制。

To ensure service stability and fair usage, rate limits are enforced on IP and GeoIP REST APIs.

二、默认限制 Default Limits
  • Plain Text IP: 60 requests / minute / IP
  • GeoIP API: 30 requests / minute / IP
三、限制范围 Limit Scope

限流基于客户端公网 IP 计算。

Limits are enforced per client public IP.

四、超限响应 Exceeded Response

当请求超过限制时,服务返回 HTTP 429 Too Many Requests

HTTP 429 Too Many Requests

{
  "error": {
    "code": "RATE_LIMIT_EXCEEDED",
    "message": "Too many requests. Please slow down."
  }
}
五、响应头(可选) Response Headers
  • X-RateLimit-Limit:当前窗口允许的请求总量。
  • X-RateLimit-Remaining:当前窗口剩余可用请求数。
  • X-RateLimit-Reset:限流窗口重置时间戳(或秒数)。
六、说明 Notes
  • 建议缓存结果,尤其是 GeoIP 数据。
  • 禁止滥用、扫描与高频非正常请求。
  • 违规访问可能触发临时或长期封禁。

Error Codes

所有错误遵循标准 HTTP 状态码,并返回统一错误结构。

All errors follow standard HTTP status codes with a unified error payload.

一、概览 Overview

错误返回采用 HTTP 状态码 + JSON 错误对象。

Error responses use HTTP status codes plus JSON error object.

二、错误返回格式 Error Response Format
{
  "error": {
    "code": "ERROR_CODE",
    "message": "Description"
  }
}
三、常见 HTTP 状态码 Common HTTP Status Codes
HTTP Error Code 说明 Description
400INVALID_TARGET目标缺失或格式错误 / Target is missing or malformed
400INVALID_IPV4IPv4 地址无效 / Invalid IPv4 address
400INVALID_IPV6IPv6 地址无效 / Invalid IPv6 address
400INVALID_DOMAIN域名格式无效 / Invalid domain format
404NOT_FOUND接口或资源不存在 / Endpoint or resource not found
429RATE_LIMIT_EXCEEDED超过请求频率限制 / Request rate limit exceeded
500INTERNAL_ERROR服务器内部错误 / Internal server error
503SERVICE_UNAVAILABLE服务暂时不可用 / Temporary service unavailable
四、错误示例 Error Examples

400 示例

400 Example

{
  "error": {
    "code": "INVALID_TARGET",
    "message": "Target must be a valid IPv4, IPv6, or domain."
  }
}

429 示例

429 Example

{
  "error": {
    "code": "RATE_LIMIT_EXCEEDED",
    "message": "Too many requests. Please slow down."
  }
}
五、说明 Notes
  • Plain Text 接口发生错误时可仅返回 HTTP 状态码与纯文本。
  • GeoIP 接口错误返回 JSON 错误对象。
  • 错误响应不暴露内部实现细节。

出口检测 Usage Guide

本章节说明“出口检测”页面的检测范围、结果解释与使用建议。

This section explains scope, result interpretation, and usage best practices for the Egress Inspector page.

一、功能概览 Overview
  • 检测入口:https://ipx.ee/outbound
  • 覆盖项:主要出口 IPv4/IPv6、DNS 解析出口、WebRTC 候选、站点解析分布。
  • 地图视图:将检测到的有效 IP 显示为地理分布点。
  • Scope includes primary IPv4/IPv6 egress, DNS resolver egress, WebRTC candidates, and site resolution distribution.
  • Detected routable IPs are visualized on the map.
二、检测流程 Workflow
  1. 点击“开始检测”,系统并发执行 IPv4/IPv6、DNS 与 WebRTC 探测。
  2. 收集到的 IP 会进入 GeoIP 归属解析与地图标注流程。
  3. 表格按“出口相关结果 / 站点解析结果 / WebRTC 明细”分组呈现。
  1. Click Start to run IPv4/IPv6, DNS, and WebRTC probes in parallel.
  2. Detected IPs are enriched with geolocation and plotted on map.
  3. Results are grouped into egress table, site DNS table, and WebRTC details.
三、输出解释 Output
  • “主要出口 IPv4/IPv6”:当前浏览通道直接可见的公网出口。
  • “DNS出口”:通过 DNS 相关探测得到的解析路径出口,不一定等于主要出口。
  • “WebRTC”:浏览器 ICE 候选中的公网地址,用于辅助判断是否存在泄露风险。
  • “站点解析”:目标网站 DNS 解析到的 IP 分布,用于判断地域与网络归属。
四、注意事项 Notes
  • 不同网络与浏览器策略会导致结果差异,建议多次检测交叉比对。
  • WebRTC 结果受浏览器权限、扩展与策略影响,不保证每次都返回候选。
  • DNS 出口结果可能呈现多地域节点,这是公共解析基础设施的正常表现。

DNS反查 Usage Guide

本章节说明 DNS反查 页面六种模式的用途、输入要求与 JSON 输出方式。

This section documents all lookup modes, input requirements, and JSON output format.

一、功能概览 Overview
  • 页面入口:https://ipx.ee/lookup
  • 查询模式:DNS Lookup、Reverse DNS Lookup、rDNS 网段扫描、IP 反查域名、rDNS 反查、CNAME 反查。
  • 输出分为:页面结果视图 + 可选 JSON 接口输出(会员可见按钮)。
二、查询模式 Modes
模式 Mode 输入 Input 说明 Description
DNS LookupDomainA / AAAA / MX / CNAME / NS / TXT 实时解析
Reverse DNS LookupSingle IP查询 PTR 记录
rDNS 网段扫描IPv4 CIDR (max /20)批量 PTR 扫描并写入本地索引
IP 反查域名IP or IPv4 CIDR (max /22)基于 PTR/rDNS 能力返回绑定域名
rDNS 反查Keyword + Match左/中/右匹配查询本地 rDNS 索引
CNAME 反查Keyword + Match左/中/右匹配查询本地 CNAME 索引
三、输入规范 Inputs
  • 域名输入会自动归一化为小写;支持中文域名(自动转 Punycode)。
  • 网段扫描仅支持 IPv4 CIDR,且存在最大范围限制(/20 或 /22)。
  • rDNS/CNAME 模式支持左侧、中间、右侧匹配。
四、JSON 输出 JSON Output
GET /lookup/{query}?dns_type=dns_lookup&output=json
GET /lookup/{query}?dns_type=rdns_pattern&dns_match=right&output=json
  • 统一返回结构:ok / query / summary / data / meta
  • 空输入通常返回 400 INVALID_INPUT;查询失败返回 422 QUERY_FAILED
五、注意事项 Notes
  • IP 反查域名与 rDNS 结果基于 PTR/本地索引,不等同于全量被动 DNS 数据。
  • 如需更高覆盖率,建议持续运行网段扫描并定时导入被动 DNS 数据源。
  • DNS 结果会受权威记录 TTL 与上游网络策略影响。

Whois RDAP Usage Guide

本章节说明 Whois RDAP 页面查询目标、结果字段与使用建议。

This section explains query targets, returned fields, and best practices for Whois/RDAP page.

一、功能概览 Overview
  • 页面入口:https://ipx.ee/whois
  • 支持域名、IP、ASN 的实时 RDAP 查询。
  • 提供最近查询记录、状态徽章、Raw JSON 展示与复制下载能力。
二、查询目标 Targets
  • Domain:例如 example.com
  • IPv4/IPv6:例如 8.8.8.82001:4860:4860::8888
  • ASN:例如 AS15169(大小写不敏感,系统会规范化)。

Example query URL: https://ipx.ee/whois?whois_q=example.com

三、结果字段 Output Fields
  • 注册商/联系人/Whois 服务器/创建与更新和到期时间。
  • 状态码(如 clientTransferProhibited)与 Nameservers。
  • RDAP 对象类型、Handle、关联链接与原始 JSON。
  • 年份徽章(注册年限)与目标类型徽章(Domain/IP/ASN)。
四、注意事项 Notes
  • Whois/RDAP 数据来自注册机构及镜像节点,更新时间可能存在延迟。
  • 同一目标在不同区域节点可能返回字段差异,属正常现象。
  • 建议结合历史记录与业务日志进行归属稳定性判断。

会员与非会员显示策略

首页 IP 结果采用三层结构:主要显示、折叠详细、会员高级信息。前端渲染仅依赖 normalized_profile 字段。

Home IP cards use 3 layers: primary, expandable details, and member-only advanced data. Rendering depends on normalized_profile fields only.

一、分层策略 Overview
层级中文说明English显示规则
Layer 1主要显示(12~14 行)Primary block默认展开,首屏可见
Layer 2查看详细信息Expandable details点击后展开,补充网络与风险细节
Layer 3高级信息Advanced member data会员可见;非会员显示锁定提示
二、权限对比 Compare
字段组非会员会员
主要显示(国家/城市/时区、ASN、组织、ISP、网络类型、置信度、代理/VPN/Tor)显示显示
折叠详细(ASN 类型、路由、RIR、组织域名、经纬度、Crawler/Satellite/Abuser、风险分)显示显示
高级信息(Abuse 联系方式)锁定显示
高级信息(risk.reasons[] 判定理由)锁定显示
高级信息(ASN created/updated)锁定显示
高级信息(meta.sources_used)锁定显示
三、移动端顺序 Mobile
  1. 先显示 Layer 1 主要字段(单列)。
  2. 再显示“查看详细信息”折叠区(单列)。
  3. 最后显示“高级信息”区;非会员展示锁定卡片与登录入口。
  1. Show Layer 1 primary fields first (single column).
  2. Then expandable details block (single column).
  3. Advanced block stays last; guests see lock prompt and sign-in action.
四、空值规则 Empty
  • 字段为空统一显示 -(不渲染 null/undefined)。
  • 会员字段对非会员不输出真实值,仅显示锁定说明。
  • 后台可按 guest/member 分别开关字段,前端实时读取配置。

REST API V1/V2

ipx.ee 提供两个版本的 REST API:V1 免费版(无限制)和 V2 VIP版(高质量数据,需 Token)。

ipx.ee provides two REST API versions: V1 Free (unlimited) and V2 VIP (high-quality data, token required).

一、版本概览 Overview
特性API V1API V2
认证无需Token 必需
数据源ip2region + ip-api.comipinfo.io + ipapi.is + ip2region + abuseipdb
数据质量基础高精度
查询限制无限制100-1000 次/月
线路类型家庭/IDC住宅/商业/托管/移动
风险检测基础代理VPN/Tor/滥用/爬虫/卫星
Abuse 联系不支持支持
输出格式统一嵌套格式统一嵌套格式
数据源标识ipx.ee v1ipx.ee v2
二、API V1(免费)

纯免费 API,无任何限制。适合开发测试、低频查询。

端点

  • GET /api/v1/ - 查询访客 IP
  • GET /api/v1/ip/{ip} - 查询指定 IP
  • GET /api/v1/domain/{domain} - 查询域名

示例

curl https://ipx.ee/api/v1/ip/8.8.8.8

数据字段说明

字段类型说明
okboolean查询是否成功
ipstringIP 地址
hostnamestring|null反向解析主机名
ip_typestringIPv4 或 IPv6
geo.continentstring|null大洲名称
geo.countrystring|null国家名称
geo.country_codestring|nullISO 国家代码(如 US)
geo.regionstring|null省份/州
geo.citystring|null城市
geo.districtstring|null区县(中国IP常有)
geo.zipstring|null邮政编码
geo.latitudenumber|null纬度
geo.longitudenumber|null经度
geo.timezonestring|null时区
network.asnnumber|nullASN 号码
network.asn_orgstring|nullASN 组织名称
network.ispstring|nullISP 名称
risk.is_mobileboolean是否移动网络
risk.is_proxyboolean是否代理
risk.is_datacenterboolean是否数据中心
meta.versionstring固定值 "v1"
meta.sourcestring固定值 "ipx.ee"
meta.is_china_ipboolean是否中国IP

响应示例(中国 IP)

{
  "ok": true,
  "ip": "223.5.5.5",
  "hostname": "public1.alidns.com",
  "ip_type": "IPv4",
  "geo": {
    "continent": "亚洲",
    "continent_code": "AS",
    "country": "中国",
    "country_code": "CN",
    "region": "浙江",
    "region_code": "ZJ",
    "city": "杭州",
    "district": "",
    "zip": "310000",
    "latitude": 30.287459,
    "longitude": 120.153576,
    "timezone": "Asia/Shanghai"
  },
  "network": {
    "asn": 45102,
    "asn_org": "Alibaba",
    "isp": "阿里"
  },
  "risk": {
    "is_mobile": false,
    "is_proxy": false,
    "is_datacenter": true
  },
  "meta": {
    "version": "v1",
    "source": "ipx.ee",
    "is_china_ip": true
  }
}

响应示例(国际 IP)

{
  "ok": true,
  "ip": "8.8.8.8",
  "hostname": "dns.google",
  "ip_type": "IPv4",
  "geo": {
    "continent": "North America",
    "continent_code": "NA",
    "country": "United States",
    "country_code": "US",
    "region": "Virginia",
    "city": "Ashburn",
    "zip": "20149",
    "latitude": 39.03,
    "longitude": -77.5,
    "timezone": "America/New_York"
  },
  "network": {
    "asn": 15169,
    "asn_org": "Google LLC",
    "isp": "Google LLC"
  },
  "risk": {
    "is_mobile": false,
    "is_proxy": false,
    "is_datacenter": true
  },
  "meta": {
    "version": "v1",
    "source": "ipx.ee",
    "is_china_ip": false
  }
}
三、API V2(VIP)

高质量 API,使用付费数据源,必须携带 Token。

认证方式

Authorization: Bearer YOUR_TOKEN
# 或
X-API-Key: YOUR_TOKEN

Token 配额

Token 类型月配额说明
free100 次免费用户,可看广告增加
standard1000 次标准注册用户
vip自定义付费用户

响应头信息

X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 995
X-RateLimit-Reset: 2026-03-01T00:00:00+00:00
X-Token-Type: standard

端点

  • GET /api/v2/ - 查询访客 IP
  • GET /api/v2/ip/{ip} - 查询指定 IP
  • GET /api/v2/domain/{domain} - 查询域名

示例

curl -H "Authorization: Bearer YOUR_TOKEN" \
  https://ipx.ee/api/v2/ip/8.8.8.8

数据字段说明

字段类型说明
okboolean查询是否成功
ipstringIP 地址
hostnamestring|null反向解析主机名
ip_typestringIPv4 或 IPv6
地理位置 geo
geo.continentstring|null大洲名称
geo.continent_codestring|null大洲代码(如 NA)
geo.countrystring|null国家名称
geo.country_codestring|nullISO 国家代码
geo.regionstring|null省份/州
geo.region_codestring|null区域代码
geo.citystring|null城市
geo.zipstring|null邮政编码
geo.latitudenumber|null纬度
geo.longitudenumber|null经度
geo.timezonestring|null时区
geo.local_timestring|null本地时间(ISO 8601)
geo.accuracy_radiusnumber|null精度半径(公里)
网络信息 network
network.asnnumber|nullASN 号码
network.asn_organizationstring|nullASN 组织名称
network.asn_domainstring|nullASN 域名
network.asn_typestring|nullASN 类型(isp/business 等)
network.asn_createdstring|nullASN 创建日期
network.asn_updatedstring|nullASN 更新日期
network.routestring|nullIP 段路由(CIDR)
network.rirstring|null注册机构(ARIN/RIPE/APNIC 等)
network.ispstring|nullISP 名称
network.assigned_orgstring|null分配组织
风险检测 risk
risk.is_vpnboolean是否 VPN
risk.is_proxyboolean是否代理
risk.is_torboolean是否 Tor
risk.is_datacenterboolean是否数据中心
risk.is_mobileboolean是否移动网络
risk.is_satelliteboolean是否卫星网络
risk.is_bogonboolean是否 Bogon 地址
risk.is_crawlerboolean是否爬虫
risk.is_abuserboolean是否被标记滥用
risk.abuse_scorenumber|null滥用评分(0-100)
联系信息 contacts
contacts.abuse_emailstring|nullAbuse 联系邮箱
contacts.abuse_phonestring|nullAbuse 联系电话
元数据 meta
meta.versionstring固定值 "v2"
meta.sourcestring固定值 "ipx.ee"
meta.tierstringvip
meta.is_china_ipboolean是否中国IP

响应示例(中国 IP - 阿里云 DNS)

{
  "ok": true,
  "ip": "223.5.5.5",
  "hostname": "public1.alidns.com",
  "ip_type": "IPv4",
  "geo": {
    "continent": "亚洲",
    "continent_code": "AS",
    "country": "中国",
    "country_code": "CN",
    "region": "浙江",
    "region_code": "ZJ",
    "city": "杭州",
    "zip": "310000",
    "latitude": 30.287459,
    "longitude": 120.153576,
    "timezone": "Asia/Shanghai",
    "local_time": "2026-02-19T05:52:19+08:00"
  },
  "network": {
    "asn": 45102,
    "asn_organization": "Alibaba",
    "asn_domain": "alibabacloud.com",
    "asn_type": "business",
    "route": "223.5.5.0/24",
    "rir": "APNIC",
    "assigned_org": "Aliyun Computing Co., LTD"
  },
  "risk": {
    "is_vpn": false,
    "is_proxy": false,
    "is_tor": false,
    "is_datacenter": true,
    "is_mobile": false,
    "is_satellite": false,
    "is_bogon": false,
    "is_crawler": false,
    "is_abuser": false,
    "abuse_score": 0
  },
  "contacts": {
    "abuse_email": "didong.jc@alibaba-inc.com",
    "abuse_phone": "+86-000000000"
  },
  "meta": {
    "version": "v2",
    "source": "ipx.ee",
    "tier": "vip",
    "is_china_ip": true
  }
}

响应示例(国际 IP - Cloudflare)

{
  "ok": true,
  "ip": "1.1.1.1",
  "hostname": "one.one.one.one",
  "ip_type": "IPv4",
  "geo": {
    "continent": "Oceania",
    "continent_code": "OC",
    "country": "Australia",
    "country_code": "AU",
    "region": "Queensland",
    "region_code": "QLD",
    "city": "Brisbane",
    "zip": "4000",
    "latitude": -27.4679,
    "longitude": 153.0281,
    "timezone": "Australia/Brisbane",
    "local_time": "2026-02-19T07:52:02+10:00",
    "accuracy_radius": 50
  },
  "network": {
    "asn": 13335,
    "asn_organization": "Cloudflare",
    "asn_domain": "cloudflare.com",
    "asn_type": "business",
    "route": "1.1.1.0/24",
    "rir": "ARIN",
    "assigned_org": "APNIC Research and Development"
  },
  "risk": {
    "is_vpn": false,
    "is_proxy": false,
    "is_tor": false,
    "is_datacenter": true,
    "is_mobile": false,
    "is_satellite": false,
    "is_bogon": false,
    "is_crawler": false,
    "is_abuser": false,
    "abuse_score": null
  },
  "contacts": {
    "abuse_email": "helpdesk@apnic.net",
    "abuse_phone": "+61-7-38583100"
  },
  "meta": {
    "version": "v2",
    "source": "ipx.ee",
    "tier": "vip",
    "is_china_ip": false
  }
}

额度耗尽响应 (429)

{
  "ok": false,
  "error": "monthly quota exceeded. limit: 100, reset at: 2026-03-01...",
  "quota": {
    "limit": 100,
    "remaining": 0,
    "reset_at": "2026-03-01T00:00:00+00:00"
  }
}
四、对比与选择 Compare

数据合并策略

场景V1 策略V2 策略
中国 IP ip2region 优先
ip-api.com 补充缺失字段
ip2region 优先
ipinfo.io 补充
ipapi.is 补充
abuseipdb 补充
国际 IP ip-api.com 优先
ip2region 补充
ipinfo.io 优先
ipapi.is 补充
ip2region 补充
abuseipdb 补充

何时使用 V1?

  • [适用] 开发测试阶段
  • [适用] 低频查询(< 100次/月)
  • [适用] 基础地理位置需求
  • [适用] 预算有限的项目
  • [适用] 中国 IP 需要详细地理信息(省市区、邮编、区号)

何时使用 V2?

  • [适用] 生产环境
  • [适用] 需要高精度数据
  • [适用] 需要风险检测(VPN/代理/Tor/爬虫识别)
  • [适用] 需要 ASN 详细信息(创建/更新时间、RIR)
  • [适用] 需要 Abuse 联系方式
  • [适用] 需要 IP 段路由信息

获取 Token

  1. 注册 ipx.ee 账号
  2. 进入「控制台」→「API Token」
  3. 生成 Token(免费用户默认 100 次/月)
  4. 观看广告可增加额度(+50 次)

输出格式统一说明

  • V1 和 V2 均使用统一的嵌套格式输出
  • 所有响应均包含 geonetworkrisk 对象
  • V2 额外包含 contacts 对象(Abuse 联系信息)
  • JSON 中不暴露原始数据源名称(ip2region/ipapi/ipinfo 等)
  • 统一标识为 meta.source: "ipx.ee" 和版本号

Umami Analytics API

配置 Umami Analytics API,在后台仪表板显示网站访问统计数据。

Configure Umami Analytics API to display website statistics on the admin dashboard.

一、功能说明 Overview
  • 支持 Umami Cloud 和自托管版本。
  • 自动获取过去 30 天的访问统计数据。
  • 包含访客数、浏览量、会话数、跳出率等指标。
  • 显示访客地区分布 Top 5。
  • Supports both Umami Cloud and self-hosted versions.
  • Automatically fetches statistics for the past 30 days.
  • Includes visitors, pageviews, sessions, bounce rate metrics.
  • Displays top 5 visitor countries/regions.
二、身份验证 Authentication

Umami 提供两种身份验证方式,取决于您使用的是 Umami Cloud 还是自托管版本。

Umami provides two authentication methods depending on whether you use Umami Cloud or self-hosted.

Authorization Header

Authorization: Bearer <token>
三、Umami Cloud

对于 Umami Cloud 用户,只需生成 API Key 即可。

  1. 登录 Umami Cloud
  2. 进入 Settings → API Keys
  3. 点击 "Create API Key"
  4. 复制生成的 API Key(格式:um_xxxxxxxxxxxxxxxx)
四、自托管 Self-hosted

以下身份验证方法仅适用于自托管的 Umami。对于 Umami Cloud,您只需生成一个 API 密钥即可。

The following authentication methods only apply to self-hosted Umami. For Umami Cloud, you only need to generate an API key.

POST /api/auth/login

首先,您需要获取一个令牌才能发起 API 请求。向 /api/auth/login 端点发送 POST 请求:

Request

POST /api/auth/login
Content-Type: application/json

{
  "username": "your-username",
  "password": "your-password"
}

Response

{
  "token": "eyTMjU2IiwiY...4Q0JDLUhWxnIjoiUE_A",
  "user": {
    "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "username": "admin",
    "role": "admin",
    "createdAt": "2000-00-00T00:00:00.000Z",
    "isAdmin": true
  }
}

保存令牌值,并在所有数据请求中添加 Authorization 请求头,值为 Bearer <token>

curl 示例

curl https://{yourserver}/api/websites \
  -H "Accept: application/json" \
  -H "Authorization: Bearer <token>"

POST /api/auth/verify

您可以验证该令牌是否仍然有效。

Response

{
  "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "username": "admin",
  "role": "admin",
  "createdAt": "2000-00-00T00:00:00.000Z",
  "isAdmin": true,
  "teams": []
}
五、获取 Website ID

Website ID 是 UUID 格式的字符串,用于标识您的网站。

  1. 登录 Umami 后台
  2. 点击您要查看的网站
  3. 进入网站设置(Settings/设置)
  4. 复制 Website ID(格式:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)

常用 API 端点

GET /api/websites/{id}/stats?startAt={ts}&endAt={ts}
→ 获取网站统计数据

GET /api/websites/{id}/pageviews?startAt={ts}&endAt={ts}&unit=day
→ 获取页面浏览量时间序列

GET /api/websites/{id}/metrics?startAt={ts}&endAt={ts}&type=country
→ 获取地区分布数据