Swift SDK · Feature

Detect VPN, Proxy & Tor in Swift

Catch traffic that hides behind anonymizers. Every lookup already returns the suspiciousFactors fields for proxy, VPN, Tor, datacenter, spam, and crawler — and the dedicated torCheck method adds live Tor exit-node confirmation. No extra call, no extra cost per screen.

Trusted by thousands of businesses
Fast JSON API responses
Real-time validation
Simple integration, SDKs & examples
What it does

Anonymizer detection, built into every lookup

Fraudsters, scrapers, and abusers routinely mask their real IP behind a VPN, an open proxy, the Tor network, or a cloud/datacenter host. ip-api.io maintains these lists in real time and returns a boolean for each on every IP lookup, so you can require step-up verification or block outright — without bolting on a separate service.

Prerequisites

1

Read suspiciousFactors on any lookup

No dedicated call needed — the fields ride along with a normal lookup.

let client = IpApiClient(apiKey: ProcessInfo.processInfo.environment["IP_API_IO_KEY"]!)

let info = try await client.lookup(ip: "185.220.101.1")
let f = info.suspiciousFactors

print(f.isVpn)        // VPN service
print(f.isProxy)      // open / anonymizing proxy
print(f.isTorNode)    // Tor node
print(f.isDatacenter) // hosting / datacenter IP (often a bot)
print(f.isSpam)       // known spam source
print(f.isCrawler)    // known crawler / bot
print(f.isThreat)     // listed on a threat feed

if f.isVpn || f.isProxy || f.isTorNode {
    // require step-up verification (CAPTCHA, 2FA)
}
2

Confirm a Tor exit node with torCheck

A dedicated check against the live Tor node list, with a count of matching nodes.

let tor = try await client.torCheck(ip: "185.220.101.1")

print(tor.isTor)        // true
print(tor.torNodeCount) // number of matching Tor nodes
Want one number instead of flags? Risk scoring folds all of these signals into a single 0–100 score with riskScore(ip:).
Reference

Response reference

suspiciousFactors (all Bool)

FieldMeaning
isProxyOpen or anonymizing proxy
isVpnCommercial VPN endpoint
isTorNodePart of the Tor network
isDatacenterHosting / datacenter range
isSpamKnown spam source
isCrawlerKnown crawler / bot
isThreatListed on a threat feed

TorDetection (from torCheck)

FieldTypeDescription
ipStringThe checked IP
isTorBoolWhether the IP is a Tor node
torNodeCountIntMatching nodes for the IP
FAQ

Frequently asked questions

How do I detect a VPN or proxy in Swift?

Call try await client.lookup(ip: ip) and read the suspiciousFactors struct. It has boolean fields isVpn, isProxy, isTorNode, isDatacenter, isSpam, isCrawler and isThreat on every lookup, so no extra request is needed.

How do I check if an IP is a Tor exit node?

Use try await client.torCheck(ip: ip). It returns isTor and torNodeCount, checked against the live Tor node list. The isTorNode field on a normal lookup also covers this without a second call.

Do I need a separate call to get VPN and proxy flags?

No. The suspiciousFactors fields come back on every geolocation lookup at no extra cost, so a single lookup(ip:) gives you both location and threat signals. Use torCheck only when you want the explicit Tor node count.

Should I block all VPN and proxy traffic?

Not necessarily — many legitimate users use VPNs. A common pattern is to require step-up verification when isVpn, isProxy or isTorNode is true, and reserve hard blocks for isThreat. For a single decision, use the risk score.

Start building with the ip-api.io Swift SDK

Add ipapi-swift via Swift Package Manager, drop in your free API key, and ship in minutes — one async client for geolocation, fraud detection, and email validation.

Need support?

Explore how IP-API.io can enhance your security, provide robust bot protection, and improve IP geolocation accuracy for your applications.

Contact Support

Found a bug in the SDK?

The ipapi-swift package is open source. Open an issue or pull request on GitHub and we'll take a look.

Open on GitHub