Quickstart

Make one API Request to see it in action, lookup any IP address

Your API response:

                                        {
     "ip": "18.97.14.86",
     "prefix_block": "[18.95.174.0/23, 18.95.176.0/20, 18.95.192.0/18, 18.96.0.0/14]",
     "continent_code": "EU",
     "continent": "Europe",
     "country": "United Kingdom",
     "country_code": "GB",
     "country_code_iso3": "GBR",
     "country_flag_url": "https://ipxplorer.com/images/flags/1x1/gb.svg",
     "dial_code": "+44",
     "zip_code": "98109",
     "state": "England",
     "city": "London",
     "currency": {
          "currency": "British Pound",
          "currency_code": "GBP",
          "currency_symbol": "£"
     },
     "connection": {},
     "time_zone_info": {
          "timezone": "Europe/London",
          "utc_offset": ""
     },
     "location": {
          "latitude": "51.5074",
          "longitude": "-0.127758"
     },
     "security": {
          "remote_host": "18.97.14.86",
          "is_threat": false,
          "threat_count": 0,
          "last_seen": "none",
          "is_using_tor": false
     }
}
                                    

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))
            }        
      

API Response Codes

Here are the error code descriptions
Code Description
401 Missing/Invalid API Key and/or IP Address
402 Invalid API key
403 User account is disabled
600 Insufficient credits