# IP 查询 API（ip.denys.cn）

> 面向开发者与 AI 应用的 IP 归属地查询 API：支持 IPv4/IPv6 与批量查询，毫秒级返回国家、省份、城市、运营商；按次计费、仅查询命中计费，次数长期有效，注册即送 1,000 次免费额度。

## 站点

- [首页](https://ip.denys.cn/)：产品介绍，可在线查看你当前 IP 的归属地
- [定价](https://ip.denys.cn/pricing)：套餐价格表（¥5 起）
- [接口文档](https://ip.denys.cn/docs)：鉴权、返回格式、计费规则、错误码、多语言示例
- [热门 IP 查询](https://ip.denys.cn/ip)：常用 IP 归属地聚合页
- [IP 落地页示例](https://ip.denys.cn/ip/223.5.5.5)：任意 IP 的归属地结果页（/ip/<IPv4|IPv6>）

## API 摘要

- 单查：`GET https://ip.denys.cn/v1/query?ip=223.5.5.5`（省略 ip 参数时查询调用方 IP）
- 批量：`POST https://ip.denys.cn/v1/query`，请求体 `{"ips":["223.5.5.5","119.29.29.29"]}`，单次最多 100 个
- 鉴权：请求头 `X-API-Key: ipk_xxx`（控制台创建）
- 响应字段：ip, found, country, province, city, isp, country_code
- 计费：仅 found=true 计 1 次；成功响应头 X-Quota-Remaining 为剩余次数
- 限流：每个 API Key 约 20 次/秒，超出返回 429
- AI Agent 接入：MCP 远程端点 `POST https://ip.denys.cn/mcp`（JSON-RPC 2.0，工具 ip_query / ip_batch / ip_quota，鉴权同上）

## 完整文档

- [llms-full.txt](https://ip.denys.cn/llms-full.txt)：全部接口参考与代码示例的单文件版（推荐给 AI 直接读取）
