If you want to determine your public (external) IP address programmatically, you can use the following request : https://ipapi.co/ip
Suppose you want to redirect your visitors to country-specific subdomains or pages on your website. If you visitor's IP address is 8.8.8.8, you can fetch the country with the following request:
https://ipapi.co/8.8.8.8/country
Your application can then redirect the visitors based on the country code fetched above.

Similarly for city, you can use:
https://ipapi.co/8.8.8.8/city

If you omit the IP address 8.8.8.8 from the requests above, the response will show your country / city respectively.
1) Get the latitude & longitude from https://ipapi.co/8.8.8.8/latlong i.e. 37.384500,-122.088100 in this case.

2) Plug it into a maps API
<img src="https://maps.googleapis.com/maps/api/staticmap?center=37.384500,-122.088100&zoom=9&size=280x200&scale=1&key=YOUR_MAPS_KEY">

You can use Google Maps, OpenStreetMaps or any other maps API that accepts latitude / longitude. This would display a map image like the one below. You might need a key from the map provider to display the map.


We aggregate data from multiple sources to provide an accurate & up-to date location information. Our data sources include network service providers, data from Geonames and IP geolocation by DB-IP available under the Creative Commons Attribution 4.0 License This product includes GeoLite2 data created by MaxMind, available from https://www.maxmind.com under the Creative Commons Attribution-ShareAlike 4.0 International License.
You can change your plan anytime from the account dashboard or by sending us a message. Plan upgrades are applied instantly. Downgrades take effect from the start of a new billing cycle.
We have a hassle free, no questions asked cancellation policy. You can cancel your subscription anytime from the dashboard or by sending us a message or e-mail (you'll receive the details on sign-up). Once your plan is cancelled, you won't be billed anymore but your plan will continue to work till the end of your billing cycle.
We offer a free IP location plan for trial & testing with no time limit. No credit card is required to use it. Basic fields are accessible without sign-up. If you require full access or a higher limit trial plan, please contact us. We would be happy to help you out.

We use a secure, PCI compliant payment provider to handle credit & debit card transactions. We never view or store any customer’s full credit or debit card details on our platform. Our primary payment processor is Stripe. It has been audited by an independent PCI QSA and is certified as a PCI Level 1 Service Provider. This is the most stringent level of certification available in the payments industry.
The API is suitable for a website, mobile or desktop app to automatically find the location and related information of an IP address. If you need to perform bulk lookup, we offer a separate GUI tool covered under the same subscription plan. If you expect an uncommon usage or traffic pattern, please contact us to ensure that the API will be suitable for you. For further details, please see our terms of service & privacy policy
If your usage approaches your request limit, you'll receive an e-mail alert with instructions on how to upgrade your plan before you run out of your quota.
Please refer to API Docs on specific error messages when your usage exceeds your plan limit.
Please refer to the API Docs & developer page for usage examples in ruby, python, php, Node.js, jQuery & java