Quickstart

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

Your API response:

                                        {
     "ip": "3.143.22.26",
     "prefix_block": "[3.138.247.0/24, 3.138.248.0/21, 3.139.0.0/16, 3.140.0.0/14]",
     "continent_code": "NA",
     "continent": "North America",
     "country": "United States",
     "country_code": "US",
     "country_code_iso3": "USA",
     "country_flag_url": "https://ipxplorer.com/images/flags/1x1/us.svg",
     "dial_code": "+1",
     "zip_code": "43085",
     "state": "Ohio",
     "city": "Dublin",
     "currency": {
          "currency": "US Dollar",
          "currency_code": "USD",
          "currency_symbol": "$"
     },
     "connection": {
          "asn": 16509,
          "isp": "Amazon-02"
     },
     "time_zone_info": {
          "timezone": "America/Adak",
          "utc_offset": "-09:00"
     },
     "location": {
          "latitude": "40.0992",
          "longitude": "-83.1141"
     },
     "security": {
          "remote_host": "3.143.22.26",
          "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=3.143.22.26&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