IP Geolocation API

Get the location of any IP with a word-class API
serving city, region, country and lat/long data.
Get started
↓ Try it for free ↓
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
200 - Success
Worldwide coverage
with 4 billion IPs
Location data
with leading precision
Rich data including
timezone and unicodes
Real-time
daily update

Why do 10,000+ developers trust Abstract?

Easy to implement and maintain

We built Abstract because most of the API's we've used in the past simply weren't great. Our APIs are built the way we think API's should be: with excellent documentation, multiple easy to use libraries, and tutorials to get you started.

Speed and scale built into everything we do

Something like IP geolocation is probably part of a critical business processes and flow, so we built it (as all of our APIs) for use at scale and at blazing speeds. These aren't just marketing phrases, but fundamental features of our APIs.

Reliable uptime and great support

Developers trust Abstract because of our reliable uptime and excellent technical support that will help get you live quickly, keep you running smoothly, and resolve any issues you have fast regardless of where you are or what you're building.

Get the geolocation and other details of any IP address with Abstract

Excellent data and worldwide coverage

Our long-standing relationships with ISP's and other data providers enable us to provide highly accurate and consistent data that you will not find with other providers.

Daily updates to our data

Having the latest data is important when you're using IP geolocation for key business processes, so we get the latest data each day to give you the most accurate results.

IPv4 and IPv6 coverage

Our IP geolocation datasets cover both IPv4 and IPv6, as well as 1.75+ million locations across 225,000+ cities around the world, so you always have the most accurate results.

Timezone details included

If you want to know the location of an IP, it may be helpful to know other details about it, like the timezone, current time, GMT offset, and more. That's all included in our responses.

Country flag and other details included

The IP geolocation responses are also enriched with details about the country the user is location in, such as its flag (in SVG, PNG, emoji, and unicode), as well as other details.

Simple yet powerful REST API

The IP Geolocation API is designed with the perfect balance of simplicity and powerful in a single, modern REST API. It's made to provide quick time to value and an excellent developer experience.

CSV upload available for bulk queries

Not everyone will have the need or expertise to integrate directly with the IP Geolocation API, so Abstract provides an easy-to-use CSV upload tool.

Bank-level security for all queries

Security is very important to us, so all data that is sent to Abstract's IP Geolocation API and processed by Abstract is secured by 256-bit SSL encryption (HTTPS).

Simple, transparent, and cost-effective pricing

FREE

$0

no card
required!

  • 20,000 requests
  • 1 request / second

PROFESSIONAL

$9

per
month

  • 200,000 requests / month
  • $0.000045 / extra request
  • 50 requests / second
  • Commercial use allowed
  • Email support

ENTERPRISE

Get in touch!

  • >1,000,000 requests / month
  • 500 requests / second
  • Commercial use allowed
  • Premium enriched data
  • Chat support

IP Geolocation API Documentation

REST

The IP Geolocation API, like all of Abstract's APIs, is organized around REST. It is designed to use predictable, resource-oriented URL's and to use HTTP status codes to indicate errors.

HTTPS

The IP Geolocation API requires all communications to be secured TLS 1.2 or greater.

API Versions

All of Abstract's API are versioned. The IP Geolocation API is currently on Version 1.

Your API Key

Your API key is your unique authentication key to be used to access Abstract's IP Geolocation API. Note that each of Abstract's APIs has a unique API key, so you will need different keys to access the IP Geolocation and Email Validation API, for example. To authenticate your requests, you will need to append your API key to the base URL.

Base URL

https://ipgeolocation.abstractapi.com/v1/

IP Geolocation API Request Parameters

PARAMETER

TYPE

DETAILS

api_key required

String

Your unique API key. Note that each user has unique API keys for each of Abstract's APIs, so your User Avatar API key will not work for as your IP Geolocation API key, for example.

ip_address

String

The IP address to geolocate. Both IPv4 and IPv6 addresses are supported. Note that if you leave this parameter blank, the service will geolocate the IP address from which the request was made.

IP Geolocation API Response Parameters

PARAMETER

TYPE

DETAILS

ip_address

String

The requested IP address

city

String

City's name.

city_geoname_id

String

City's geoname ID.

region

String

State or province in which the the city is located.

region_iso_code

Char[2]

State or province's ISO 3166-2 code.

region_geoname_id

String

State or province's geoname ID.

postal_code

String

ZIP or postal code.

country

String

Country's name.

country_code

Char[2]

country_geoname_id

String

Country's geoname ID.

country_is_eu

Boolean

True if the country is in the EU, false if it is not.

continent

String

Continent's name.

continent_code

