Migrate from ipgeolocation.io
Move from ipgeolocation.io to VPNDetection: change the request, map each field to VPNDetection's, and compare the answers first.
This guide moves an integration from ipgeolocation.io's IP Security API to VPNDetection. It shows how the request changes, which VPNDetection field answers each of ipgeolocation.io'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
ipgeolocation.io's IP Security API takes your key in the apiKey query parameter and the address in ip:
curl "https://api.ipgeolocation.io/v3/security?apiKey=$IPGEOLOCATION_KEY&ip=8.8.8.8"VPNDetection takes the address as the path and your key in the Authorization header:
curl -H "Authorization: Bearer $VPNDETECTION_API_KEY" https://api.vpndetection.io/8.8.8.8If 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
ipgeolocation.io answers everything in its security object. 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.
| ipgeolocation.io | VPNDetection | Notes |
|---|---|---|
security.is_vpn, security.vpn_provider_names | is_vpn; Paid plan: vpn.provider | One provider ID, rather than a list of names. |
security.vpn_confidence_score, security.vpn_last_seen | Paid plan: vpn.confidence, vpn.last_seen | high, medium or low, where ipgeolocation.io's score runs from 0 to 100. |
security.is_residential_proxy, security.proxy_days_seen_30d, security.proxy_provider_count_30d | Paid plan: is_resproxy, resproxy.hits_days_pct, resproxy.providers_num | resproxy.hits_days_pct is the share of days seen over 90 days, where ipgeolocation.io counts days over 30. |
security.is_proxy, security.proxy_provider_names | Paid plan: is_dcproxy, is_mobproxy, is_pubproxy, resproxy.provider | One flag for each kind. |
security.is_tor | is_tor | |
security.is_relay, security.relay_provider_name, security.is_corporate_gateway | is_relay, relay.provider | is_relay covers company web gateways too. |
security.is_cloud_provider, security.cloud_provider_name | Paid plan: is_hosting, hosting.provider | hosting.provider names the hosting company. |
security.is_bot | is_bot; Paid plan: bot | bot.provider_name names whose bot it is, and bot.verified says whether its operator vouches for the address. |
security.threat_score, security.is_known_attacker, security.is_spam | No counterpart |
The IP lookup reference documents every VPNDetection field.
3. Update your rules
Most rules move field for field:
- A rule over
security.threat_scorebecomes a rule over the classifications. vpn.confidenceishigh,mediumorlow. Decide which of them your rule accepts.security.is_corporate_gatewayaddresses are inis_relay, beside privacy relays.security.is_botbecomesis_bot, on every plan, with whose bot it is inboton a paid plan.- 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 ipgeolocation.io'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:
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 url = `https://api.ipgeolocation.io/v3/security?apiKey=${process.env.IPGEOLOCATION_KEY}`
+ `&ip=${ip}`;
const res = await fetch(url);
const theirs = await res.json();
const ours = await client.lookup(ip);
const theirFlag = theirs.security?.is_vpn === true;
const ourFlag = ours.isVpn;
if (theirFlag !== ourFlag) {
console.log(ip, 'ipgeolocation.io:', 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:
- Run both side by side. Keep deciding with ipgeolocation.io, and log VPNDetection's answer beside it for a few days of real traffic.
- Switch the decisions. Decide with VPNDetection, and keep logging ipgeolocation.io's answer while you watch for surprises.
- Remove ipgeolocation.io. 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.