IP Geolocation API

IP Geolocation API

Get the location, city, country of an IPv4 or IPv6 address

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

ipstringRequired
IPv4 or IPv6 address
apiKeystringRequired
Your unique API key, which is required to authenticate your requests.

Response parameters

The API returns its response in a simple, lightweight JSON format.

ipstring
The IP address that was looked up.
location.countrystring
The country where the IP address is located.
location.regionstring
The region/state within the country.
location.citystring
The city where the IP address is located.
location.latitudenumber
The latitude coordinate of the location.
location.longitudenumber
The longitude coordinate of the location.
location.areanumber
The area code of the location (for US addresses).
location.euboolean
A boolean indicating whether the location is within the European Union.
timezone.namestring
The name of the timezone the location is in.
timezone.currentTimestring
The current time in that timezone.
timezone.hasDSTboolean
Whether the location observes daylight saving time.
timezone.isDTSboolean
Whether daylight saving time is currently in effect.
timezone.hemispherestring
The hemisphere the location is in (North or South).
timezone.offsetnumber
The offset in hours from UTC for this timezone.
flag.emojistring
The Unicode emoji flag for the country.
flag.unicodestring
The Unicode code point for the country's flag.

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 CodeTypeDetails
200OKThe request was successful.
400Bad RequestThe request was invalid or cannot be otherwise served.
401UnauthorizedAuthentication credentials were missing or incorrect.
422Quota reachedThe request cannot be served due to the application's rate limit having been exhausted for the resource.
404Not FoundThe requested resource could not be found.
429Too Many RequestsThe request cannot be served due to the application's rate limit having been exhausted for the resource.
500Internal Server ErrorSomething went wrong on the server.
503Service UnavailableThe service is temporarily unavailable.