Currency Converter Widget — AllRatesToday Documentation
Embed a free currency converter on any website with one line of code. No API key needed — official ECB reference rates keyless, real-time mid-market rates with a free key. JavaScript and iframe embeds, full attribute reference.
Currency Converter Widget
A drop-in currency converter you can embed on any website. Keyless it shows official ECB reference rates (updated each business day, 30+ major currencies); with a free API key it uses the same real-time mid-market rates as the AllRatesToday API across 150+ currencies. It isolates its styles (Shadow DOM) so it never clashes with your page's CSS. There's also a live preview on the widget page.
JavaScript embed (recommended)
Paste this where you want the converter to appear — it works immediately, no signup:
<!-- AllRatesToday currency converter (no API key needed) -->
<div class="art-currency-widget" 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:
<iframe
src="https://allratestoday.com/embed/converter?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 | — | Optional. Your API key for real-time mid-market rates, 150+ currencies, dedicated quota + stats (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 |
Optional: add a free API key
Without a key the widget uses daily official ECB reference rates from the
edge-cached open endpoint. With a free key
(data-api-key="art_live_…") it switches to real-time
mid-market rates across 150+ currencies, conversions run on your plan's
dedicated quota and show up in your
dashboard — see pricing.
The endpoints it calls
The widget is a thin client. Keyless embeds call the
open central-bank endpoint
(GET /api/open/central-bank/ecb?source=USD&target=EUR, no key);
keyed embeds call the keyed endpoint below. You can call either 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": "interbank" } 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 | Invalid or disabled API key (keyed mode only) | "Invalid API key" + register link |
404 | Pair not in the ECB table (keyless mode only) | "Pair not covered" + free-key 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. The "Powered by AllRatesToday" link must remain visible on keyless embeds — it's how we keep the open endpoint free for everyone. Keyed embeds are welcome to keep it too.