A currency converter API should return more than a multiplied number. You need the rate, converted amount, source, observation time, market session, and a clear indication of whether the pair was derived. exchangerate.dev returns that evidence with every conversion.
GET /v1/convert/USD/EUR/100 without a key; use a server-side key for production.Make the first currency conversion request
The path contains the source currency, target currency, and amount. This anonymous request is suitable for evaluation. For a deployed application, create a free key and keep it on your server.
The response includes from, to, amount, rate, converted, derived, and derivation_bps_max, plus the normal response envelope: source, sources, market_session, timestamp, and data_updated_at. Those fields let the application explain what it converted and how fresh the underlying observation was.
Convert several amounts in one request
Use the POST endpoint when a job needs several target currencies. Each pair counts toward quota separately, but batching reduces network round trips and keeps the results in one response.
Keep rates precise and round money at the boundary
Store the returned rate at full precision. Round the final money amount according to the target currency and the rules of your product. The conversion endpoint quantizes converted for the target currency, but accounting systems should still preserve the original amount, rate, currency codes, and observation time beside the booked result.
Cache by data cadence, not page views
Do not call the upstream API once per browser render. Fetch on the server, cache a successful response, and reuse it until your product needs a refresh. Preserve data_updated_at when a refresh fails so users can see the age of the last good observation.
- Set a request timeout and handle
429and503explicitly. - Keep the API key in a server environment variable, never in browser JavaScript.
- Retain the last successful response for a bounded fallback window.
- Display the observation time and rate class when freshness matters.
Use the pattern in your stack
Follow the focused guides for React, Ruby on Rails, Shopify, or WooCommerce. Each keeps the upstream call on the server and separates display estimates from executable checkout prices.
