查询IP地址的归属地信息,包括国家、省份、城市、运营商等。
查询IP地址的归属地信息,包括国家、省份、城市、运营商等。
| 参数名 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
| ip | string | 是 | IP地址 |
[
{
"name": "ip",
"type": "string",
"required": true,
"description": "IP地址",
"example": ""
}
]{"openapi":"3.1.1","info":{"title":"IP地址查询","description":"查询IP地址的归属地信息,包括国家、省份、城市、运营商等。","version":"1.0.0"},"paths":{"/apis/gateway?api=ipquery":{"get":{"summary":"IP地址查询","description":"查询IP地址的归属地信息,包括国家、省份、城市、运营商等。","parameters":[{"name":"ip","in":"query","required":true,"schema":{"type":"string"},"description":"IP地址"}],"responses":{"200":{"description":"成功","content":{"application/json":{"schema":{"type":"object"}}}}}},"post":{"summary":"IP地址查询","description":"查询IP地址的归属地信息,包括国家、省份、城市、运营商等。","parameters":[{"name":"ip","in":"query","required":true,"schema":{"type":"string"},"description":"IP地址"}],"responses":{"200":{"description":"成功","content":{"application/json":{"schema":{"type":"object"}}}}}}}},"servers":[{"url":"https://api.souxiaocha.com","description":"当前访问入口(https)"}]}
{"success":true,"data":{"ip":"123.123.123.123","country":"中国","province":"浙江","city":"杭州","district":"","area":"浙江杭州","isp":"电信"},"generated_at":"2026-08-03 18:34:13"}https://api.souxiaocha.com/apis/gateway?api=ipqueryGET https://api.souxiaocha.com/apis/gateway?api=ipquery apikey=你的API密钥&ip=请填写ip
GET 参数放在查询字符串中。参数值请替换为实际有效值。
| 参数名 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
ip | string | 是 | IP地址 |
{"success":true,"data":{"ip":"123.123.123.123","country":"中国","province":"浙江","city":"杭州","district":"","area":"浙江杭州","isp":"电信"},"generated_at":"2026-08-03 18:34:13"}查询IP地址的归属地信息,包括国家、省份、城市、运营商等。
https://api.souxiaocha.com/apis/gateway?api=ipquery
GET / POST(业务参数 GET 通过 URL 传递,POST 支持表单或 JSON)
调用需携带平台密钥(用户中心「令牌管理」获取,SK- 开头):
key=SK-你的密钥X-API-Key: SK-你的密钥| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| ip | string | 是 | IP地址 |
[
{"name": "ip", "type": "string", "required": true, "description": "IP地址"}
]
成功返回示例:
{"success":true,"data":{"ip":"123.123.123.123","country":"中国","province":"浙江","city":"杭州","district":"","area":"浙江杭州","isp":"电信"},"generated_at":"2026-08-03 18:34:13"}
失败返回示例:
{"success":false,"error":"missing_ip","message":"请提供IP地址"}
| 参数名 | 类型 | 说明 |
|---|---|---|
| success | boolean | 请求是否成功 |
| data.ip | string | 查询的IP地址 |
| data.country | string | 国家/地区 |
| data.province | string | 省份 |
| data.city | string | 城市 |
| data.district | string | 区县 |
| data.area | string | 地址区域 |
| data.isp | string | 运营商 |
| generated_at | string | 数据生成时间 |
curl "https://api.souxiaocha.com/apis/gateway?api=ipquery?key=SK-你的密钥&ip=8.8.8.8"
上游业务级错误:
| code | msg | 描述 |
|---|---|---|
| 400 | missing_ip | 缺少IP参数 |
| 400 | invalid_ip | IP格式不正确 |
| 405 | method_not_allowed | 仅支持GET和POST |
| 500 | api_request_failed | 请求异常 |
| 502 | query_failed | 查询失败 |
平台级错误(errcode):11001 缺少密钥 / 11002 密钥无效或已禁用 / 11005 接口禁用 / 11006 接口维护 / 11010 积分不足 / 11018 请求方式不允许。
失败时请以响应体中的 code / errcode 与 msg 判断。
2026-09-24
curl "https://api.souxiaocha.com/apis/gateway?api=ipquery?key=SK-你的密钥&ip=8.8.8.8"
// 结果将在此处显示