โ† Back to blog

Free IP Geolocation Lookup API โ€” Find Any IP Address with curl or Python

July 18, 2026 ยท Eric ยท 4 min read

Every HTTP request carries an IP address. That string of numbers can tell you a surprising amount: the visitor's approximate city, region, country, ISP, and even latitude/longitude. Whether you're building an analytics dashboard, geo-restricting content, or routing traffic by region, you need a fast IP geolocation API you can call from anywhere.

Agent Media Tools provides a free IP lookup endpoint at GET /api/ip. No API key required for basic use โ€” just a curl command or a fetch() call. Here's how it works in every language and platform your stack uses.

Quick Start โ€” Your Own IP

The simplest possible call โ€” find your own public IP and location:

curl https://agentmediatools.com/api/ip

Returns:

{
  "success": true,
  "ip": "203.0.113.42",
  "city": "San Francisco",
  "region": "California",
  "country": "United States",
  "isp": "Fastly, Inc.",
  "lat": 37.7749,
  "lon": -122.4194
}

Six fields in under 200 milliseconds. No account, no API key, no rate-limit negotiation.

Look Up Any IP Address

Pass an ip query parameter to look up any public IPv4 address:

curl "https://agentmediatools.com/api/ip?ip=8.8.8.8"
{
  "success": true,
  "ip": "8.8.8.8",
  "city": "Mountain View",
  "region": "California",
  "country": "United States",
  "isp": "Google LLC",
  "lat": 37.4056,
  "lon": -122.0775
}

Google's public DNS lives in Mountain View, CA โ€” exactly what you'd expect. The ISP field confirms who owns the block, which is useful for fraud detection and traffic analysis.

API Reference

PropertyValue
EndpointGET /api/ip or POST /api/ip
Query parameter?ip=1.2.3.4 (omit for your own IP)
ResponseJSON with ip, city, region, country, isp, lat, lon
AuthNot required for basic use
Free limit10/day anonymous, 25/day with free login

Python Example

With the standard requests library (no SDK needed):

import requests

# Look up your own IP
resp = requests.get("https://agentmediatools.com/api/ip")
data = resp.json()
print(f"You are in {data['city']}, {data['country']}")
# "You are in San Francisco, United States"

# Look up a specific IP
resp = requests.get(
    "https://agentmediatools.com/api/ip",
    params={"ip": "1.1.1.1"}
)
data = resp.json()
print(f"Cloudflare DNS: {data['city']}, {data['isp']}")
# "Cloudflare DNS: Sydney, Cloudflare, Inc."

The API returns plain JSON, so integrating it into a monitoring script, a bot, or a data pipeline is a single requests.get() call.

JavaScript (Browser / Node.js)

For server-side Node.js or client-side browser code:

// Browser โ€” find the visitor's location on page load
fetch("https://agentmediatools.com/api/ip")
  .then(r => r.json())
  .then(data => {
    console.log(`Visitor from ${data.city}, ${data.country}`);
    // Show a localized greeting or redirect
  })
  .catch(err => console.error("IP lookup failed", err));

// Node.js โ€” batch-lookup IPs from access logs
const results = await Promise.all(
  ["8.8.8.8", "1.1.1.1", "208.67.222.222"].map(async (ip) => {
    const res = await fetch(
      `https://agentmediatools.com/api/ip?ip=${ip}`
    );
    return await res.json();
  })
);
console.log(results.map(r => `${r.ip} โ†’ ${r.city}, ${r.isp}`).join("\n"));

No CORS issues โ€” the endpoint includes permissive CORS headers, so you can call it directly from the browser.

Why Use an IP Geolocation API?

Here are the cases where a fast, free geolocation endpoint earns its keep:

Agent Prompt Template

If you're wiring this into an AI agent's toolset, paste this into the system prompt or tool description:

IP Geolocation Lookup. Call GET https://agentmediatools.com/api/ip with optional ?ip=ADDRESS to get city, region, country, ISP, and coordinates. Omit the parameter to get the caller's own IP and location. No authentication required. Response is JSON with fields: ip, city, region, country, isp, lat, lon.

Agents like Claude (via MCP) or ChatGPT can call this endpoint autonomously โ€” the MCP server integration exposes it as the ip_lookup tool with automatic parameter handling.

MCP Integration (Claude Desktop / Cursor)

The Agent Media Tools MCP server registers ip_lookup as a built-in tool. If you have the MCP extension installed, your agent can answer questions like:

The MCP tool accepts an optional ip parameter and returns structured JSON. No prompt engineering needed โ€” it's a first-class tool in Claude's workspace.

Accuracy Notes

IP geolocation is approximate. The coordinates point to the registered location of the ISP's IP block, not the user's exact street address. City-level accuracy is typically reliable for fixed-line ISPs but can be coarser for mobile carriers and VPNs. Treat the data as a hint โ€” not a GPS coordinate.

Related Tools

Agent Media Tools offers other network-intelligence endpoints that pair well with IP lookup:

Try IP Lookup Now โ€” Find your IP and geolocation instantly.

๐ŸŒ Open the IP Lookup Tool ยท ๐Ÿ“– Full API Docs ยท ๐Ÿ”‘ Premium Plans

Tags: IP geolocation, free API, dev tools, network utilities, curl, Python