Quickstart

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

Your API response:

                              {"status":"success","country":"US","countryCode":"US","region":"Ohio","regionName":"Ohio","city":"Columbus","zip":"43017","lat":40.0992,"lon":-83.1141,"timezone":"America\/New_York","isp":"Amazon.com, Inc.","org":"AS16509 Amazon.com, Inc.","as":"AS16509 Amazon.com, Inc.","query":"18.216.190.167","areaCode":"","dmaCode":"535","inEU":0,"euVATrate":false,"continentCode":"NA","continentName":"North America","locationAccuracyRadius":"500","currencyCode":"USD","currencySymbol":"$","currencySymbol_UTF8":"$","currencyConverter":0,"flag":"\ud83c\uddfa\ud83c\uddf8","callingCode":"1","languageCode":null,"hostname":"ec2-18-216-190-167.us-east-2.compute.amazonaws.com","classType":"class A","application":"Very large networks"}
                          

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 IpXapi API, simply include your bearer token in the Authorization header.

Headers

Header Description
Authorization [Required] Should be Bearer access_key. See "Your API Access Key" above.

API Features

Object Description
IP address [Required] IP to look up using ipXapi.

Example API Request:

curl 'https://ipxapi.com/api/ip?ip=18.216.190.167' -X GET  -H 'Accept: application/json' -H 'Authorization: Bearer '

Example API Response:

                    
                      {"status":"success","country":"US","countryCode":"US","region":"Ohio","regionName":"Ohio","city":"Columbus","zip":"43017","lat":40.0992,"lon":-83.1141,"timezone":"America\/New_York","isp":"Amazon.com, Inc.","org":"AS16509 Amazon.com, Inc.","as":"AS16509 Amazon.com, Inc.","query":"18.216.190.167","areaCode":"","dmaCode":"535","inEU":0,"euVATrate":false,"continentCode":"NA","continentName":"North America","locationAccuracyRadius":"500","currencyCode":"USD","currencySymbol":"$","currencySymbol_UTF8":"$","currencyConverter":0,"flag":"\ud83c\uddfa\ud83c\uddf8","callingCode":"1","languageCode":null,"hostname":"ec2-18-216-190-167.us-east-2.compute.amazonaws.com","classType":"class A","application":"Very large networks"}
                    
                  

Examples

PHP cURL

                
                  
                  $curl = curl_init();
                  
                  curl_setopt_array($curl, array(
                    CURLOPT_URL => "https://ipxapi.com/api/ip?ip=8.8.8.8",
                    CURLOPT_RETURNTRANSFER => true,
                    CURLOPT_ENCODING => "",
                    CURLOPT_MAXREDIRS => 10,
                    CURLOPT_TIMEOUT => 30,
                    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
                    CURLOPT_HTTPHEADER => array(
                      "Accept: application/json",
                      "Authorization: Bearer ",
                      "Content-Type: application/json",
                      "cache-control: no-cache"
                    ),
                  ));
                  
                  $response = curl_exec($curl);
                  $err = curl_error($curl);
                  
                  curl_close($curl);
                  
                  if ($err) {
                    echo "cURL Error #:" . $err;
                  } else {
                    echo $response;
                  }                
              

Python

                
                  
                  import requests

                  url = "https://ipxapi.com/api/ip?ip=8.8.8.8"
                  
                  headers = {
                      'Accept': "application/json",
                      'Content-Type': "application/json",
                      'Authorization': "Bearer ",
                      'cache-control': "no-cache"
                      }
                  
                  response = requests.request("GET", url, headers=headers)
                  
                  print(response.text)                
              

JavaScript Jquery AJAX

                
                  
                  var settings = {
                  "async": true,
                  "crossDomain": true,
                  "url": "https://ipxapi.com/api/ip?ip=8.8.8.8",
                  "method": "GET",
                  "headers": {
                    "Accept": "application/json",
                    "Content-Type": "application/json",
                    "Authorization": "Bearer ",
                    "cache-control": "no-cache"
                  },
                  "processData": false
                }
                
                $.ajax(settings).done(function (response) {
                  console.log(response);
                });                
              

Go Lang Example

        
          
            package main

            import (
              "fmt"
              "net/http"
              "io/ioutil"
            )

            func main() {

              url := "https://ipxapi.com/api/ip?ip=8.8.8.8"
              method := "GET"

              client := &http.Client {
              }
              req, err := http.NewRequest(method, url, nil)

              if err != nil {
                  fmt.Println(err)
                  return
              }
              req.Header.Add("Authorization", "Bearer ")
              req.Header.Add("Cookie", "XSRF-TOKEN=")

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

Batch IP Lookup

The batch IP lookup endpoint allows you to group up to 1024 IP search requests into a single request (you can mix up IPv4 and IPv6 addresses). This can really speed up the processing of bulk IP lookup.

JSON array as POST body

To make a batch request you can POST a JSON array containing all IP addresses you'd like to get the data for. Here's an example that uses cURL and the batch endpoint to get information about 2 different IP addresses with a single API call:

                
                  $curl = curl_init();
  
                  curl_setopt_array($curl, array(
                    CURLOPT_URL => 'https://ipxapi.com/api/batch-ip',
                    CURLOPT_RETURNTRANSFER => true,
                    CURLOPT_ENCODING => '',
                    CURLOPT_MAXREDIRS => 10,
                    CURLOPT_TIMEOUT => 0,
                    CURLOPT_FOLLOWLOCATION => true,
                    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
                    CURLOPT_CUSTOMREQUEST => 'POST',
                    CURLOPT_POSTFIELDS =>'[
                      "66.165.2.7", 
                      "190.191.2.241"
                  ]',
                    CURLOPT_HTTPHEADER => array(
                      'Authorization: Bearer ',
                      'Content-Type: application/json'                    
                    ),
                  ));
  
                  $response = curl_exec($curl);
  
                  curl_close($curl);