After creating an account, you will be assigned a unique access key. To authenticate with the ipapi API interface, simply append your access_key parameter.
Example request:
https://api.ipapi.com/api/161.185.160.93?access_key=YOUR_ACCESS_KEY
Keep your API access key safe: your API access key is private and should be kept secure. You can disable your API access key immediately using your account dashboard at any time.
Example API response:
{
"ip": "161.185.160.93",
"type": "ipv4",
"continent_code": "NA",
"continent_name": "North America",
"country_code": "US",
"country_name": "United States",
"region_code": "NY",
"region_name": "New York",
"city": "Bath Beach",
"zip": "11201",
"latitude": 40.69459915161133,
"longitude": -73.99063873291016,
"msa": "35620",
"dma": "501",
"radius": 30.012950897216797,
"ip_routing_type": "fixed",
"connection_type": "tx",
"location": {
"geoname_id": 5108111,
"capital": "Washington D.C.",
"languages": [
{
"code": "en",
"name": "English",
"native": "English"
}
],
"country_flag": "http://assets.ipapi.com/flags/us.svg"
}
}
This problem demonstrates how to call the ipapi geolocation API by appending an access key as a query parameter to the request URL. The key idea is understanding API authentication and how to read the returned JSON fields such as country, region, city, coordinates, and language metadata for a given IP address.