IP Geolocation
free/v1/ip/geolocationReturns geographic location data for any IPv4 or IPv6 address including continent, country (ISO 3166-1), region/subdivision (ISO 3166-2), city, coordinates, timezone, postal code, and ASN/organization details — plus a `privacy` rollup (is_tor / is_hosting / is_relay / is_proxy_or_vpn) derived from the Tor Project's published exit list, Apple's iCloud Private Relay egress ranges, and a curated VPN/hosting ASN allowlist. Powered by Cloudflare's edge network for low-latency lookups worldwide.
What It Does
Resolves the physical location associated with an IP address using Cloudflare's geolocation database at the edge. Returns structured data including continent code, country (with ISO 3166-1 alpha-2 code), region/subdivision (ISO 3166-2), city, latitude/longitude coordinates, IANA timezone identifier, postal code where available, and the Autonomous System Number (ASN) with organization name operating the IP range. Also returns a `privacy` object flagging whether the IP is a known Tor exit node, falls within a published relay range (iCloud Private Relay, Cloudflare WARP), or belongs to a hosting / VPN ASN — useful for fraud detection and access-control gating without a second API call.
Why It's Useful
IP geolocation is foundational for fraud detection, content localization, GDPR/regulatory compliance, and user analytics. The bundled privacy classification answers the question every fraud team eventually asks — "is this even an end-user, or is it a Tor exit / VPN / datacenter?" — without paying a third-party privacy-detection vendor. It enables security engineers to detect impossible travel attacks and anonymized traffic, product teams to serve localized content and pricing, and compliance teams to enforce geographic access controls mandated by regulations like GDPR, CCPA, and data sovereignty laws.
Use Cases
Impossible Travel Detection
Compare the geographic location of successive login attempts to detect physically impossible travel patterns (e.g., logins from New York and Tokyo within 30 minutes).
Automatically flag or block account takeover attempts from geographically inconsistent locations.
Content Localization & Pricing
Serve localized content, currency, and regional pricing based on visitor IP geolocation without requiring manual user selection.
Increase conversion rates with location-appropriate content, pricing in local currency, and locale-specific offers.
Regulatory Compliance & Geofencing
Enforce geographic access restrictions for content or services regulated under GDPR, CCPA, sanctions (OFAC), or data residency requirements.
Meet data sovereignty and regulatory requirements by restricting access to approved geographic regions.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
ip | string | Required | The IPv4 or IPv6 address to geolocate. Omit to geolocate the requesting client IP.Example: 8.8.8.8 |
Response Fields
| Field | Type | Description |
|---|---|---|
ip | string | The queried IP address |
ip_version | number | IP version (4 or 6) |
country | string | Country name |
country_code | string | ISO 3166-1 alpha-2 country code |
region | string | State, province, or region name |
city | string | City name |
postal_code | string | Postal/ZIP code where available |
latitude | number | Latitude coordinate |
longitude | number | Longitude coordinate |
timezone | string | IANA timezone identifier (e.g., America/New_York) |
asn | number | Autonomous System Number |
organization | string | ASN organization name (ISP or hosting provider) |
is_bogon | boolean | Whether the IP is a bogon (reserved/private) address |
source | string | Where the geolocation data came from: cloudflare_cf (edge), ipgeolocation (paid API), bogon, or unknown |
privacy.is_tor | boolean | IP is a known Tor exit node (per the Tor Project's published exit list) |
privacy.is_hosting | boolean | IP belongs to a hosting / datacenter ASN |
privacy.is_relay | boolean | IP is part of iCloud Private Relay, Cloudflare WARP, or another published relay range |
privacy.is_proxy_or_vpn | boolean | IP is likely anonymized traffic — proxy / VPN / non-CDN hosting / Tor / relay |
privacy.classification_source | string | Which list classified the IP: curated_asn, tor_exit_list, icloud_relay_ranges, cf_warp, mixed, or null |
Code Examples
curl "https://api.edgedns.dev/v1/ip/geolocation" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d "ip=8.8.8.8"const response = await fetch(
'https://api.edgedns.dev/v1/ip/geolocation?ip=8.8.8.8',
{
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
}
);
const data = await response.json();
console.log(data);import requests
response = requests.get(
'https://api.edgedns.dev/v1/ip/geolocation',
headers={'Authorization': 'Bearer YOUR_API_KEY'},
params={
'ip': '8.8.8.8'
}
)
data = response.json()
print(data)Read the full IP Geolocation guide
Why it matters, real-world use cases, parameters, response fields, and how to call it from Claude, ChatGPT, or Gemini via MCP.
Read the guide →Related Endpoints
External References
Learn more about the standards and protocols behind this endpoint.
Try This Endpoint
Test the IP Geolocation endpoint live in the playground.