Getting started with IPLocate

Introduction

IPLocate provides an API to return data for IPv4 and IPv6 IP addresses - such as country, city, continent, timezone, and more.

The API also provides comprehensive ASN data, WHOIS data, and threat and privacy data. For example:

  • which organisation hosts the IP address
  • whether the IP address is a proxy or VPN, or belongs to a hosting provider
  • whether the IP address is abusive

IPLocate data is updated daily, using 50TB+ of public and proprietary data to produce our ground-truth data sets.

Quick start

Start by signing up for a free API key.

We have client libraries for popular languages, so you can get started quickly:

Language Package Source code
Python python-iplocate on PyPi iplocate/python-iplocate
Node.js node-iplocate on NPM iplocate/node-iplocate
Java java-iplocate on Maven Central iplocate/java-iplocate
PHP php-iplocate on Packagist iplocate/php-iplocate
Go go-iplocate on pkg.go.dev iplocate/go-iplocate
Ruby iplocate on RubyGems iplocate/ruby-iplocate

Want to see a new language here, or developed your own integration? Let us know!

Or, try these quick start snippets:

We've already included your API key in the example snippets below. You can try them out as-is!

Log in or sign up to get your API key and try out the examples below.

Curl

curl https://iplocate.io/api/lookup/8.8.8.8?apikey=

Node.js

const iplocate = require('node-iplocate');

iplocate('17.253.0.0', { api_key: "" }).then((results) => {
  console.log(results);
});

JavaScript (fetch)

const response = await fetch('https://iplocate.io/api/lookup/17.253.0.0?apikey=');
const data = await response.json();

console.log(data);

Ruby

require 'iplocate'

results = IPLocate.lookup('17.253.0.0')

puts results.inspect

Python

import requests

ip = '17.253.0.0'
apiKey = ''
url = f'https://iplocate.io/api/lookup/{ip}&apikey={apiKey}'

response = requests.get(url)
print(response.json())

PHP

<?php

$res = file_get_contents('https://iplocate.io/api/lookup/17.253.0.0?apikey=');
$res = json_decode($res);

var_dump($res);

Authentication and API limits

Sign up for a free API key for 1,000 requests per day. You can purchase a monthly or yearly subscription starting at $25/month for higher API limits.

Pass your API key in the ?apikey query parameter, or in the X-API-Key header.

If you don't include an API key, your IP address is limited to 50 requests per day.

Our API provides information about your rate limits in the response headers: X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset.

You can also view your current usage and quota in your account dashboard.

API response data

An example response from the API can be seen by using the tool on the home page, or below:

{
  "ip": "123.243.246.200",
  "country": "Australia",
  "country_code": "AU",
  "is_eu": false,
  "city": "Sydney",
  "continent": "Oceania",
  "latitude": -33.8672,
  "longitude": 151.1997,
  "time_zone": "Australia/Sydney",
  "postal_code": "2049",
  "subdivision": "New South Wales",
  "subdivision2": null,
  "network": "123.243.240.0/20",
  "asn": {
    "asn": "AS7545",
    "route": "123.243.246.0/24",
    "netname": "TPG-INTERNET-AP",
    "name": "TPG Telecom Limited",
    "country_code": "AU",
    "domain": "tpgtelecom.com.au",
    "type": "isp",
    "rir": "APNIC"
  },
  "privacy": {
    "is_abuser": false,
    "is_anonymous": false,
    "is_bogon": false,
    "is_datacenter": false,
    "is_icloud_relay": false,
    "is_proxy": false,
    "is_tor": false,
    "is_vpn": false
  },
  "company": {
    "name": "TPG Telecom",
    "domain": "www.tpgtelecom.com.au",
    "country_code": "AU",
    "type": "isp"
  },
  "abuse": {
    "address": "TPG Internet Pty Ltd., (Part of the Total Peripherals Group), 65 Waterloo Road, North Ryde NSW 2113",
    "email": "[email protected]",
    "name": "ABUSE TPGCOMAU",
    "network": "123.243.246.192 - 123.243.246.223",
    "phone": "+000000000"
  }
}

For fields that are not available, the value will be null. For sub-objects, their field will be missing from the response. Depending on the data source, some fields might be an empty string (""). You should make sure your application handles each of these cases.

Base data Available in all plans

The base API response includes IP geolocation information such as country, city, currency and calling codes, timezone.

Attributes

ip The IP address
country The country name
country_code The ISO 3166-1 alpha-2 country code
is_eu Whether the IP address is in the European Union
currency_code The ISO 4217 currency code of the country
calling_code The country calling code of the country
city The city, if available
continent The continent
latitude The latitude
longitude The longitude
time_zone The tz database timezone identifier of the timezone at the location
postal_code The postal code
subdivision The subdivision (state, province, etc.), if available
subdivision2 Deprecated

