Access controls
IP Geofencing API for Sanctioned Countries
A geofencing API for blocking or restricting users by jurisdiction: geolocate the calling client or any IP address to city, region and country, with an OFAC sanctioned-country flag in the same response. If you need device-level geofences that fire when a phone enters or leaves a radius, you want a mobile location SDK, not this.
GET /api/v1/geo/{ip}
# Omit the IP to geolocate the calling client
curl https://api.compliapi.com/api/v1/geo/91.218.114.206 \
-H "Authorization: Bearer $COMPLIAPI_TOKEN"import requests
resp = requests.get(
"https://api.compliapi.com/api/v1/geo/91.218.114.206",
headers={"Authorization": f"Bearer {COMPLIAPI_TOKEN}"},
)
print(resp.json())const resp = await fetch(
"https://api.compliapi.com/api/v1/geo/91.218.114.206",
{ headers: { Authorization: `Bearer ${process.env.COMPLIAPI_TOKEN}` } },
);
console.log(await resp.json());Response
{
"ip": "91.218.114.206",
"city": "Moscow",
"region": "Moscow",
"country": "RU",
"sanctioned": true,
"source_url": "..."
}Sanctioned-country flag built in
Geolocation results are checked against CompliAPI's curated list of OFAC country sanction designations — comprehensive, targeted and military.
City and region granularity
Responses include city and region, supporting rules like different handling for New York State users.
Caller or arbitrary IP
Call the endpoint with no argument to evaluate the requesting client, or pass any IP address explicitly.
One structured response
A single JSON object your access-control logic can branch on — no separate geo provider and sanctions list to join.
What the geofencing API response returns
One GET returns a single JSON object your access-control logic can branch on. Location fields are derived from IP data and are estimates; the sanctioned flag is a lookup against CompliAPI's curated OFAC country designations.
| Field | What it holds | Nature |
|---|---|---|
| ip | The address evaluated — the calling client's, or the one you passed | exact |
| city | Best-estimate city for the IP | probabilistic |
| region | State or province (e.g. New York) — the field state-level rules key on | probabilistic |
| country | ISO 3166-1 alpha-2 country code | probabilistic |
| sanctioned | true when that country carries an OFAC sanctions designation | lookup |
| source_url | The official OFAC program page behind the designation, when sanctioned | lookup |
Sanctioned-country flag built in: what sanctioned: true means
OFAC does not publish a single official list of sanctioned countries — it administers programs. The flag is CompliAPI's curated mapping of those programs to countries and regions, in three categories: comprehensive embargoes (Cuba, Iran, North Korea, and the Crimea, Donetsk and Luhansk regions of Ukraine, with Russia treated as comprehensive in practice), targeted country programs that restrict named sectors or officials without embargoing the country, and arms-embargo jurisdictions. Every flagged response carries the official program URL so a reviewer can read the designation behind it.
The mapping is maintained by hand against ofac.treasury.gov, re-synced to the API daily, and published in full — with its verification date — on the sanctioned countries reference page. Two limits to design around: an IP in a flagged country says nothing about whether a specific person or company is designated (that is what SDN screening is for), and a user behind a VPN can present an IP from a permitted country, which is why the flag pairs with VPN detection.
Where jurisdiction geofencing is applied
Exchanges and brokerages apply it at signup and per session, so accounts are not opened or traded from embargoed jurisdictions. DeFi front-ends check the requesting client before a wallet is allowed to interact with contracts. Stablecoin issuers and payment processors check on payment initiation and partner onboarding. And US products with state-level obligations use the region field to treat New York (and other states their policy names) differently from the rest of the country.
In each case the API supplies the location and the sanctions context; which jurisdictions to restrict, and whether to block, limit features or route to review, remains the operator's policy — the endpoint never enforces anything on its own.
Geofencing vs VPN detection: why you need both
IP geofencing answers "which jurisdiction does this request appear to come from?". It cannot answer "is that appearance trustworthy?" — a user in an embargoed country who connects through a VPN exit node in a permitted country passes every country rule silently. The VPN detection API answers the second question with a true / false / unknown signal for the same IP, so a jurisdiction decision can be weighted by how much the location result deserves to be trusted. Most teams call both: geolocation for the rule, VPN detection for the confidence.
Jurisdiction rules without stitching providers together
Geofencing a crypto app usually means integrating a geolocation provider, separately working out which countries and regions your policy restricts, mapping OFAC sanctions programs to country codes yourself, and keeping that mapping current.
CompliAPI combines the lookup and the sanctions context in one request. You get the location and a sanctioned flag together — at signup, on wallet connect, or per session — and your application decides what to do with it: block, restrict features, or log.
CompliAPI returns location signals and sanctions context; it does not decide or enforce your access policy, and no IP-based location signal should be treated as infallible.
How it works
Send a request
Call /geo to evaluate the calling client's IP, or /geo/{ip} for any address your systems have observed.
CompliAPI geolocates and checks sanctions designations
The IP is geolocated to city, region and country, and the country is checked against curated OFAC sanction designations.
Apply your policy
Your application branches on the structured result — block, geo-restrict features, require review, or proceed.
What you can screen
- The calling client's IP (no argument needed)
- Any public IPv4 or IPv6 address
Where teams use it
Restricted-jurisdiction gating
Check the requesting client before a DeFi frontend lets a wallet interact with your contracts.
US state-level rules
Use the region field to apply different handling for users in New York State or other jurisdictions your policy treats separately.
Signup screening
Flag registrations from comprehensively sanctioned countries for blocking or review.
Feature availability
Serve different product experiences by country where regulatory treatment differs.
Pairing with VPN detection
Combine with the VPN endpoint to judge how much weight to give a location signal.
Scope and limitations
Geofencing signals support access-control decisions; they don't make them. Keep these boundaries in mind:
IP geolocation is probabilistic
Location derived from an IP address is an estimate. It is useful evidence, not proof of where a user is.
Users can obscure location
VPNs and proxies can shift apparent location. Pair geofencing with VPN detection when that matters to your policy.
You own the policy
CompliAPI reports where a request appears to come from and whether that country carries OFAC designations. Which jurisdictions you restrict, and how, is your organization's decision.
Curated country designations
OFAC does not publish a single official list of sanctioned countries. CompliAPI curates designations across comprehensive, targeted and military programs, with a source link for each.
Frequently asked questions
Is this a mobile geofencing SDK?
No. Mobile geofencing SDKs (Android's GeofencingClient, Apple Core Location regions, and location-platform SDKs) fire events when a device enters or leaves a geographic area, using the device's own GPS. This API works on the other side: it takes an IP address from a request your servers already see and returns the jurisdiction it appears to come from, plus an OFAC sanctioned-country flag. It is for access control by jurisdiction, not for proximity features.
Do you have a geofencing SDK?
The API is a plain authenticated GET request, so it works from any language without an SDK — the cURL, Python and Node examples above are complete. For AI-agent stacks, the same geolocation is exposed as a tool on CompliAPI's MCP server, alongside VPN detection and the screening tools.
Is there a free geofencing API tier?
Yes. A free API key includes 10,000 requests per month across all endpoints, geolocation included, and requests can also be paid per call with x402 USDC micropayments without an account. Paid plans raise the monthly quota.
Which countries are flagged as sanctioned?
Countries and regions under OFAC sanctions programs, curated by CompliAPI across comprehensive, targeted and military designations. Each flag includes a source_url so you can review the underlying program.
Can I apply state-level rules like New York?
Yes — responses include city and region alongside country, so your application can implement rules such as special handling for New York State users.
Do I have to pass an IP address?
No. Calling GET /api/v1/geo with no argument evaluates the calling client's public IP. You can also pass any public IP explicitly, for example from your own request logs.
Is IP-based geofencing enough on its own?
It depends on your obligations and risk appetite. IP signals are a widely used control but can be evaded; organizations should decide, with qualified counsel where appropriate, what combination of controls their policy requires.
Related
Access controls
VPN Detection API for OFAC & Sanctions Screening
Detect VPNs that defeat geo-blocking.
Sanctions screening
OFAC API — screen against the official SDN list
Screen crypto wallets, emails, IDs and countries against the official US Treasury OFAC SDN list, refreshed every 15 minutes.
Use case
OFAC compliance API for DeFi
Add sanctions screening, geofencing and VPN detection to a DeFi frontend: screen connecting wallets against the OFAC SDN list and apply jurisdiction rules with simple GET requests.
Use case
Sanctions screening for stablecoin payments
OFAC screening for stablecoin payment flows: check sender and recipient wallets against the SDN list and screen counterparty details before funds move.
Add geofencing to your application
Get a free API key and make your first request in minutes.
14-day free trial. No credit card required.
CompliAPI provides data and tools that support compliance workflows. It does not provide legal advice, and organizations should determine their obligations with qualified counsel.