Using IP GEO API you can get the location information of your visitors based on the IP address. We support both IPv4 and IPv6 addresses. This API provides the response in json and xml formats.
If you have any questions that are not coved by this documentation, please feel free to contact us.
To use an API you must have an API key. You can find it in the dashboard after the registration.
You can authenticate in the two following ways:
1. Passing an API Key via Query Parameter
curl --request GET \
--url 'https://api.getgeoapi.com/v2/ip/check?api-key={YOUR API KEY}'
2. Passing an API Key via Header
curl --request GET \
--url 'https://api.getgeoapi.com/v2/ip/check' \
--header 'api-key: {YOUR API KEY}'
IP Lookup returns geo location data of any provided IPv4 or IPv6 address.
Endpoint
https://api.getgeoapi.com/v2/ip/{ip}
?api-key={api-key}&format={format}&filter={filter}&language={language}
Example
curl --request GET \
--url 'https://api.getgeoapi.com/v2/ip/37.140.128.10?format=json&language=en' \
--header 'api-key: {YOUR API KEY}'
Request parameters
| Parameter | Description |
|---|---|
| ip (required) | Any IPv4 or IPv6 address |
| api-key (required) | Api Key that every registered user has and can be found in the Dashboard |
| format (optional) | Specifies the output format. It can be json or xml |
| filter (optional) | Filter the response and get only the required data. Options: asn, city, country, continent, area, currency, security, time, postcode. Can be comma separated. |
| language (optional) | Return data in one of the following languages: en,ru,zh,es,ar,fr,fa,ja,pl,it,pt,de |
Go to the section IP Lookup Response to see the example of the response.
Visitor's IP Lookup return the IP address and the location data of the client.
Endpoint
https://api.getgeoapi.com/v2/ip/check
?api-key={api-key}&format={format}&filter={filter}&language={language}
Example
curl --request GET \
--url 'https://api.getgeoapi.com/v2/ip/check?format=json&language=en' \
--header 'api-key: {YOUR API KEY}'
Request parameters
| Parameter | Description |
|---|---|
| api-key (required) | Api Key that every registered user has and can be found in the Dashboard |
| format (optional) | Specifies the output format. It can be json or xml |
| filter (optional) | Filter the response and get only the required data. Options: asn, city, country, continent, area, currency, security, time, postcode. Can be comma separated. |
| language (optional) | Return data in one of the following languages: en,ru,zh,es,ar,fr,fa,ja,pl,it,pt,de |
Go to the section IP Lookup Response to see the example of the response.
For the following request
curl --request GET \
--url 'https://api.getgeoapi.com/v2/ip/check?format=json&language=en' \
--header 'api-key: {YOUR API KEY}'
the response will be as shown below
Response object
| Property | Description |
|---|---|
| status | Returns the status of the request. Can be 'success' or 'fail' |
| ip | Returns the requested IP address |
| type | Returns the type of the requested IP address. Can be IPv4 or IPv6 |
| city -> name | Returns the name of the city of the requested IP address or empty value. |
| city -> geonameid | Returns the id of the record in the geonames database. |
| city -> population | Returns the population of the city of the requested IP address or empty value. |
| area -> code | Returns the region or area code of the requested IP address or empty value. |
| area -> geonameid | Returns the id of the record in the geonames database. |
| area -> name | Returns the region or area name of the requested IP address or empty value. |
| country -> code | Returns the country code of the requested IP address or empty value. |
| country -> geonameid | Returns the id of the record in the geonames database. |
| country -> name | Returns the country name of the requested IP address or empty value. |
| country -> phone_code | Returns the country phone number prefix of the requested IP address or empty value. |
| country -> area_size | Returns the country size in sq. km. of the requested IP address or empty value. |
| country -> capital | Returns the country capital of the requested IP address or empty value. |
| country -> population | Returns the country population of the requested IP address or empty value. |
| country -> is_in_eu | Returns true if the country of the requested IP is in Euro Union . |
| country -> flag -> emoji | Returns the emoji of the country flag . |
| country -> flag -> file | Returns the url of the file of the country flag in wikipedia. |
| country -> flag -> unicode | Returns the unicode of the country flag. |
| country -> languages | Returns a list of languages spoken in the country. |
| time -> timezone | Returns timezone of the requested IP address or empty value. |
| time -> time | Returns local time of the requested IP address or empty value. |
| time -> gtm_offset | Returns GTM offset in seconds |
| asn -> organisation | Returns company name of the requested IP address or empty value. |
| asn -> number | Returns Autonomous System Number of the requested IP address or empty value. |
| currency -> code | Returns local currency code of the requested IP address or empty value. |
| currency -> name | Returns local currency name of the requested IP address or empty value. |
| location -> latitude | Returns latitude of the requested IP address or empty value. |
| location -> longitude | Returns longitude of the requested IP address or empty value. |
| security -> is_tor | Returns true if the requested IP address is tor. |
| security -> is_proxy | Returns true if the requested IP address is proxy. |
| security -> is_thread | Returns true if the requested IP address is known to be as thread. |
| security -> is_crawler | Returns true if the requested IP address is crawler. |
| continent -> code | Returns continent code of the requested IP address or empty value. |
| continent -> geonameid | Returns the id of the record in the geonames database. |
| continent -> name | Returns continent code of the requested IP address or empty value. |
| postcode | Returns postal code of the requested IP address or empty value. |
In case the request fails or the resource is not available the error will be returned in JSON or XML format.
Error response example
Error codes
| Code | Description |
|---|---|
| 400 | Bad request. |
| 403 |
|
| 404 | Resource is not found or requested format is incorrect |
| 405 | Method is not allowed. |
| 500 | Server error. We hope you will never see this error. |
Below you can see some code examples.
import requests
url = "https://api.getgeoapi.com/v2/ip/check?format=json"
headers = {'api-key': "****************"}
response = requests.request("GET", url, headers=headers)
print(response.text)
<?php
$request = new HttpRequest();
$request->setUrl('https://api.getgeoapi.com/v2/ip/check');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData(['format' => 'json']);
$request->setHeaders(['api-key' => '****************']);
$response = $request->send();
echo $response->getBody();
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://api.getgeoapi.com/v2/ip/check?format=json")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["api-key"] = '****************'
response = http.request(request)
puts response.read_body
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.getgeoapi.com/v2/ip/check?format=json"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("api-key", "****************")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
curl --request GET \
--url 'https://api.getgeoapi.com/v2/ip/check?format=json&language=en' \
--header 'api-key: ****************'
var unirest = require("unirest");
var req = unirest("GET", "https://api.getgeoapi.com/v2/ip/check");
req.query({"format": "json"});
req.headers({
"api-key": "****************",
"useQueryString": true
});
req.end(function (res) {
console.log(res.body);
});