IP geolocation guides for developers
Practical, code-first guides for working with IP data: choosing an IP geolocation API, detecting VPN, proxy and Tor users, verifying real Googlebot and GPTBot traffic, and blocking or redirecting visitors by country with Cloudflare, nginx, Next.js or an API.
Choosing a provider? Start with Best IP geolocation APIs in 2026, then see the head-to-head API comparisons.
Guide · fraud prevention
Detect VPN, proxy and Tor users
How VPN detection works, what the flags mean, what to do with flagged users and how to add it to sign-up and checkout in Node.js and Python, with tested code.
Guide · bots
Verify Googlebot, Bingbot and GPTBot
Fake crawlers pose as Googlebot or GPTBot to get past bot protection. Verify real ones with official IP lists or reverse DNS, with tested code and Cloudflare.
Tutorial
IP geolocation in JavaScript, Python and PHP
Get the country, city and ISP of a visitor's IP address in Node.js, Python and PHP: the real client IP behind proxies, API calls, errors, caching and batches.
Guide · geo blocking
Block or redirect visitors by country
Geo blocking by country with a Cloudflare custom rule, nginx with GeoIP2 or Cloudflare's header, Next.js proxy or an IP API in Express. Tested configs and code.
Comparison
Best IP geolocation APIs in 2026
ipbase, IPinfo, MaxMind, ip-api, ipstack, ipgeolocation.io and IP2Location compared: free tiers, prices, VPN detection, batch limits, API or database.
More resources
- IP geolocation API comparisons, including ipbase vs IPinfo
- Set up ipbase in Claude Code, Cursor, Codex or VS Code with agents.md, or connect the MCP server
- Official IP ranges of clouds, CDNs and crawlers: Googlebot, GPTBot, AWS, Cloudflare
- Free IP tools: IP lookup, bulk lookup, VPN checker, ASN lookup
IP geolocation API
Get this data in your app
ipbase returns location, ISP, ASN and time zone for any IPv4 or IPv6 address, up to 1,000 addresses per POST request. Security flags (VPN, proxy, Tor, data center) are on the Medium plan and above.
Read the documentation1,000 free requests every month. No credit card required.
GET https://api.ipbase.com/v2/info?ip=1.1.1.1
{
"data": {
"ip": "1.1.1.1",
"type": "v4",
"connection": {
"asn": 13335,
"organization": "APNIC and Cloudflare DNS Resolver project",
"isp": "Cloudflare, Inc",
"range": "1.1.1.0/24"
},
"location": {
"country": { "alpha2": "AU", "name": "Australia" },
"zip": "4000"
},
"security": { "is_vpn": null, "is_tor": null, "threat_score": null }
}
}