返回 | 接口 / 实用工具 / 获取自己IP
GET 实用工具

获取自己IP

获取调用方的公网 IP,附带归属地与运营商。

累计调用 82 今日调用 0

更新于 2026-10-16

调用地址

GET
https://itapi.top/api/myip

返回字段

字段名类型说明
code int 状态码
data.ip string IP 地址
data.country string 国家
data.city string 城市
data.isp string 运营商
data.ua string User-Agent

响应示例

200 OK
{"code":200,"msg":"success","data":{"ip":"154.12.85.233","country":"香港","region":"油尖旺區","city":"旺角","isp":"Cogent Communications","ua":"ITAPI-audit\/9"}}

在线测试

该接口无需参数,直接发送即可。

代码示例

cURL · GET
curl "https://itapi.top/api/myip"
PHP
<?php
$res  = file_get_contents("https://itapi.top/api/myip");
$json = json_decode($res, true);
print_r($json);
JavaScript
const res  = await fetch("https://itapi.top/api/myip");
const json = await res.json();
console.log(json);
Python
import requests

r = requests.get("https://itapi.top/api/myip", timeout=10)
print(r.json())
返回接口列表