Documentation

Our IP API gives an accurate information about the location of the IP address that includes country and city data and checking the security threads from the provided IP address.

256-bit SSL encryption is used to provide the secure communication with our API.

This documentation describes features of API, endpoints and provides integration guides.

Authentication

In order to get an access to the API you need to get the api key. Each user after the registration and email validation would be able to get it in the account dashboard.

To use your api key you need to append api_key parameter to every request. Please see the example below.

GET: https://api.getgeoapi.com/api/v2/ip/check?api_key={YOUR_API_KEY}

Formats

We currently support JSON and XML formats. To specify the formant you need to attach the format parameter to the request as shown in the example below

GET: https://api.getgeoapi.com/api/v2/ip/check
?api_key={YOUR_API_KEY}
&format={FORMAT}

format parameter can have the following options:

  • json
  • xml


Endpoints

Please remember to add your api_key to every request.

The endpoint below returns the geo data of your IP address. You can find more information about it in the Requester IP Lookup section.

GET: https://api.getgeoapi.com/api/v2/ip/check
The endpoint below returns the data of the requested IP address. You can find more information about it in the IPv4 / IPv6 Lookup section.

GET: https://api.getgeoapi.com/api/v2/ip/{ip}

IPv4 / IPv6 Lookup

IP Lookup returns geo location data of any provided IPv4 or IPv6 address.

Endpoint:

GET: https://api.getgeoapi.com/api/v2/ip/{IP}

Example request:

GET: https://api.getgeoapi.com/api/v2/ip/37.140.128.10
?api_key={YOUR_API_KEY}
&format=json&filter=city

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.

Go to the section IP Lookup Response to see the example of the response.


Requester IP Lookup

Requester IP Lookup returns geo data of the IP address which is calling the API.

Endpoint:

GET: https://api.getgeoapi.com/api/v2/ip/check

Example request:

GET: https://api.getgeoapi.com/api/v2/ip/check
?api_key={YOUR_API_KEY}
&format=json

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.

IP Lookup Response

The example of the response for the IP 37.140.128.10

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 -> 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 -> 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 -> 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 -> 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 -> name Returns continent code of the requested IP address or empty value.
postcode Returns postal code of the requested IP address or empty value.

Errors

In case the request fails or the resource is not available the error will be returned in JSON or XML format.

Error response example:

{
    "status":"failed",
    "error":{
        "message":"Invalid key.",
        "code":"403"
    }
}
<?xml version="1.0" encoding="utf-8"?>
<root>
    <status>failed</status>
    <error>
        <message>Invalid key.</message>
        <code>403</code>
    </error>
</root>

Error codes:

Code Description
400 Bad request.
403
  • Authentication credentials were not provided.
  • Invalid key.
  • You reached the limit of your requests.
  • User is not active. Please use the link in the email to activate the user.
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.

Code Examples

PHP example:

<?php

$key = "{YOUR_API_KEY}";

$url = "https://api.getgeoapi.com/api/v2/ip/check?api_key=".$key."&format=json";

$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($curl);
curl_close($curl);

$json = json_decode($response, true);

print_r($json);

?>

Python example:

import requests

key = "{YOUR_API_KEY}"

parameters = {"api_key": key "format": "json"}

url = "https://api.getgeoapi.com/api/v2/ip/check

response = requests.get(url, parameters)

print(response.json())

Javascript example:

var key = "{YOUR_API_KEY}";

var url =  "https://api.getgeoapi.com/api/v2/ip/check?api_key=" + key + "&format=json"

$.getJSON(url, function (data) {
    console.log(data);
});
Check our Currency API Try Currency API