IPLibre logo IPLibre

Introduction

IPLibre is an open-source platform that provides public databases and APIs to retrieve various IP intelligence data, including geolocation, ASN, company information, and more. You can freely download and use the different databases that we provide in your projects. We also expose a powerful API that you can access for free with generous limits, or subscribe to a paid plan for higher limits and additional features.

Our data is sourced from various public sources which we query, then aggregate, transform and enrich to provide accurate and reliable information. Learn more below.

We also expose a web interface to view your own IP, and search other IP addresses or ASNs. Continue reading to learn more about the APIs and databases.

Using the IP API

The most straightforward way to query the IP API is to perform a GET request to https://iplibre.com/x.x.x.x with an accept: application/json header. The API will return a JSON object with the IP information:

const response = await fetch('https://iplibre.com/x.x.x.x', {
  headers: {
    'accept': 'application/json'
  }
})

For conveniance, we also expose the API under the iplib.re domain, with optional HTTPS. This is particularly useful if you just want to know your own IP address:

curl iplib.re # Get your IPv4 details
curl 6.iplib.re # Get your IPv6 details

Un-authenticated API requests will be rate-limited after 100 requests per hour. Once subscribing to a paid plain, add your authorization token to your requests:

const response = await fetch('https://iplibre.com/x.x.x.x', {
  headers: {
    accept: 'application/json',
    authorization: 'Bearer xxx'
  }
})

Here is a sample API response when querying an IP, with a description for each field and if they are optional or not:

{
  "ip": "98.145.37.103",                  # The requested IP addresss
  "network": {
    "rir": "ARIN",                        # Regional Internet Registry
    "asn": 19115,                         # Autonomous System Number
    "name": "Charter Communications LLC", # Autonomous System name
    "route": "98.145.36.0/22",            # Origin route
    "type": "isp",                        # Network type (isp, hosting, education, government)
    "anycast": true                       # Whether the IP is anycast, optional if false
  },
  "location": {
    "latitude": 39.61721,                 # Approximate latitude
    "longitude": -104.95081,              # Approximate longitude
    "country": "US",                      # Detected country code
    "city": "Greenwood Village",          # Detected city
    "source": "Whois",                    # Source of the geolocation data (whois, geoloc, geofeed)
    "timezone": "America/Denver"          # Detected timezone
  },
  "company": {
    "name": "Charter Communications Inc", # Company name, optional
    "website": "charter.net"              # Company website, optional
  },
  "abuse": {
    "email": "abuse@charter.net",         # Abuse contact email, optional
    "phone": "+1-877-777-2263"            # Abuse contact phone, optional
  },
  "privacy": {
    "tor": true,                          # Whether the IP is a Tor exit node, optional if false
    "hosting": true,                      # Whether the IP is owned by a hosting provider, optional if false
    "relay": true,                        # Whether the IP is used by Apple Private Relay, optional if false
    "residential": true                   # Whether the IP is a residential IP, optional if false
  }
}

Using the ASN API

Similarly to the IP API, perform a GET request to https://iplibre.com/ASxxx with an accept: application/json header. The API will return a JSON object with the IP information:

const response = await fetch('https://iplibre.com/ASxxx', {
  headers: {
    'accept': 'application/json'
  }
})

Un-authenticated API requests will be rate-limited after 100 requests per hour. Once subscribing to a paid plain, add your authorization token to your requests:

const response = await fetch('https://iplibre.com/ASxxx', {
  headers: {
    accept: 'application/json',
    authorization: 'Bearer xxx'
  }
})

Here is a sample API response when querying an ASN, with a description for each field and if they are optional or not:

{
  "network": {
    "rir": "ARIN",                        # Regional Internet Registry
    "asn": 19115,                         # Autonomous System Number
    "name": "Charter Communications LLC", # Autonomous System name
    "type": "isp",                        # Network type (isp, hosting, education, government)
    "website": "charter.net",
    "related": [                          # List of related ASNs
      7843,
      ...
    ]
  },
 "connectivity": {
    "upstreams": [                        # List of upstream ASNs
      20001,
      ...
    ],
    "downstreams": [                      # List of downstream ASNs
      33363,
      ...
    ],
    "peers": [                            # List of peer ASNs
      10796,
      ...
    ]
  },
  "location": {
    "latitude": 39.61721,                 # Approximate latitude
    "longitude": -104.95081,              # Approximate longitude
    "country": "US",                      # Detected country code
    "city": "Greenwood Village",          # Detected city
    "source": "Whois",                    # Source of the geolocation data (whois, geoloc, geofeed)
    "timezone": "America/Denver"          # Detected timezone
  },
  "abuse": {
    "email": "abuse@charter.net",         # Abuse contact email, optional
    "phone": "+1-877-777-2263"            # Abuse contact phone, optional
  },
 "ipv4": {
    "ranges": [                           # List of IPv4 CIDR ranges
      "16.14.240.0/21",
      ...
    ],
    "cidrs": 40,                          # Number of CIDR ranges
    "ips": 46848                          # Number of IP addresses in the CIDR ranges
  },
  "ipv6": {
    "ranges": [                           # List of IPv6 CIDR ranges
      "2600:6c7f:9111::/48",
      ...
    ],
    "cidrs": 23,                          # Number of CIDR ranges
    "ips": 38862848                       # Number of IP addresses in the CIDR ranges
  }
}

Geolocation accuracy

IP address geolocation is inherently imprecise and can be inacurate.

We transparently share the source used to determine a likely geolocation for an IP address in the source field. The source can be one of the following:

  • geofeed when we found the IP in a geofeed published from the same ASN. Geolocation fields are pretty accurate but can be wrong
  • geoloc when the whois record has a geoloc field. Geolocation fields are pretty accurate but can be wrong
  • whois as a last resort. The country field should be used but could be wrong for some hosting provider

We also emit an anycast boolean field to indicate whether the IP address is anycast. Anycast IP addresses are not tied to a specific location, so the geolocation data will be inaccurate.

Pricing

The IP and ASN APIs are free to use within the 100 requests per hour limit, without authentication. All fields are returned regardless of the plan. If you need more requests, you can self-host the databases or signup to subscribe to a paid plan.

The Pro plan is priced at $20/month and includes:

  • 1M queries per month, then $10 per additional 1M queries
  • Priority support
  • Advanced analytics on your queries

Self-hosting

We publicly share our databases in various formats, free of charge, and updated daily, on our GitHub releases page.

Documentation for self-hosting the IPLibre databases is coming soon.