The second-level subdivision (county, etc.), if available

This field is deprecated and will be removed. Use subdivision instead.

ASN data Available in all plans

The asn object provides detailed information about the Autonomous System of the IP address. This is usually the service provider or network responsible for connecting the IP address to the rest of the internet.

Attributes

asn.asn The ASN number
asn.route The network range of the ASN
asn.netname The name of the network
asn.name The name of the organisation
asn.country_code The ISO 3166-1 alpha-2 country code of the organisation
asn.domain The domain name of the organisation
asn.type The type of organisation. One of: business, hosting, government, education, isp, unknown
asn.rir The Regional Internet Registry (RIR) that assigned the ASN (for example: APNIC, ARIN, LACNIC, RIPE)

Privacy & threat data Available in all plans

Privacy and threat data provides detailed information about privacy services associated with the IP address (such as proxies, VPNs, iCloud Private Relay), as well as threat and security information like abuse and spam reports.

This data is updated multiple times per day from a combination of public and proprietary data sources.

Attributes

privacy.is_abuser

true if the IP address has been reported as an abusive source (for example: spam, malware, etc.)

privacy.is_anonymous

Convenience field that is true if either privacy.is_proxy or privacy.is_tor is true

privacy.is_bogon

true if the IP address is a bogon IP address

privacy.is_hosting

true if the IP address belongs to a hosting provider (for example: Google Cloud, AWS, etc.).

If this is true, the top-level hosting object may contain more detailed information.

privacy.is_icloud_relay

true if the IP address belongs to Apple's iCloud Relay service

privacy.is_proxy

true if the IP address is a known proxy. IPLocate tracks millions of reported proxies. This data is updated multiple times per day.

privacy.is_tor

true if the IP address is a known Tor exit node.

privacy.is_vpn

true if the IP address is a known VPN. IPLocate tracks millions of actual VPN IP addresses. This data is updated multiple times per day.

Hosting data Available in all plans

Hosting data provides additional detailed information about the type of hosting service or datacenter the IP address belongs to. For example: AWS or Azure datacenter information.

{
  "hosting": {
    "provider": "Amazon AWS",
    "domain": "aws.amazon.com",
    "network": "3.5.140.0/22",
    "region": "ap-northeast-2",
    "service": "EC2"
  }
}

Attributes

hosting.provider

The name of the hosting provider — for example: Amazon AWS

hosting.domain

The domain name of the hosting provider — for example: amazonaws.com

hosting.network

The network range of the hosting provider

hosting.region

The region code as given by the hosting provider — for example: us-east-1

This field will be populated for hosting providers that provide this information. Otherwise, it won't be in the hosting object.

hosting.service

The name of the service this IP address/network is used for, as given by the hosting provider — for example: EC2

This field will be populated for hosting providers that provide this information. Otherwise, it won't be in the hosting object.

Abuse contact data Available in all plans

Abuse contact data is contact information (usually of the network administrator) which can be used to report IP addresses that are engaged in fraudulent/malicious activites.

Attributes

abuse.address The physical address of the network abuse contact
abuse.country_code The ISO 3166-1 alpha-2 country code of the network abuse contact
abuse.email The email address of the network abuse contact
abuse.name The name of the network abuse contact
abuse.network The network range of the IP address
abuse.phone The phone number of the network abuse contact

Company data Available in all plans

Company data identifies the name of the organization behind the IP address, the type of business, and its domain name. We source this information from various publicly available datasets. The company type is classified by a machine learning model based on observed IP address usage patterns and company metadata.

Attributes

company.name The name of the organization
company.domain The domain name of the organization
company.country_code The ISO 3166-1 alpha-2 country code of the organization
company.type

The type of organization, based on a combination of network information and proprietary data.

One of: business, hosting, government, education, isp, unknown

VPN data Private beta

VPN data provides additional detailed information about the type of VPN or proxy service the IP address belongs to.

VPN data will be populated for IP addresses where privacy.is_vpn is true, and where we have additional data.

Note: Comprehensive VPN detection data is currently in beta. Contact us to get access.

VPN detection status is currently available via the privacy.is_vpn flag.

Advanced usage

Look up your own IP address

If you don't provide an IP address, we'll provide the data for the IP address you're calling from. You could use this, for example, to fetch a client's IP address data directly from front-end code.

curl https://iplocate.io/api/lookup/?apikey=

With JSONP callback

curl https://iplocate.io/api/lookup/8.8.8.8/json?callback=my_javascript_function

With API key as header

curl --header "X-API-Key: " https://iplocate.io/api/lookup/8.8.8.8

Data corrections

We use a variety of public and proprietary data sources to provide the most accurate IP location data possible. However, if you find any inaccuracies, please submit a correction and we'll update our data as soon as possible.

We prefer a link to a hosted Geofeed, or a list of IP address data in Geofeed (RFC 8805) format.