IP.LS Command Documentation
IP.LS is a free IP address lookup service. Query your public IP or inspect any IP/domain — just like the ls command.
Quick Start
Get Your Public IP
curl ip.ls
# => 1.2.3.4
Note:
curl ip.lsreturns your IPv4 or IPv6 address depending on your network. Usecurl -4 ip.lsorcurl -6 ip.lsto force a specific stack. Clients that cannot pick a stack (browsers, PowerShell, most HTTP libraries) can use the single-stack hostnames4.ip.ls(A record only) and6.ip.ls(AAAA record only) instead — DNS selects the stack, so no flag is needed;4.ip.ls/jsonand6.ip.ls/jsonreturn the same JSON. If6.ip.lscannot connect, that client has no usable IPv6.
Get IP Info as JSON
curl ip.ls/json
{
"ip": "1.2.3.4",
"city": "San Francisco",
"region": "California",
"country": "US",
"loc": "37.7749,-122.4194",
"org": "AS13335 Cloudflare, Inc.",
"timezone": "America/Los_Angeles",
"continent": "North America"
}
Single Field Lookup
Return a single field as plain text — handy in shell scripts.
curl ip.ls/city # => San Francisco
curl ip.ls/loc # => 37.7749,-122.4194
curl ip.ls/org # => AS13335 Cloudflare, Inc.
curl ip.ls/timezone # => America/Los_Angeles
curl ip.ls/continent # => North America
Lookup a Specific IP
curl ip.ls/8.8.8.8
curl ip.ls/example.com # domain lookup
{
"ip": "8.8.8.8",
"city": "Mountain View",
"region": "California",
"country": "US",
"loc": "37.4220,-122.0850",
"org": "AS15169 Google LLC",
"timezone": "America/Los_Angeles",
"continent": "North America"
}
Domain Lookup
curl ip.ls/example.com
{
"ip": "104.20.23.154",
"domain": "example.com",
"city": "Toronto",
"region": "Ontario",
"country": "CA",
"loc": "43.6532,-79.3832",
"org": "AS13335 Cloudflare, Inc.",
"timezone": "",
"continent": "North America"
}
Note: the
domainfield is present only when a domain was looked up — it echoes the queried domain. IP lookups do not include it. The returnedipis one of the resolved addresses; geolocation of CDN/anycast domains reflects that edge node, not the site operator.
Multi-IP domains: the primary result is served at the base path, while /<ip>/resolved returns all resolved A/AAAA records (deduplicated, max 6, primary first) as a uniform array. Each entry matches the standard record shape (including domain echo).
curl ip.ls/baidu.com/resolved
[
{ "ip": "111.63.65.103", "domain": "baidu.com", "city": "Shijiazhuang", "region": "Hebei", "country": "CN", "loc": "38.0360,114.4700", "org": "AS24547 Hebei Mobile", "timezone": "Asia/Shanghai", "continent": "Asia" }
]
# Single field of a specific IP
curl ip.ls/8.8.8.8/city # => Mountain View
curl ip.ls/8.8.8.8/loc # => 37.4220,-122.0850
Note: IPv4 and IPv6 are both supported. There is no
postalfield and no/postalpath — the free DB-IP Lite database carries no postal data. There is noprotocolfield either:/<ip>/resolvedentries carry the standard record shape (plus thedomainecho for domain lookups) and nothing more.timezoneis empty when the coordinates are unknown (common for anycast and CDN edge addresses).
Help & Usage
curl ip.ls/help
Check User-Agent
curl ip.ls/ua
# => curl/8.7.1
View All Request Headers
curl ip.ls/headers
API Endpoints
Core
| Method | Path | Description | Content-Type |
|---|---|---|---|
| GET | / |
Public IP (plain text) | text/plain |
| GET | /json |
IP info as JSON | application/json |
| GET | /:ip |
Lookup any IP as JSON | application/json |
| GET | /:ip/resolved |
All resolved A/AAAA records as a JSON array | application/json |
| GET | /embed |
Embeddable live IP card (iframe) | text/html |
| GET | /ai |
Redirect to the AI/MCP cards on the home page | — |
Single Field (plain text)
| Path (self) | Path (any IP) | Returns |
|---|---|---|
/city |
/:ip/city |
City |
/region |
/:ip/region |
Region |
/country |
/:ip/country |
Country code |
/loc |
/:ip/loc |
"lat,lon" |
/org |
/:ip/org |
ASN + ISP |
/timezone |
/:ip/timezone |
Timezone |
/continent |
/:ip/continent |
Continent name |
Utility
| Method | Path | Description | Content-Type |
|---|---|---|---|
| GET | /ua |
User-Agent string | text/plain |
| GET | /headers |
All request headers as JSON | application/json |
| GET | /help |
Usage & tips | text/plain |
| GET | /docs |
This documentation | text/html or text/plain |
| GET | /* |
Non-HTML clients: your IP; browsers: 404 page | text/plain or text/html |
Response Fields
| Field | Description |
|---|---|
ip |
Public IP address |
domain |
Queried domain — present only for domain lookups |
city |
City name |
region |
Region/state name |
country |
ISO 3166-1 alpha-2 country code |
loc |
Latitude,longitude |
org |
ASN + ISP / organization name |
timezone |
IANA timezone |
continent |
Continent full name (English) |
Note: Fields may be empty when the corresponding data is unavailable.
Rate Limits
IP.LS runs on a self-hosted VPS. There are no hard rate limits, but please use responsibly. For high-volume needs, consider self-hosting or contact us.
Error Responses
- Fallback — Unknown path (input that is neither a valid IP nor a valid domain): non-HTML clients get your IP as plain text, browsers get a 404 page. Unsupported methods on API endpoints follow the same fallback — there is no
405. - 404 — A syntactically valid IP or domain that cannot be resolved:
{"error": "Domain not found or invalid IP"}. - 503 — The upstream lookup service is unavailable:
{"error": "Lookup service unavailable"}.
Content Negotiation
Requests whose Accept header contains text/html are treated as browsers, not as API clients:
- Browser requests to
/:ip,/:ip/json,/:ip/resolved,/:ip/<field>,/jsonand the self-field paths get a 302 redirect to the home page — targeted lookups carry the query as/?q=<query>, and the home card runs the actual lookup. - Non-HTML clients (
curl, scripts, bots) get the machine-readable output unchanged. - Unknown paths stay a 404 page for browsers.
So curl ip.ls/8.8.8.8 and opening https://ip.ls/8.8.8.8 in a browser deliberately do different things. To force machine output regardless of Accept, use a client that does not send text/html.
Embed
Embed a live IP card (showing each visitor's own IP, location and ISP) on any website with an iframe:
<iframe src="https://ip.ls/embed" style="border:0;width:280px;height:96px" loading="lazy" title="IP.LS"></iframe>
Options: ?lang=zh (Chinese), ?theme=dark / ?theme=light (default auto, follows the visitor's dark-mode setting).
MCP
A standard MCP (Model Context Protocol) Streamable HTTP endpoint is available at https://ip.ls/mcp (JSON-RPC 2.0), exposing five tools: ip_lookup (single or batch), ip_resolved (all DNS records of a domain), ip_self (your own public IP), headers and ua. No API key, no sign-up.
Client configuration:
Claude Code
claude mcp add --transport http ipls-ip-lookup-service https://ip.ls/mcp
Claude Desktop — mcpServers in claude_desktop_config.json:
{ "mcpServers": { "ipls-ip-lookup-service": { "type": "http", "url": "https://ip.ls/mcp" } } }
Cursor — .cursor/mcp.json:
{ "mcpServers": { "ipls-ip-lookup-service": { "type": "http", "url": "https://ip.ls/mcp" } } }
opencode — the mcp field in opencode.json:
{ "mcp": { "ipls-ip-lookup-service": { "type": "remote", "url": "https://ip.ls/mcp", "enabled": true } } }
GitHub Copilot — .vscode/mcp.json:
{ "servers": { "ipls-ip-lookup-service": { "type": "http", "url": "https://ip.ls/mcp" } } }
Once connected, the AI can answer directly: geolocation of any IP or domain, your public IP, request headers and UA.
Notes
- This API is provided as-is with no SLA. Uptime is not guaranteed.
- All requests are processed in-memory on a self-hosted VPS, using the DB-IP Lite databases (CC BY 4.0) — see IP Geolocation by DB-IP.
- No API key, no sign-up, no tracking — just
curl ip.ls.