Geocoding API / Address to lat long api

IP Geolocation API

Retrieve user location data with API

IP Geolocation API lets you get a city-level location for your customers.

You can use this data to customize your website or app settings based on your customer's location, including map view, currency, and language. With accurate city-level location data and additional country information, our API is a powerful tool for enhancing location-based functionality.

For example, you can determine that your customer is located in Germany and close to Berlin. You could show them local offers in Berlin, communicate with them in German, or suggest nearby events or attractions.

Try IP Geolocation API

This demo shows your location on a map and returns the IP address associated with your request. You can also provide an IP address to API, which will return that IP's location:

How does IP Geolocation work?

IP Geolocation (or Internet Geolocation) is the process of identifying the physical location of a device using its Internet Protocol (IP) address.

An IP address is a unique identifier assigned to each device connected to the internet. When a desktop computer or mobile device makes an HTTP request and calls API, its IP address is provided as a part of the request. So the API can see it even if it's not added explicitly.

IP Geolocation API works by using an IP address to determine the approximate geographic location of a device. The API uses a combination of databases, algorithms, and geolocation technologies to find information about the location associated with that IP address. This information typically includes the country, region, city, and even the latitude and longitude coordinates of the device.

IP Geolocation technology is often used in various applications to customize user experiences based on their geographic location, such as displaying local content, offering personalized deals, or detecting and preventing fraud.

IP Geolocation vs Browser Geolocation

IP Geolocation and Browser Geolocation are two different methods of determining a device's location.

Browser Geolocation determines a device's location using data collected by the device's browser. This method relies on the user's permission to access location data, and it typically uses a combination of GPS, Wi-Fi, and cellular data to provide more accurate location information.

While both IP Geolocation and Browser Geolocation can be used to personalize user experiences based on location, Browser Geolocation typically provides more accurate results than IP Geolocation.

However, Browser Geolocation requires user permission, whereas IP Geolocation does not, making it a valuable alternative for situations where user consent is not possible or practical.

Use Cases

IP geolocation is a versatile technology that can be applied in a wide range of use cases, from personalizing online experiences to improving security measures. Here are some of them:

Show map based on user location

Presenting a familiar and well-accepted map view to customers can improve their user experience by allowing them to navigate and interact with the map easily. In addition, by providing a pre-set view, customers can save time and effort that would have otherwise been spent scrolling and searching for the desired location.

E-commerce

E-commerce websites can use IP Geolocation to personalize product offerings and pricing based on a customer's location. This can include showing products and prices in the local currency, highlighting local promotions and deals, and offering location-specific shipping options.

Fraud prevention

Businesses can use IP Geolocation to identify and prevent fraudulent activity, such as identifying suspicious login attempts from locations not associated with the user's usual location.

Website localization

IP Geolocation can be used to automatically display website content in the user's preferred language based on their location. This can improve user experience and increase engagement.

Advertising

IP Geolocation can be used to deliver targeted ads based on a user's location. This can include displaying location-specific ads for local businesses or targeting users in specific regions with ads for relevant products or services.

Content distribution

IP Geolocation can be used to distribute content based on a user's location. This can include delivering local news, weather, sports updates, and streaming content licensed for specific regions.

Getting started

The IP Geolocation API can be accessed through a simple HTTP Get request, making it compatible with any programming language or operating system:

Step 1. Register and get an API Key

To use the API, you need an API Key which you can get by following these steps:

  • Register on the MyProject Geoapify page.
  • Create a new project.
  • Go to the "API keys" section and get your API key.

For more information on how to create a project, generate an API key, and get started with the Maps API, visit the Getting Started with Maps API page.

Step 2. Call HTTP GET API request

Here are some examples of code in various programming languages that demonstrate how to make API calls to the IP Geolocation service:

fetch('https://api.geoapify.com/v1/ipinfo?apiKey=YOUR_API_KEY')
.then(resp => resp.json())
.then((userLocationData) => {
	console.log(userLocationData);
});

You can generate code samples easily on our Playground page.

Pricing

We use a credit-based system to simplify the pricing structure and provide a predictable cost for our users.

Each IP Geolocation API call costs one credit: 1 IP Geolocation = 1 credit.

With our Freemium pricing model, you can make up to 3000 IP Geolocation calls for free. If you need more credits, we offer affordable Pricing Plans to fit any business size.

FAQ

How accurate is the IP Geolocation API?

Geoapify IP Geolocation API returns a city-level user location that corresponds to map zoom levels 10-11. Also, the API provides useful information about the country, such as the ISO code, country name, and more.

Is it possible to detect a user location more precisely?

You can detect user location more precisely by using the HTML Geolocation service which is natively provided by all modern browsers. This can be useful for getting up-to-date information and turn-by-turn navigation. However, the location information is provided only after user permission, i.e after the user presses the “Allow“ button in the popup.

Is Geoapify IP Geolocation Free to use?

We have a Freemium pricing model. This means you can make up to 100,000 requests per month for free.

Can I use the Free Plan for commercial projects?

Yes, commercial companies can use our Free plan without restrictions. You can start using our services for free and upgrade your plan as needed. However, as a condition of using the Free plan, we require that you provide a follow-link to Geoapify on your website, such as “Powered by Geoapify“ near the information about the Geolocation service.

Which versions of IP do you support?

We support both IPv4 and IPv6 addresses.

How to get user location in JavaScript?

Geoapify IP Geolocation and Browser Geolocation are two methods of getting user location in JavaScript. The Geoapify IP Geolocation API allows you to detect a user's location based on their IP address, while Browser Geolocation uses the HTML Geolocation service natively provided by modern browsers to get a more precise location with user permission. The choice of which method to use depends on the level of accuracy needed and user permission requirements.

Can the API return the user's exact street address?

No, the API returns city-level location information, not the user's exact street address. This is due to privacy concerns and limitations in the accuracy of IP geolocation.

World map

Ready to get started?

Get an API key and add IP Geolocation to your project!