Currency API
Currency API for apps: convert amounts, show prices in a visitor's currency, list 160+ currencies, and pull official central bank rates. SDKs for JavaScript, Python, PHP, Go and Rust. Free key, no credit card.
Convert an amount
Fetch the pair, multiply. With the JavaScript SDK:
import { AllRatesToday } from "@allratestoday/sdk";
const api = new AllRatesToday({ apiKey: process.env.ALLRATES_API_KEY });
const [q] = await api.rates({ source: "USD", target: "EUR" });
const eur = 49.99 * q.rate; // 49.99 USD in EUR The rate is mid-market, refreshed every 60 seconds, with no spread added. If you need to show what a bank or card would charge, add your own margin on top; the API never hides one.
Show prices in the visitor's currency
One request quotes many targets, so a whole price list converts with a single call. Cache it for an hour and every visitor is served from it:
import requests
# Quote a USD price list in the visitor's currency: one request, many targets
r = requests.get(
"https://allratestoday.com/api/v1/rates",
params={"source": "USD", "target": "EUR,GBP,INR,JPY,BRL"},
headers={"Authorization": "Bearer art_live_your_key"},
)
rates = {q["target"]: q["rate"] for q in r.json()}
print(round(49.99 * rates["INR"], 2), "INR") For a client-side version that detects the visitor's country and rewrites prices, use react-currency-localizer-realtime, which works keyless by default.
List the currencies
Populate a dropdown or validate input from the symbols endpoint:
curl "https://allratestoday.com/api/v1/symbols" -H "Authorization: Bearer art_live_your_key" [
{ "code": "AED", "name": "United Arab Emirates Dirham" },
{ "code": "AFN", "name": "Afghan Afghani" },
...
] Record the official rate
Accounting, VAT and customs usually need the rate a named institution published for a date rather than the market rate. Those tables are open, no key needed:
// The rate a tax return needs: HMRC's monthly rate, no key required
const r = await fetch("https://allratestoday.com/api/open/central-bank/hmrc?source=GBP&target=EUR")
.then(r => r.json());
// r.rate, r.rate_date, r.rate_type === "monthly" 100+ central banks and tax authorities are covered; see the central bank rates API and the tax authority rates.
SDKs
| Language | Package | Install |
|---|---|---|
| JavaScript / TypeScript | @allratestoday/sdk | npm i @allratestoday/sdk |
| Python | allratestoday | pip install allratestoday |
| PHP | allratestoday/sdk | composer require allratestoday/sdk |
| Go | allratestoday-go | go get github.com/AllRates-Today/allratestoday-go |
| Rust | allratestoday | cargo add allratestoday |
| React | react-currency-localizer-realtime | npm i react-currency-localizer-realtime |
| AI agents | MCP server | npx @allratestoday/mcp-server |
PHP:
$api = new AllRatesToday\Client('art_live_your_key');
$quote = $api->rates('USD', ['EUR'])[0]; Go:
client := allratestoday.New(os.Getenv("ALLRATES_API_KEY"))
quotes, err := client.Rates(ctx, "USD", []string{"EUR"}) Starter projects for Next.js, React, Python and Google Sheets are on GitHub with the "Use this template" button.
Three habits that keep a currency feature correct
- Store the rate with the amount. Save the rate, its source and its timestamp next to every converted figure. A price shown last month cannot be reproduced from today's rate.
- Cache on the server, not per request. Rates change every minute, but a checkout does not need a fresh fetch per visitor. A one-hour cache keeps a busy site inside a small quota; the caching guide has patterns for each stack.
- Use the official rate where the rules say so. Invoices, tax and customs name an institution and a date. Use the open central bank endpoint for those and keep the market rate for pricing.
Frequently asked questions
What is a currency API?
A web service that gives software what it needs to work in more than one currency: rates, currency codes and names, and conversion between pairs.
How do I convert with it?
Request the pair from the rates endpoint and multiply. Several targets can be requested in one call.
Which currencies are supported?
Over 160 ISO currencies for live rates, listed by the symbols endpoint, plus whatever each central bank publishes on its official table.
Can I call it from the browser?
The keyless official-rate endpoints, yes. Keyed live rates should go through your server so the key stays private.
Is there a free plan?
Yes, with a request quota and no credit card. Details on the free currency API page.
Add currency support to your app
Free key in 30 seconds. SDKs for five languages. Official rates need no key at all.
Get Free API Key Read the Docs