Skip to content
VPNDetection

Migrate from ipapi.is

Move from ipapi.is to VPNDetection: change the request, map each ipapi.is field to its VPNDetection field, and compare the answers before you switch.

This guide moves an integration from ipapi.is to VPNDetection. It shows how the request changes, which VPNDetection field answers each of ipapi.is's, how rules that read them change, and how to compare the two services on your own traffic before you switch.

Before you begin

  • A VPNDetection API key, if you need more than the free plan's fields. Without a key, a lookup answers the free plan's fields: is_vpn, is_tor, is_relay, and the address's country and network. See Plans and fields.
  • A sample of a few hundred addresses from your own traffic, one per line in sample.txt, for the comparison in step 4.

1. Change the request

ipapi.is takes the address in the q query parameter and your key in key:

bash
curl "https://api.ipapi.is/?q=8.8.8.8&key=$IPAPI_IS_KEY"

VPNDetection takes the address as the path and your key in the Authorization header:

bash
curl -H "Authorization: Bearer $VPNDETECTION_API_KEY" https://api.vpndetection.io/8.8.8.8

If your code can't set a header, send the key in the apikey query parameter instead; see Authentication. To make the request from your code with an official library, see Use an SDK.

2. Map the fields

ipapi.is answers top-level flags, and vpn, datacenter and asn objects when they apply. VPNDetection answers one top-level flag for each kind of address, with a detail object beside it. Fields after Paid plan: come with a paid plan; the rest come with every plan, the free plan included.

ipapi.isVPNDetectionNotes
is_vpn, vpn.serviceis_vpn; Paid plan: vpn.providervpn.provider is a stable ID; vpn.provider_name carries the display name.
vpn.last_seenPaid plan: vpn.last_seen, vpn.confidenceA date (YYYY-MM-DD) rather than Unix milliseconds, with a confidence.
is_proxyPaid plan: is_pubproxy, is_resproxy, is_dcproxy, is_mobproxyis_pubproxy answers open proxies, as is_proxy does; the others add residential, datacenter and mobile pools.
is_toris_toris_tor flags exits, where ipapi.is's covers every Tor relay.
is_datacenter, datacenter.datacenterPaid plan: is_hosting, hosting.providerhosting.provider names the hosting company.
asnasn.asn, asn.name, asn.prefixasn.org and asn.route become asn.name and asn.prefix.
is_mobilePaid plan: is_carrier, carrier.namecarrier.name names the carrier.
is_satellitePaid plan: is_satellite, satellite.providersatellite.provider names the operator.
is_crawleris_bot; Paid plan: bot.agentsis_bot also flags monitors, scanners and webhook senders; bot.agents names the crawler.
is_abuserNo counterpart

The IP lookup reference documents every VPNDetection field.

3. Update your rules

Most rules move field for field:

  • is_vpn is a boolean, so a truthiness test still works.
  • vpn.last_seen is a date rather than Unix milliseconds. Compare it as a date.
  • is_crawler becomes is_bot, with the crawler's name in bot.agents on a paid plan.
  • is_tor flags exit nodes only. A rule meant for traffic from Tor reads the same; one meant for any relay of the Tor network has no counterpart.
  • A field your plan doesn't include is absent rather than false, so a rule checks that a paid field is present before it acts on the value. See Plans and fields.

4. Compare the answers

Before you switch, run both services on your sample and review the addresses where they disagree. This script prints each address where ipapi.is's VPN flag and VPNDetection's differ. Save it as compare.mjs beside sample.txt, install the library with npm install vpndetection, and run node compare.mjs:

js
import { readFileSync } from 'node:fs';
import { VPNDetection } from 'vpndetection';

const client = new VPNDetection({ apiKey: process.env.VPNDETECTION_API_KEY });
const ips = readFileSync('sample.txt', 'utf8').split('\n').filter(Boolean);

for (const ip of ips) {
    const res = await fetch(`https://api.ipapi.is/?q=${ip}&key=${process.env.IPAPI_IS_KEY}`);
    const theirs = await res.json();
    const ours = await client.lookup(ip);
    const theirFlag = Boolean(theirs.is_vpn);
    const ourFlag = ours.isVpn;
    if (theirFlag !== ourFlag) {
        console.log(ip, 'ipapi.is:', theirFlag, 'VPNDetection:', ourFlag);
    }
}

Every provider builds its own data, so some disagreement is expected. Look up a few of the addresses on both sides. If you believe VPNDetection's answer is wrong, send us the address.

5. Switch over

Once the comparison looks right, switch in stages, so you can stop at any point without affecting your users:

  1. Run both side by side. Keep deciding with ipapi.is, and log VPNDetection's answer beside it for a few days of real traffic.
  2. Switch the decisions. Decide with VPNDetection, and keep logging ipapi.is's answer while you watch for surprises.
  3. Remove ipapi.is. Once your logs are clean, delete the old client from your code and revoke its key.

Next steps

When the answers suit your rules, switch your code to VPNDetection. Protect a web app applies rules in middleware, and the guides cover sign-ups, logins, payments and country rules. Before you launch, review the go-live checklist.