Quickstart
Make one API Request to see it in action, lookup any IP address
Documentation
API Access Key & Authentication
After signing up, every user is assigned a personal API access key, a unique combination of letters and digits provided to access to our API endpoint. To authenticate with the IPXplorer API, simply include your API key in the query parameters.
API Parameters
Parameter | Description |
---|---|
ip
|
[Required] IP to look up using IPXplorer. |
key
|
[Required] Your API key. |
Example API Request:
curl 'https://ipxplorer.com/api/ip?ip=18.97.14.86&key=[your_api_key]' -X GET -H 'Accept: application/json'
Example API Response:
{"status":"success","country":"ZM","countryCode":"ZM","region":"Lusaka","regionName":"Lusaka Province","city":"Lusaka","zip":"","lat":-15.4183,"lon":28.287,"timezone":"Africa\/Lusaka","isp":"MTN","org":"AS36962 MTN Zambia","as":"AS36962 MTN Zambia","query":"102.212.181.96","areaCode":null,"dmaCode":null,"inEU":0,"euVATrate":false,"continentCode":null,"continentName":null,"locationAccuracyRadius":null,"currencyCode":null,"currencySymbol":null,"currencySymbol_UTF8":"","currencyConverter":0,"flag":"\ud83c\uddff\ud83c\uddf2","callingCode":"260","languageCode":null,"classType":"class A","application":"Very large networks"}
Examples
PHP cURL
Get country from ip address php example
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://ipxplorer.com/api/ip?ip=8.8.8.8&key=[your_api_key]",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
Python
Python geolocation ip
import requests
url = "https://ipxplorer.com/api/ip?ip=8.8.8.8&key=[your_api_key]"
response = requests.request("GET", url)
print(response.json())
JavaScript Jquery AJAX
IP geolocation javascript example
var settings = {
"async": true,
"crossDomain": true,
"url": "https://ipxplorer.com/api/ip?ip=8.8.8.8&key=[your_api_key]",
"method": "GET",
"processData": false
}
$.ajax(settings).done(function (response) {
console.log(response);
});
Go Lang Example
Golang geoip example
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://ipxplorer.com/api/ip?ip=8.8.8.8&key=[your_api_key]"
method := "GET"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}