ipinfo.im

您的公网IP地址::216.73.217.43

United States Amazon.com, Inc.

API 使用说明

基础用法

Bash 示例
curl ipinfo.im
216.73.217.43

获取 JSON 信息

Bash 示例
curl ipinfo.im/json
{ "ip": "216.73.217.43", "location": "United States", "isp": "Amazon.com, Inc.", "time": "2026-06-04 07:39:40" }
Bash 示例
curl ipinfo.im/json/216.73.217.43
{ "ip": "216.73.217.43", "location": "United States", "isp": "Amazon.com, Inc.", "time": "2026-06-04 07:39:40" }

语言参数

支持的语言: zh, en
默认值: en

Bash 示例
curl "ipinfo.im/json?lang=zh"
Bash 示例
curl "ipinfo.im/json/216.73.217.43?lang=en"

可用的 API

端点 说明 示例
/ 仅返回 IP curl ipinfo.im
/json 返回 JSON curl ipinfo.im/json
/json/<ip> 返回 JSON curl ipinfo.im/json/216.73.217.43
?lang 语言参数
- 支持的语言: zh, en
- 默认值: en
curl "ipinfo.im/json?lang=zh"
curl "ipinfo.im/json/216.73.217.43?lang=en"

响应字段说明

字段 类型 说明
ipstring查询的 IP 地址
locationstring地理位置信息(国家、省/州、城市)
ispstring互联网服务提供商(ISP)名称
timestring查询时间戳(服务器本地时间)

速率限制

目前 API 完全免费,无需认证密钥。为保障服务质量,单个 IP 的请求频率限制为每分钟 60 次。超过限制将返回 HTTP 429 状态码。

错误处理

状态码 含义
200请求成功
429请求频率超限,请稍后重试
500服务器内部错误,请稍后重试

常见使用场景

  • 在服务器脚本中自动获取出口 IP 地址
  • 监控网络环境变化(如 IP 切换检测)
  • 开发面向用户的 IP 查询工具或集成到仪表盘
  • 安全审计中快速查询可疑 IP 的归属地和 ISP

更多代码示例

Python
import requests

data = requests.get("https://ipinfo.im/json").json()
print(f"IP: {data['ip']}")
print(f"Location: {data['location']}")
print(f"ISP: {data['isp']}")
Node.js
const res = await fetch("https://ipinfo.im/json");
const data = await res.json();
console.log(`IP: ${data.ip}, Location: ${data.location}`);
Go
resp, _ := http.Get("https://ipinfo.im/json")
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
PowerShell
$resp = Invoke-RestMethod -Uri "https://ipinfo.im/json"
Write-Host "IP: $($resp.ip) | Location: $($resp.location)"