Skip to main content

Quick start

Integrating IPLocate into your app is quick and easy. In this guide, we’ll show you how to look up details for any IP address using our API.

Before getting started

To get the most out of this guide, you’ll need:

1
Configure your project

Where are you going to call the API?
Language

Install dependencies

First, install node-iplocate using your package manager of choice:

npm install node-iplocate
# or
yarn add node-iplocate
# or
pnpm add node-iplocate

Set secrets

To make calls to the IPLocate API, you’ll need to provide your API key. Our code samples below show your API key inline. For a production app, we recommend storing your API key in an environment variable or secret manager.

Environment variables
IPLOCATE_API_KEY=YOUR_API_KEY

2
Make a request

Look up an IP address

import IPLocate from 'node-iplocate';

const client = new IPLocate('YOUR_API_KEY');
const result = await client.lookup('8.8.8.8');
console.log(result); // full JSON (ip, country, country_code, city, latitude, longitude, privacy, ...)

Get the country code for an IP address

import IPLocate from 'node-iplocate';

const client = new IPLocate('YOUR_API_KEY');
const result = await client.lookup('8.8.8.8');
console.log(result.country_code); // US

Check if an IP address is a VPN or proxy

import IPLocate from 'node-iplocate';

const client = new IPLocate('YOUR_API_KEY');
const result = await client.lookup('8.8.8.8');
if (result.privacy.is_vpn) {
console.log('This IP address is a VPN');
} else if (result.privacy.is_proxy) {
console.log('This IP address is a proxy');
} else {
console.log('This IP address is not a VPN or proxy');
}

3
Next steps

That’s it — you’re good to go!

These examples show a small subset of the data you can get from our IP Intelligence API. Continue reading our docs to learn more:

If you have any questions or need help along the way, please get in touch — we’re here to help.