TutorialExchange RatesJavaScript

Add Live Exchange Rates to Your App in 5 Minutes

ApogeoAPI5 min read

Showing prices in a user's local currency increases trust and conversion. With ApogeoAPI, you can add live exchange rates to your app in a few lines of code — and it's included in the same subscription as your country and city data.

The Problem

Most apps either show prices in USD only (losing international users) or integrate a separate exchange rate API (another service to manage, another bill to pay). ApogeoAPI bundles exchange rates with geographic data under one key.

Get Your API Key

Free tier at apogeoapi.com. Exchange rates are available during the 14-day full-access trial. Basic plan and above after that.

Fetch a Single Rate

// Get the EUR → USD rate
const response = await fetch(
  'https://api.apogeoapi.com/v1/exchange-rates/EUR',
  { headers: { 'X-API-Key': 'your_api_key' } }
);

const data = await response.json();
// { currency: 'EUR', usdRate: 1.08, lastUpdated: '2026-03-26T10:00:00Z', stale: false }

const priceInEUR = priceInUSD / data.usdRate;

Detect the User's Currency via IP

Combine IP geolocation + exchange rates to show the right currency automatically:

// 1. Detect user's country from IP
const geoRes = await fetch(
  'https://api.apogeoapi.com/v1/geolocate/auto', // uses request IP
  { headers: { 'X-API-Key': 'your_api_key' } }
);
const geo = await geoRes.json();
// { country_code: 'DE', currency: 'EUR', ... }

// 2. Get the exchange rate for that currency
const rateRes = await fetch(
  `https://api.apogeoapi.com/v1/exchange-rates/${geo.currency}`,
  { headers: { 'X-API-Key': 'your_api_key' } }
);
const rate = await rateRes.json();

// 3. Display the localized price
const localPrice = (usdPrice / rate.usdRate).toFixed(2);
console.log(`$${usdPrice} USD = ${geo.currency} ${localPrice}`);

Handle Stale Data Gracefully

The API returns stale: true if the data hasn't been updated in 6+ hours (rare, but can happen during outages). Handle it:

if (rate.stale) {
  // Show an indicator: "Rates may be slightly outdated"
  showToast('Exchange rates are approximate — refresh for latest');
}

Rates Are Updated Every 4 Hours

ApogeoAPI uses ExchangeRate-API as primary source (161 currencies including ARS, BRL, MXN) with Frankfurter (ECB data, 33 currencies) as fallback. Data is cached in Redis and refreshed on a cron every 4 hours.

All 161 Supported Currencies

USD, EUR, GBP, JPY, AUD, CAD, CHF, CNY, HKD, NZD, SEK, KRW, SGD, NOK, MXN, INR, RUB, ZAR, TRY, BRL, TWD, DKK, PLN, THB, IDR, HUF, CZK, ILS, CLP, PHP, AED, COP, SAR, MYR, RON, ARS, and 125+ more.

Next Steps

With the same API key you can also: get country data for all 250+ countries (GET /v1/countries), search 150K+ cities (GET /v1/countries/{iso}/cities), and geolocate IPs. One subscription, one key, no juggling.

Try ApogeoAPI free

1,000 requests/month forever. 14-day full-access trial. No credit card.

Get your free API key