Char[2]

2 letter continent code: AF, AS, EU, NA, OC, SA, AN

continent_geoname_id

String

Continent's geoname ID.

longitude

Float

Decimal of the longitude.

latitude

Float

Decimal of the latitude.

connection > connection_type

String

Type of network connection: Dialup, Cable/DSL, Cellular, Corporate

connection > autonomous_system_number

Uint32

connection > autonomous_system_organization

String

Autonomous System Organization name.

connection > isp_name

String

Internet Service Provider (ISP) name.

connection > organization_name

String

Organization name.

timezone > name

String

Timezone's name from the IANA Time Zone Database.

timezone > abbreviation

String

Timezone's abbreviation, also from the IANA Time Zone Database.

timezone > gmt_offset

String

Timezone's offset from Greenwich Mean Time (GMT).

timezone > current_time

String

Current time in the local time zone.

timezone > is_dst

Boolean

True if the location is currently in Daylight Savings Time (DST).

flag > svg

String

Link to a hosted version of the country's flag in SVG format.

flag > png

String

Link to a hosted version of the country's flag in PNG format.

flag > emoji

String

Country's flag as an emoji.

flag > unicode

String

Country's flag in unicode.

Sample Request to Get a Geolocation from an IP Address

To request the geolocation from an IP address,, simply include your unique API key and the IP address you would like to check.

https://ipgeolocation.abstractapi.com/v1/
    ? apikey = YOUR_UNIQUE_API_KEY
    & ip = 92.184.105.98

That's all your need to get the geolocation and other data from an IP address! There are only two required parameters: the IP address and your unique API key.

Sample Request to Get a Geolocation for a Visitor, without having their IP (using jQuery)

To request the geolocation from an IP address, simply include your unique API key in the template below

$.getJSON("https://ipgeolocation.abstractapi.com/v1/?api_key=YOUR_UNIQUE_API_KEY", function(data) {
       console.log(data.ip_address);
       console.log(data.country);
   })

That's all your need to get the geolocation and other data from a visitor! There is only one required parameter: your unique API key.

Sample Response to Get a Geolocation from an IP Address

The API response is returned in a universal and lightweight JSON format. Below is an example of a response for an IP address location in France.

{
    "ip": 92.184.105.98,
    "city": "Caen",
    "city_geoname_id": 3029241,
    "region": "Normandie",
    "region_iso_code": "FR-NOR",
    "region_geoname_id": 11071621,
    "postal_code": "14949",
    "country": "France",
    "country_code": "FR",
    "country_geoname_id": 3017382,
    "country_is_eu": true,
    "continent": "Europe",
    "continent_code": "EU",
    "continent_geoname_id": 6255148,
    "longitude": 49.185850,
    "latitude": -0.359120,
    "timezone": {
        "name": "Central European Time",
        "abbreviation": "CET",
        "gmt_offset": "+1",
        "current_time": "2020-03-29T07:35:08-07:00",
        "is_dst": true
    },
    "flag": {
        "emoji": "🇫🇷",
        "unicode": "U+1F1EB U+1F1F7",
        "svg": "https://static.abstractapi.com/country-flags/fr_flag.svg",
        "png": "https://static.abstractapi.com/country-flags/fr_flag.png"
    },
    "connection": {
        "autonomous_system_number": "AS3215",
        "autonomous_system_organization": "France Telecom - Orange, FR",
        "connection_type": "wireless",
        "isp_name": "Orange S.A.",
        "organization_name": "Internet OM"
    }
}

A Note on Metering and Billing

Each individual IP you submit counts as a credit used. So, if you submit 20 different IP addresses in a single request, that will count as 20 credits against your monthly quota. Credits are also counted per request, not per successful response. So if you submit a request for the (invalid) IP address "kasj8929hs", that still counts as 1 credit.

Frequently Asked Questions
about Abstract's IP Geolocation API

What is the IP Geolocation API?

The Abstract IP Geolocation API takes an IP address and translates it into a location, as well as many other details, such as an address, timezone, and more.

Is the IP Geolocation API similar to an IP lookup?

IP geolocation and IP lookup are terms that are usually used interchangeably. However, individual providers of IP Geolocation / IP lookup services will often provide different information in their response. For example, some will simply provide raw geocoordinates, such as 33° 56' 34.0476'' N and 118° 24' 36.1512'' W, while others while provide additional information, such as the best guess at the location’s address, timezone, and more.

How does the IP Geolocation API work?

