Overview
The IP Geolocation API allows you to look up the location, country, city, timezone, and other details associated with an IPv4 or IPv6 address using a simple RESTful API.
Features
- Works with both IPv4 and IPv6: Ip address geolocation API supports looking up both IPv4 and IPv6 addresses.
- Returns the country, region, city and timezone details: The API returns the country, region/state, city, latitude, longitude, area code, and whether the location is in the European Union (EU) or not.
- Provides Timezone Information: Geolocation ip API returns the timezone name, current time in that timezone, whether the location observes Daylight Saving Time (DST), whether DST is currently in effect, the hemisphere, and the offset from UTC.
- Includes Flag Information: The API returns the Unicode and emoji representation of the flag for the country associated with the IP address.
Getting Started
To access the IP Geolocation API , you need to obtain an API key from AnyAPI.io. The API key is used for authentication and should be included in the request URL as a query parameter.
Let’s Try Sign In.
Get the IP address location, timezone, etc. endpoint
Send a GET request to the following URL to Get the IP address location, timezone, etc.
curl --request GET \
--url 'https://anyapi.io/api/v1/ip/lookup?ip=66.249.86.22&apiKey=YOUR_API_KEY'
{
"ip": "66.249.86.22",
"location": {
"country": "GB",
"region": "ENG",
"city": "Romford",
"latitude": 51.5975,
"longitude": 0.2299,
"area": 200,
"eu": false
},
"timezone": {
"name": "Europe/London",
"currentTime": "10:53:31",
"hasDST": true,
"isDST": true,
"hemisphere": "North",
"offset": 1
},
"flag": {
"emoji": "🇬🇧",
"unicode": "U+1F1EC"
}
}
Request parameters
Use the parameters listed below to customize your request. Mandatory parameters are indicated
Response parameters
The API returns its response in a simple, lightweight JSON format.
Response and error codes
Whenever you make a request that fails for some reason, an error is returned also in the JSON format. The errors include an error code and description, which you can find in detail below.
Status Code | Type | Details |
---|---|---|
200 | OK | The request was successful. |
400 | Bad Request | The request was invalid or cannot be otherwise served. |
401 | Unauthorized | Authentication credentials were missing or incorrect. |
422 | Quota reached | The request cannot be served due to the application's rate limit having been exhausted for the resource. |
404 | Not Found | The requested resource could not be found. |
429 | Too Many Requests | The request cannot be served due to the application's rate limit having been exhausted for the resource. |
500 | Internal Server Error | Something went wrong on the server. |
503 | Service Unavailable | The service is temporarily unavailable. |