Backend/ip/currency/timezone

IP geolocation API use cases — content localisation, fraud detection, and geo-routing

IP geolocation is one of the most versatile building blocks in any web app. Here are the most common production patterns — from showing currency in the user's local denomination to blocking access by region.

Get free API key Full docs
01

Detect user location on first visit

Call the API server-side (in a Next.js middleware or API route) using the X-Forwarded-For header:

// Next.js API route
const ip = req.headers['x-forwarded-for']?.split(',')[0] || req.socket.remoteAddress;
const res = await fetch(
  `https://aplicious.com/api/v1/ip/lookup?ip=${ip}`,
  { headers: { 'X-API-Key': process.env.LAPI_KEY } }
);
const { data } = await res.json();
// { country_code, city, timezone, isp, is_vpn }
02

Auto-select currency based on country

Combine /ip with /currency to show prices in the visitor's currency automatically:

const { country_code } = ipData; // from step 1
const COUNTRY_CURRENCY = { IN: 'INR', US: 'USD', GB: 'GBP', EU: 'EUR' };
const currency = COUNTRY_CURRENCY[country_code] || 'USD';
// Now fetch /currency/convert?from=USD&to={currency}
03

Set the correct timezone

Use the timezone field from /ip to pair with the /timezone namespace for correct local time display:

const { timezone } = ipData; // e.g. "Asia/Kolkata"
const res = await fetch(
  `https://aplicious.com/api/v1/timezone/current?tz=${timezone}`,
  { headers: { 'X-API-Key': process.env.LAPI_KEY } }
);
// { local_time, utc_offset, is_dst }
04

VPN / proxy detection for fraud prevention

The is_vpn, is_proxy, and is_datacenter flags help you flag suspicious signups:

const { is_vpn, is_proxy, is_datacenter } = ipData;
if (is_vpn || is_proxy) {
  // Flag for manual review or require phone verification
}
05

Geographic access control

Restrict access to certain content by country — useful for licensing compliance:

const BLOCKED_COUNTRIES = ['XX', 'YY'];
if (BLOCKED_COUNTRIES.includes(ipData.country_code)) {
  return res.status(451).json({ error: 'Not available in your region' });
}

Why APlicious?

The /ip namespace pairs naturally with /currency (auto-pricing), /timezone (correct local time), and /geocode (map rendering) — all on the same key and the same plan.

Ready to build?

Free tier · 500 calls/month · No credit card · All 34 APIs included

Get your free API key

More guides

Build a Finance Dashboard with Stocks, SIP & Forex APIs

Read guide

Build a Weather Widget with the APlicious Weather API

Read guide

Build a News Aggregator with the APlicious News API

Read guide