IP Geolocation API: City, ASN, and VPN Flags
An IP geolocation API is a REST endpoint that turns an IPv4/IPv6 address into JSON: country, city, coordinates, ASN/ISP, currency, and a security object (proxy, Tor, VPN, cloud). On ipXapi that endpoint is GET /api/ip?ip=. Auth is Authorization: Bearer YOUR_KEY.
The official response example on the test-drive docs uses 148.105.12.120 (MailChimp / AS14782, Mountain View, CA). That is a documented fixture — look up the IP you actually care about. The homepage playground is the same surface: ipxapi.com. Basic is $29.99/mo. Trial is 7 days or 50 requests, whichever comes first.
Request: look up 148.105.12.120
curl "https://ipxapi.com/api/ip?ip=148.105.12.120" \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_KEY"
The ip query param is required. The same host also exposes /api/abuse-check, /api/blacklist-check, and /api/fraud-score (docs examples use 8.8.8.8). Batch lookups return a results array of the same object shape.
Response: location + security
Official example from the ipXapi test-drive docs (MailChimp IP 148.105.12.120):
{
"status": "success",
"country": "United States",
"countryCode": "US",
"region": "US-CA",
"regionName": "California",
"city": "Mountain View",
"zip": "94043",
"lat": 37.40599,
"lon": -122.0786,
"timezone": "America/Los_Angeles",
"isp": "MailChimp",
"org": "MailChimp",
"as": "AS14782 MailChimp",
"query": "148.105.12.120",
"inEU": false,
"continentCode": "NA",
"continentName": "North America",
"currencyCode": "USD",
"currencySymbol": "$",
"currencySymbol_UTF8": "$",
"flag": "🇺🇸",
"callingCode": "1",
"languageCode": "en",
"security": {
"is_proxy": false,
"is_tor": false,
"is_tor_exit": false,
"is_abuser": false,
"is_attacker": false,
"is_bogon": false,
"is_cloud_provider": true,
"is_relay": false,
"is_vpn": false,
"is_anonymous": false,
"is_threat": false
}
}
query echoes the IP you sent. lat / lon are WGS84. In this sample security.is_cloud_provider is true (MailChimp) while is_vpn / is_proxy are false — do not treat cloud as VPN.
What teams actually store from /api/ip
- Checkout / tax.
countryCode,inEU, andcurrencyCodepick VAT vs sales tax and a default currency — not a guess from the Accept-Language header. - Content licensing. Gate a catalog on
countryCode/continentCode. City + lat/lon are enough for a “near you” label without a second geocoder. - Fraud queue. Keep
as/ ASN next tosecurity. A cloud IP is not automatically a VPN; the MailChimp fixture is the reminder.
Cache 24 hours for display. Re-query when you are scoring abuse (/api/abuse-check and friends on the same host).
Go live with /api/ip
1. Register and start the 7-day / 50-request trial. Basic is $29.99/mo after.
2. Copy the Bearer key from the homepage playground after login.
3. Call https://ipxapi.com/api/ip?ip=148.105.12.120 with Authorization: Bearer YOUR_KEY.
4. Render city, countryCode, and security.is_vpn. Cache 24 hours unless you are scoring abuse.
FAQ: IP geolocation API
What does the JSON include besides city?
ISO country and continent codes, ZIP, timezone, ISP/org/AS, EU flag, currency, calling code, flag emoji, and a boolean security block (proxy, Tor, VPN, bogon, cloud, threat).
Is this sample Google DNS (8.8.8.8)?
No. The documented object above is MailChimp’s 148.105.12.120. Quickstart code snippets on the same site also show 8.8.8.8 as the URL placeholder — use whichever IP you are actually looking up.
How do I authenticate?
Authorization: Bearer YOUR_KEY. Query-string API keys are not the documented path for /api/ip.
