IP to Location API is a REST API which provides the essential data from any IP address in JSON format over HTTPS such as:
- Country / City / State / Continent
- Latitude and Longitude
- Local currency
- Internet Service Provider (ISP) lookup
- Country calling code and Time Zone
See it in Action!
How do I use IP to Location API?
Below is a sample code querying for IP address 182.48.79.85.
curl --location --request \
GET 'https://api.apilayer.com/ip_to_location/182.48.79.85' \
--header 'apikey: YOUR API KEY'
Check out the response below
{
"ip": "182.48.79.85",
"type": "ipv4",
"country_code": "BD",
"country_name": "Bangladesh",
"region_name": "Dhaka",
"city": "Dhaka",
"latitude": 23.7104,
"longitude": 90.40744,
"continent_code": "AS",
"continent_name": "Asia",
"is_eu": false,
"connection": {
"asn": 58715,
"isp": "Earth Telecommunication ( pvt ) Limited"
},
"location": {
"capital": "Dhaka",
"native_name": "Bangladesh",
"flag": "http://assets.apilayer.com/flags/BD.svg",
"top_level_domains": [
".bd"
],
"calling_codes": [
"880"
]
},
"currencies": [
{
"name": "Bangladeshi taka",
"code": "BDT",
"symbol": "৳"
}
],
"timezones": [
"UTC+06:00"
]
}
Use cases for IP to Location API
Knowing from where people access you extends your brand’s reach through the market and helps you create a more accurate customer base. You can think of any service to relate with a user’s location information but here are the most popular location-based use cases:
- For geo-targeting your customers by content personalization
- For any service that sends location-based push notifications
- For mapping any social experiences through photos, trips, check-ins etc.
- For using targeted ads and any other location-based marketing purposes
- For any kind of services offering solutions for local community needs such as healthcare, municipality, social services, transportation
- For detecting any abnormal activities within an area worth considering in terms of security concerns
- For collecting user behavior data on specific purposes such as a new investment for businesses