IP Geolocation API

Geocoding / API Key Intermediate HTTPS CORS
Varies by plan (check documentation)

Overview

Abstract IP Geolocation API converts any IP address into detailed location data including country, city, timezone, and currency information. It is a reliable commercial API with a free tier of 20,000 monthly requests. An API key is required and easy to obtain by signing up on the Abstract website.

💡

Beginner Tip

The free tier gives you 20,000 requests per month — plenty for small projects. You can detect the visitor's own IP automatically by not passing an ip_address parameter, which is handy for personalization features.

Available Data

IP address details
latitude and longitude
city and country
timezone
ISP information
IP address information

Example Response

JSON Response
{
  "ip": "203.0.113.42",
  "city": "San Francisco",
  "region": "California",
  "country_code": "US",
  "latitude": 37.7749,
  "longitude": -122.4194,
  "timezone": "America/Los_Angeles",
  "isp": "Example ISP"
}

Field Reference

ip_address The IP address that was looked up.
country Full name of the country associated with the IP.
country_code ISO 3166-1 alpha-2 two-letter country code.
city Estimated city for the IP address.
timezone.name IANA timezone identifier for the location, e.g. America/Chicago.
currency.currency_code ISO 4217 currency code used in the country, e.g. USD or EUR.

Implementation Example

const url = "https://www.abstractapi.com/ip-geolocation-api";
// Replace headers or query params with the values required by this API.
const response = await fetch(url, {
  headers: {
  "X-API-Key": "YOUR_API_KEY"
  }
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

401 Unauthorized Missing or invalid api_key parameter.
Sign up at abstractapi.com to get a free API key and include it as api_key=YOUR_KEY in the query string.
422 Unprocessable Entity The ip_address value is not a valid public IPv4 or IPv6 address.
Validate the IP format before sending the request. Avoid loopback (127.0.0.1) and private range addresses.
429 Too Many Requests Exceeded the monthly or per-second request limit on your plan.
Check your usage in the Abstract dashboard and upgrade your plan if needed, or space out requests.

Matrix Score Breakdown

🌐 Reachability 30/30
⚡ Speed 15/20
🔒 Security 15/15
🛠 Developer XP 17/20
✓ Reliability 10/15

Partially tested on Apr 5, 2026

Technical Specifications

Auth API Key
HTTPS REQUIRED
CORS YES
Category Geocoding
Difficulty Intermediate
Verified: 2026-04-07

Alternatives to IP Geolocation

Technical alternatives for different use cases.

Basic IP geolocation with free tier

Better For

Data accuracy and field coverage

Trade-off

Budget-friendly IP geolocation

Free tier available with basic geolocation data

Better For

Detailed ISP and connection type data

Trade-off

Basic country/city detection on a budget

Recipes Using IP Geolocation

Build something with this API. Each recipe includes step-by-step instructions and code outlines.

Similar APIs

View All →