Currency Converter Widget — AllRatesToday Documentation
Embed a free, real-time currency converter on any website with one line of code. Requires a free AllRatesToday API key. JavaScript and iframe embeds, full attribute reference.
Currency Converter Widget
A drop-in, real-time currency converter you can embed on any website. It uses the same live mid-market rates as the AllRatesToday API, covers 150+ currencies, and isolates its styles (Shadow DOM) so it never clashes with your page's CSS. There's also a live preview on the widget page.
1. Get an API key
- Register a free account and verify your email.
- Copy your API key from the dashboard — it looks like
art_live_….
The free tier needs no credit card. Every conversion the widget performs counts as one request against your plan's monthly quota — see pricing.
2. JavaScript embed (recommended)
Paste this where you want the converter to appear, replacing YOUR_API_KEY:
<!-- AllRatesToday currency converter -->
<div class="art-currency-widget" data-api-key="YOUR_API_KEY" data-base="USD" data-target="EUR"></div>
<a href="https://allratestoday.com">Powered by AllRatesToday</a>
<script async src="https://allratestoday.com/widget.js"></script> iframe embed
No JavaScript required — works on any CMS, including ones that strip scripts. Pass the key in the key= query parameter:
<iframe
src="https://allratestoday.com/embed/converter?key=YOUR_API_KEY&base=USD&target=EUR&theme=light"
width="400" height="320" frameborder="0" loading="lazy"
title="Currency converter by AllRatesToday"></iframe> Attributes
| Attribute | Default | Description |
|---|---|---|
data-api-key | — | Required. Your API key (use key= on the iframe URL) |
data-base | USD | Starting "from" currency (ISO 4217) |
data-target | EUR | Starting "to" currency (ISO 4217) |
data-amount | 1 | Starting amount |
data-theme | light | light or dark |
The endpoint it calls
The widget is a thin client over a single keyed endpoint. You can call it directly if you'd rather build your own UI:
GET https://allratestoday.com/api/widget/rate?source=USD&target=EUR&key=YOUR_API_KEY Response:
{ "rate": 0.8663, "source": "refinitiv" } The key may also be sent as a header: Authorization: Bearer YOUR_API_KEY. The endpoint sends Access-Control-Allow-Origin: *, so it works from the browser on any domain.
Error responses
| Status | Meaning | Widget shows |
|---|---|---|
400 | Missing source or target | — |
401 | Missing, invalid, or disabled API key | "Invalid API key" + register link |
429 | Monthly request limit exceeded | "Monthly limit reached" + upgrade link |
502 | Upstream rate provider error | "Rate unavailable" |
A note on key visibility
Because the widget runs in the browser, the API key is visible in your page's source — this is normal for client-side keys. Usage is always counted against your quota, and you can disable or rotate a key anytime from the dashboard. For server-to-server use, keep your key on the backend and call the authenticated rates endpoint instead.
License & attribution
The widget script is MIT-licensed. Please keep the "Powered by AllRatesToday" link in your embed — it's how we keep the free tier sustainable.