IPinfoBox

API 文档

使用套餐有效账户的 API 密钥查询 IP。将密钥放在 X-API-Key 请求头中,或在地址后加上 ?key=。3 个月套餐每天最多可查询 5,000 次;6 个月和 12 个月套餐不限每日次数。每日用量于每天 00:00 UTC 重置。所有套餐每秒最多 20 次查询。

基础 URLhttps://ipinfobox.com/api/v1

查询单个 IP

curl -H "X-API-Key: YOUR_KEY" https://ipinfobox.com/api/v1/8.8.8.8

{
  "ip": "8.8.8.8", "version": 4, "type": "public",
  "country": { "code": "US", "name": "United States", "name_en": "United States" },
  "region": "California", "city": "Mountain View", "continent": "NA",
  "location": { "lat": 37.422, "lon": -122.085 },
  "asn": { "number": 15169, "org": "Google LLC" },
  "privacy": { "vpn": false, "vpn_provider": null, "tor": false,
               "hosting": true, "hosting_provider": "Google", "cloud_region": null }
}

IPv6 用法相同。对于私有和特殊用途 IP,type 为 private 或 reserved,位置字段为 null。

访客检测(privacy)

vpn, vpn_provider

该地址是否在公开 VPN 服务器列表中,以及服务商名称(未知时为 null)

tor

是否在 Tor Project 出口节点列表中

hosting, hosting_provider

是否属于云公司官方 IP 段或主机商网络,以及公司名称

cloud_region

属于云 IP 段时的区域(例如 us-east-1)

列表每日更新。未收录的 VPN 和住宅代理返回 false。对于私有和特殊用途 IP,privacy 为 null。 检测原理

用于访客 IP

// Node.js (Express): ask for extra verification when a sign-up comes from a VPN, Tor or a data center
app.post("/signup", async (req, res) => {
  const ip = req.headers["cf-connecting-ip"] ?? req.ip; // behind Cloudflare: CF-Connecting-IP
  const r = await fetch(`https://ipinfobox.com/api/v1/${ip}`, { headers: { "X-API-Key": process.env.IPINFOBOX_KEY } });
  const info = await r.json();
  if (info.privacy && (info.privacy.vpn || info.privacy.tor || info.privacy.hosting)) {
    return res.status(403).json({ error: "extra verification required" });
  }
  // continue sign-up
});
# Python
import requests
info = requests.get(f"https://ipinfobox.com/api/v1/{ip}", headers={"X-API-Key": KEY}, timeout=3).json()
risky = bool(info.get("privacy")) and (info["privacy"]["vpn"] or info["privacy"]["tor"] or info["privacy"]["hosting"])

查询自己的 IP

GET /api/v1/me        发送请求的地址的 IP 及详情

剩余用量

GET /api/v1/usage     {"plan_ends_at":"2026-11-11T...","used_today":12,"daily_limit":5000}  (不限每日次数的套餐为 null)

错误

400 invalid_ip

不是有效的 IP 地址。

401 invalid_api_key

缺少密钥或密钥错误。

402 no_subscription

套餐已到期。重新付款后即可立即使用。

429 rate_limited / daily_limit

请求过于频繁,或今日用量已用完。