Currency API for JavaScript: 5 Best Options in 2026 (npm + Code)
The 5 best currency exchange rate APIs for JavaScript and Node.js in 2026, ranked — npm SDKs, working fetch examples, free-tier limits and pricing compared side by side.
Building a JavaScript app that needs exchange rates? Whether it's a Node.js backend, a React
dashboard, or a Next.js SaaS, you want an API with a proper npm package — not raw
fetch() calls everywhere. Here's how the top providers compare for JS/TS developers.
Quick Comparison
| Provider | npm Package | TypeScript | Free Tier | Update Freq | Price |
|---|---|---|---|---|---|
| AllRatesToday | @allratestoday/sdk | Native TS | Free | 60 seconds | Free / €4.99 |
| ExchangeRate-API | No official SDK | No | 1,500 req/mo | Daily | Free / $9.99 |
| Frankfurter | No official SDK | No | Unlimited | Daily (ECB) | Free |
| Open Exchange Rates | oxr (community) | No | 1,000 req/mo | Hourly | Free / $12 |
| Fixer | No official SDK | No | 100 req/mo | Hourly | Free / €9.99 |
1. AllRatesToday
AllRatesToday ships an official TypeScript SDK on npm with full type definitions, auto-completion, and a dedicated React hook package. Rates are mid-market from institutional foreign exchange market data, updated every 60 seconds. Zero dependencies beyond the SDK itself.
npm install @allratestoday/sdk
import AllRatesToday from '@allratestoday/sdk';
const client = new AllRatesToday({ apiKey: process.env.ALLRATES_API_KEY });
// Current rate
const { rate } = await client.getRate('USD', 'EUR');
console.log(`1 USD = ${rate} EUR`);
// Several targets in one call
const { rates } = await client.latest({ base: 'USD', symbols: ['EUR', 'GBP', 'JPY'] });
// Historical rates (last 30 days, paid plans)
const history = await client.getHistoricalRates('USD', 'EUR', '30d');
history.rates.forEach(p => console.log(`${p.time}: ${p.rate}`));
// Official ECB reference rate — no key needed
const ecb = await new AllRatesToday().officialRates('ecb', { source: 'EUR', target: 'USD' });React developers get a price-localization component that works keyless on daily ECB rates and switches to real-time rates with a key:
npm install react-currency-localizer-realtime
import { LocalizedPrice } from 'react-currency-localizer-realtime';
// Shows $99.99 in the visitor's own currency
Pros
- Official TypeScript SDK with full types
- React price-localization component
- Keyless official central-bank rates in the same SDK
- Real-time rates (60s updates)
- Mid-market rates, no markup
- MCP server for AI coding tools
Cons
- Free tier is non-commercial; history needs a paid plan
- Newer provider
2. ExchangeRate-API
Generous free tier at 1,500 requests/month. No official npm package — you use fetch()
directly. Rates update daily on the free plan. Straightforward JSON responses.
const resp = await fetch('https://v6.exchangerate-api.com/v6/YOUR_KEY/latest/USD');
const data = await resp.json();
console.log(`USD to EUR: ${data.conversion_rates.EUR}`);Pros
- 1,500 free requests/month
- Simple REST API
Cons
- No npm SDK or TypeScript types
- Daily updates only on free tier
3. Frankfurter
Open-source, free, no API key. Only 33 currencies (ECB reference rates). Great for prototypes and EU-focused apps that don't need exotic pairs.
const resp = await fetch('https://api.frankfurter.dev/v1/latest?base=USD&symbols=EUR,GBP');
const data = await resp.json();
console.log(data.rates);Pros
- Free, no key needed
- Open-source
Cons
- Only 33 currencies
- No SDK, no TypeScript types
- No SLA
4. Open Exchange Rates
Established provider with hourly updates on paid plans. A community oxr npm package
exists but is not officially maintained. USD-only base on free plan.
Pros
- Established since 2012
- 170+ currencies
Cons
- No official npm SDK
- USD-only on free plan
- $12/mo minimum for flexible base
5. Fixer
Part of Apilayer. Only 100 free requests/month. HTTPS requires a paid plan. No npm SDK.
Pros
- 170 currencies
- Apilayer ecosystem
Cons
- 100 req/mo free tier
- HTTPS is paid only
- No npm SDK
Our Verdict
AllRatesToday wins for JavaScript/TypeScript developers. It's the only provider with an official npm SDK, native TypeScript types, a React component, and real-time data. If you just need a quick prototype with major currencies, Frankfurter is free and keyless.
Start building in JavaScript
npm install @allratestoday/sdk — no credit card.