Skip to main content

IP Geolocation

free
GET/v1/ip/geolocation

Returns 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

Security Engineer

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.

Product Manager

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.

Compliance Officer

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

NameTypeRequiredDescription
ipstringRequiredThe IPv4 or IPv6 address to geolocate. Omit to geolocate the requesting client IP.Example: 8.8.8.8

Response Fields

FieldTypeDescription
ipstringThe queried IP address
ip_versionnumberIP version (4 or 6)
countrystringCountry name
country_codestringISO 3166-1 alpha-2 country code
regionstringState, province, or region name
citystringCity name
postal_codestringPostal/ZIP code where available
latitudenumberLatitude coordinate
longitudenumberLongitude coordinate
timezonestringIANA timezone identifier (e.g., America/New_York)
asnnumberAutonomous System Number
organizationstringASN organization name (ISP or hosting provider)
is_bogonbooleanWhether the IP is a bogon (reserved/private) address
sourcestringWhere the geolocation data came from: cloudflare_cf (edge), ipgeolocation (paid API), bogon, or unknown
privacy.is_torbooleanIP is a known Tor exit node (per the Tor Project's published exit list)
privacy.is_hostingbooleanIP belongs to a hosting / datacenter ASN
privacy.is_relaybooleanIP is part of iCloud Private Relay, Cloudflare WARP, or another published relay range
privacy.is_proxy_or_vpnbooleanIP is likely anonymized traffic — proxy / VPN / non-CDN hosting / Tor / relay
privacy.classification_sourcestringWhich list classified the IP: curated_asn, tor_exit_list, icloud_relay_ranges, cf_warp, mixed, or null

Code Examples

cURL
curl "https://api.edgedns.dev/v1/ip/geolocation" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d "ip=8.8.8.8"
JavaScript
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);
Python
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.