Stolen cards and compromised accounts rarely come from a user's usual country
When someone tests a list of leaked passwords or stolen credit cards against your app, the requests often arrive from a country the customer has never signed in from before, or from an unfamiliar network operator.
Be honest with how you use location data: IP geolocation is one signal, not proof of fraud. Real customers travel, use corporate VPNs, and connect over mobile networks where city-level location is only an approximation. Rather than blocking a customer outright on an IP mismatch alone, combine IP country and network data with other signals — such as a new device, unusual order size, or repeated failed attempts — to ask for an email verification code, 3D Secure check, or manual review.
Calling https://api.ipatlas.dev/v1/{ip} from your backend returns country_code, country and asn (number and organization, identifying the internet provider or hosting network) in milliseconds. Looked-up IP addresses are never logged by ipatlas, and you can start with 50,000 free lookups a month with no credit card.
Example: flag a login or checkout for step-up verification
async function checkLoginRisk(clientIp, expectedCountryCode) {
const res = await fetch(`https://api.ipatlas.dev/v1/${encodeURIComponent(clientIp)}`, {
headers: { "X-API-Key": process.env.IPATLAS_KEY }
});
if (!res.ok) return { stepUpVerify: false }; // fail open if lookup is unavailable
const geo = await res.json();
// One signal, not proof: trigger a verification code instead of blocking
const countryMismatch = Boolean(geo.country_code && geo.country_code !== expectedCountryCode);
return {
stepUpVerify: countryMismatch,
ipCountryCode: geo.country_code || null,
networkOrg: geo.asn ? geo.asn.organization : null
};
}
Related resources
- Show prices in the visitor's local currency on your pricing page
- Adapt pages and notices for EU visitors with the
is_eufield - Suggest the right language or regional site without forced redirects
- All IP geolocation use cases, API documentation and pricing plans ($0 free tier, paid plans at $9, $29 and $99/month)
Get your free API key
Start with 50,000 free lookups a month — no credit card required. Paid plans start at $9/month with hard caps and no surprise bills.