Screen VPN and proxy sign-ups
Look up the address behind each sign-up with VPNDetection, then allow the account, ask for more verification, or refuse it.
Fake and duplicate accounts are often created through VPNs, proxies and Tor, because those hide where a sign-up comes from. But many people use a VPN for privacy, and refusing them all turns away real customers. This guide shows how to sort sign-ups into three outcomes: allow, verify, or refuse.
How it works
When someone submits your sign-up form, your server looks up the address the request came from. Based on the answer, it either creates the account, creates it in a pending state until the person passes an extra check (such as confirming their email or phone number), or refuses it. A real person on a VPN completes the extra check; an automated sign-up script usually doesn't.
Before you begin
- A server-side sign-up handler that knows the client's IP address. If your app runs behind a proxy, read Client IP addresses first.
- One of the official libraries. This guide uses Node.js and Python.
1. Look up the sign-up's address
Create a client once, and look up the address in your sign-up handler:
import { VPNDetection } from 'vpndetection';
const client = new VPNDetection({ apiKey: process.env.VPNDETECTION_API_KEY });
export async function screenSignup(ip) {
const r = await client.lookup(ip);
if (r.isTor) {
return 'refuse';
}
if (r.isVpn || r.asn?.type === 'hosting') {
return 'verify';
}
return 'allow';
}import os
from vpndetection import VPNDetection
client = VPNDetection(os.environ.get("VPNDETECTION_API_KEY"))
def screen_signup(ip):
r = client.lookup(ip)
if r.is_tor:
return "refuse"
if r.is_vpn or (r.asn and r.asn.type == "hosting"):
return "verify"
return "allow"Every field this reads is on the free plan. asn.type describes the network that announces the address, and hosting means a datacenter, where real people rarely sign up from.
2. Act on the outcome
- Allow: create the account as usual.
- Verify: create the account in a pending state, and activate it after the person confirms their email address or phone number.
- Refuse: show a clear message that says the sign-up can't be completed from this connection, and how to contact you.
Store the lookup result with the account. When an account later turns out to be fraudulent, you can see what its sign-up looked like and adjust your rules.
The signals on the free plan map to outcomes like this. Adjust the table to the risk your product carries:
| Signal | Suggested outcome | Why |
|---|---|---|
is_tor | Refuse, or verify | Anyone can use Tor, and its exits hide every user behind a few addresses. |
is_vpn | Verify | Many VPN users are legitimate, but VPNs also hide repeat sign-ups. |
asn.type is hosting | Verify | Real people rarely sign up from a datacenter; scripts often do. |
is_relay | Allow | Privacy relays carry ordinary users, such as Apple's iCloud Private Relay. |
| None of these | Allow |
3. Handle a failed lookup
A lookup can fail, for example because of a network error. When it does, create the account as usual and record that the sign-up wasn't checked, so you can review it later. Refusing every sign-up during an outage costs more than the occasional unchecked account.
let outcome;
try {
outcome = await screenSignup(ip);
} catch (err) {
outcome = 'allow';
console.warn('sign-up not screened:', err.message);
}import logging
from vpndetection import VPNDetectionError
try:
outcome = screen_signup(ip)
except VPNDetectionError as err:
outcome = "allow"
logging.warning("sign-up not screened: %s", err.kind)4. Test it
Connect to a VPN and submit your sign-up form. The account should be created in a pending state. To see what the lookup sees, open api.vpndetection.io/myip on the same connection: is_vpn should be true.
Things to consider
- Tell people what happened. A person asked to verify should see why and what to do next, and a refused person should see how to reach you. A silent failure sends them to a competitor.
- Expect shared addresses. A VPN exit or a Tor exit carries many users at once, so limit sign-ups per address generously and lean on verification instead.
- Revisit your rules. Compare the stored lookups of accounts that turned out to be fraudulent with those that didn't, and move a signal between outcomes when the data says so.
With a paid plan
A paid plan adds the classifications that matter most for sign-up fraud. Residential proxies (is_resproxy) route traffic through real home connections, so they look like ordinary visitors; mobile and datacenter proxies follow the same pattern. Each classification includes its evidence, so a rule can weigh it:
if (r.isResproxy && (r.resproxy?.hits ?? 0) >= 5) {
return 'verify';
}
if (r.isVpn && r.vpn?.confidence === 'low') {
return 'allow';
}The fields and their meanings are listed in the IP lookup reference.
Next steps
Apply the same approach to logins with Step up risky logins, or stop repeated trials with Prevent free-trial abuse. To apply a rule in middleware instead of your handler, see Protect a web app.