Typically an Internet Service Provider (ISP) will have a particular range of IP addresses that they work with. These ISPs can delegate these different IP addresses to the various users and devices as they connect to the internet. IP geolocation works by looking up a particular IP against the IP ranges owned by particular ISP’s in a given area. This method is similar to how determining the carrier of a particular phone number works in the Abstract Phone Validation API, for example.

Are there any drawbacks or limitations of IP Geolocation?

While IP Geolocation can be an incredibly powerful and useful tool for developers and web services, there are several drawbacks and limitations to be aware of. First is that IP addresses have limited accuracy. An ISP may shuffle in IP among several users in a given area. Similarly, the location of the IP may not be the exact location of the user using the device associated with that IP. This can be common if a user is using a mobile phone, such as can be detected using the Phone Validation API. Finally, users can use a variety of services, such as virtual private networks or VPN’s, to mask their real IP.

The HTML5 geolocation API, which is able to provide an almost GPS-like location and a much greater amount of precision. However, unlike pure IP based geolocation, the HTML5 geolocation requires a user’s explicit consent. Unless it’s very clear to a user why you need that info and that it’s valuable to the user, it’s unlikely that information will be provided.

Where does the data for the IP Geolocation API come from?

In its simplest form, IP geolocation is looking up an individual IP against a series of tables that map various IP ranges to ISP’s and locations. Regional internet registries, such as the African Network Information Centre and American Registry for Internet Numbers. Additional information is added constantly to the fundamental dataset, which is regularly cleaned and cross checked to ensure accuracy.

What are some use cases for the IP Geolocation API?

There are many powerful use cases for IP geolocation API’s and data. These include but are not limited to:

  • Automatically redirect users to relevant sites or sub sites based on their location 
  • Automatically detect and displaying a user’s location, country, or timezone without requiring them to explicitly make this customization
  • Customize the content or experience of a website or app based on the user’s location. E.g., showing a user’s local weather, tax and VAT rates, currency, news, public holidays, etc.
  • Filter out users based on their location, e.g., if you’re unable to offer your services to users in a particular country.

These are just some sample use cases. If you’re interested in producing a case study with Abstract to share how you’re using our IP geolocation API in exchange for some free credits, please contact us at team at abstractapi.com.

How much of the globe is covered by the IP geolocation data?

We’re constantly working to increase the coverage and accuracy of our data, which improves every week. Currently we support more than 2.25 million unique locations as well as 250,000+ cities and other geographic entities around the world.

How often do you update your geolocation database?

Our IP geolocation database is updated at least once a week, as we get new information about each IP block. We take care of keeping that data updated and cleaned so you can focus on providing great geolocation-related services and experiences to your users.

What if I notice inaccurate or incomplete geolocation data?

While we always strive to provide the most accurate and up to date information possible. However, if you notice anything inaccurate or missing in our data, please email us at: team at hellobonsai.com. If we can identify and replicate the incorrect data you’re seeing, we’ll give you extra credits for reporting it :)

IP Geolocation API Changelog

Last Updated on 

November 20, 2020

November 20, 2020

 - 

Added VPN and proxy detection to response

This is now available under the "security" object

November 20, 2020

 - 

Made IP address an optional field

If it's not entered in the request, then the service will geolocate the IP of the requesting server

November 18, 2020

 - 

Updated country flags to higher resolution versions

August 12, 2020

 - 

Optimizations that reduced response times 15%

July 20, 2020

 - 

Improved accuracy of city and region names to geoname ID's

July 4, 2020

 - 

Country flags updated

Updated the PNG and SVG country flags with higher quality images.

July 2, 2020

 - 

ASO Database Updated

Our database of names of Autonomous Service Organizations (ASO's) can been updated with the latest data.

Developers around the world love Abstract's IP Geolocation API

We started off using basic free services for IP geolocation as well as the avatar APIs, but quickly found how limited they were: slow, inaccurate, easily fooled by VPNs, etc. But once we found and started testing out Abstract's IP geolocation API, we were hooked. Awesome data quickly, always fast, and great documentation.

Chris Stanley, Scope

I love this service. You can build a lot of powerful features and customizations with IP geolocation data, but it obviously needs to be very reliable. Having a bad or inaccurate data for this is actually worse than having no data at all. And that's why Abstract has been such a great fit for me. Accurate data I trust.

Matt Chapman, Developer

Our app relies a ton of geo data for everything from onboarding to UI customizations to other backend services. We must have gone through 10 other IP geolocation services but were always burned on the quality, speed, price, etc. It was always something. But Abstract has worked out really well so far.

Jennifer Rollins, MerchKick

GET STARTED

Get  FREE credits to start today.

Get thousands of API calls for free across all Abstract APIs.
GET YOUR FREE API KEY