Detect whether an IP address is using a VPN

Updated

The VPN detection endpoint tells you whether a given IP address is routing through a VPN. This is useful when you need to enforce geo-based restrictions and want to catch users who might be masking their true location to bypass them.

How to use it

  1. Screen a specific IP address by calling GET /api/v1/vpn/{ip_address}, replacing {ip_address} with the IPv4 or IPv6 address you want to evaluate.
  2. Screen the calling client's own IP by omitting the path parameter entirely and calling GET /api/v1/vpn. CompliAPI evaluates the IP of the incoming request.
  3. Authenticate your request with a bearer API token in the Authorization header, or use x402 pay-per-request if you don't have an account.
  4. Read the response — the vpn field in the JSON body is your result.

Response shape

The response is a small JSON object:

{ "ip": "172.217.22.14", "vpn": false }

The vpn field has three possible values:

  • true — the IP is identified as a VPN exit node
  • false — the IP does not appear to be a VPN
  • "unknown" — privacy data is not available for this IP, so a determination could not be made

Tips and limits

This endpoint is metered — each call costs one credit against your organization's monthly quota. Pair VPN detection with the geolocation endpoint to build a fuller picture: a user whose country resolves to a sanctioned region and whose VPN flag is true warrants a stricter response than either signal alone. If vpn comes back as "unknown", treat it as inconclusive rather than a pass — you may want to apply additional checks or flag the account for manual review.

← All articles

Powered by Shipstar