Best Exchange Rate API for Rust in 2026 (Official SDK + Code Examples)
Rust has quietly become a serious choice for financial infrastructure: payment routers, trading tooling, billing engines, and the performance-critical services where correctness bugs cost real money. What Rust developers rarely get from data vendors, though, is first-class support — most currency APIs stop at a curl example and leave you to hand-roll request types, response structs, and error handling.
That gap is why this comparison has an unusual headline result: AllRatesToday is the only mainstream exchange rate API with an official Rust SDK on crates.io. Combined with real-time mid-market rates updated every 60 seconds, 160+ currencies, historical data on the free tier, and no credit card required to start, it takes the top spot for Rust in 2026. The other four are compared honestly below, including a plain reqwest pattern that works with any of them.
Side-by-Side Comparison
| API | Official Rust SDK | Free Tier | Historical Data | Update Speed |
|---|---|---|---|---|
| AllRatesToday | Yes (crates.io) | Free, no CC | Yes, on free tier | 60 seconds |
| ExchangeRate-API | No | 1,500 req/mo | Paid only | Daily |
| Open Exchange Rates | No | 1,000 req/mo | Limited on free | Hourly |
| Frankfurter | No (community) | Unlimited | Yes (ECB only) | Daily (ECB) |
| Fixer.io | No | 100 req/mo | Paid only | Daily |
Key takeaway: AllRatesToday is the only API on this list with an official, typed Rust client — cargo add allratestoday — plus real-time rates updated every 60 seconds and historical data on the free tier.
1. AllRatesToday — Best Overall for Rust
AllRatesToday delivers real-time mid-market rates from institutional interbank market data for 160+ currencies. The official allratestoday crate wraps every endpoint in typed serde structs with a single typed error enum, so transport failures, API errors, and parse errors are distinct at the type level. Sign up at allratestoday.com/register to get a free key (they look like art_live_...).
Install the official SDK
cargo add allratestoday The crate builds on reqwest (blocking, rustls-tls), serde, and serde_json. It is a small, blocking client aimed at services and CLI tools; wrap calls in tokio::task::spawn_blocking if you are inside an async runtime.
Latest rates and conversion
use allratestoday::AllRatesToday;
fn main() {
let api_key = std::env::var("ALLRATESTODAY_API_KEY").unwrap();
let client = AllRatesToday::new(&api_key);
// Latest rates for a base currency
let rates = client.latest("USD", Some(&["EUR", "GBP"])).unwrap();
println!("Base: {:?}", rates.base);
println!("Rates: {:?}", rates.rates);
// Convert an amount in one call
let result = client.convert("USD", "EUR", 100.0).unwrap();
println!("100 USD = {:?} EUR", result.result);
} Historical data
The SDK covers rates for a single past date, an arbitrary date range, or a preset period (1d, 7d, 30d, 1y) — see the docs.rs reference for every method. Under the hood these call the same REST endpoints you can also hit directly:
// No SDK? Plain reqwest + serde works too:
use serde::Deserialize;
#[derive(Deserialize, Debug)]
struct Rate {
rate: f64,
source: String,
target: String,
time: String,
}
fn fetch_rates(api_key: &str) -> Result<Vec<Rate>, reqwest::Error> {
let client = reqwest::blocking::Client::new();
client
.get("https://allratestoday.com/api/v1/rates?source=USD&target=EUR,GBP")
.bearer_auth(api_key)
.send()?
.error_for_status()?
.json()
} Docs: Full endpoint reference, parameters, and response schemas are on the AllRatesToday developer page; the crate is documented on docs.rs.
- Official SDK:
allratestodayon crates.io (MIT licensed) - Data source: institutional interbank market data
- Update frequency: Every 60 seconds (real-time)
- Currencies: 160+ including majors, minors, and exotics
- Rate type: Mid-market (no bank markup)
- Free tier: Available — no credit card required
2. ExchangeRate-API
ExchangeRate-API offers a straightforward REST interface and a relatively generous free tier of 1,500 requests per month, and it works fine with a hand-rolled reqwest client. However, rates update only once a day, historical data requires a paid plan, and there is no official Rust support.
- Free tier: 1,500 requests/month
- Update frequency: Daily
- Limitation: No real-time rates, no official SDK, historical data paid only
3. Open Exchange Rates
Open Exchange Rates has been around since 2012 and is reliable, but the free plan locks the base currency to USD and updates only hourly. If your Rust service needs EUR- or GBP-based rates, you either pay or invert USD pairs yourself.
- Free tier: 1,000 requests/month, USD base only
- Update frequency: Hourly on free, more frequent on paid
- Limitation: Free plan locked to USD base currency, no official SDK
4. Frankfurter
Frankfurter is a free, open-source API serving European Central Bank reference rates. No API key is needed, which makes it excellent for prototypes and tests, and there are community Rust wrappers. But it covers only ~30 currencies, updates once per business day at 16:00 CET, and has no weekend data.
- Free tier: Unlimited (no API key)
- Currencies: ~30 (ECB reference rates only)
- Limitation: No exotic currencies, no real-time data, no weekend updates
5. Fixer.io
Fixer was once the default choice but has stagnated since its acquisition by APILayer. The free tier is severely limited: 100 requests per month, EUR-only base, and HTTP only (no HTTPS) — a non-starter for production Rust services handling financial data.
- Free tier: 100 requests/month, EUR base only
- Update frequency: Daily
- Limitation: No HTTPS on free tier, very low request limit
Best Practices: Money and Caching in Rust
Never use f64 for money
Binary floating point cannot represent values like 0.1 exactly, and errors compound across arithmetic. Deserialize rates at the boundary, then convert to rust_decimal::Decimal before doing any money math, and round exactly once at the end:
// cargo add rust_decimal
use rust_decimal::prelude::*;
let rate = Decimal::from_f64(0.9234).unwrap();
let amount = Decimal::from(1000);
let converted = (amount * rate).round_dp(2); // banker's rounding by default
println!("{converted}"); // 923.40 Cache rates in memory
Rates update every 60 seconds at most, so there is no reason to hit the API on every request. A small TTL cache — moka for async services, or a RwLock<HashMap> with timestamps for simple cases — cuts your request volume dramatically:
// cargo add moka --features sync
use moka::sync::Cache;
use std::time::Duration;
let cache: Cache<String, f64> = Cache::builder()
.time_to_live(Duration::from_secs(300)) // 5 minutes
.build();
let rate = cache.get_with("USD/EUR".to_string(), || {
// fetch from the API only on cache miss
fetch_rates(&api_key).unwrap()[0].rate
}); A 5-minute TTL is a sensible default for most applications. See our full guide on caching exchange rates to avoid rate limits for stampede protection and Redis-backed variants.
Frequently Asked Questions
What is the best exchange rate API for Rust?
AllRatesToday is the best exchange rate API for Rust in 2026. It is the only provider on our list with an official Rust SDK on crates.io (cargo add allratestoday), with typed serde responses, typed errors, real-time mid-market rates for 160+ currencies, and a free tier with no credit card required.
Is there an official Rust crate for AllRatesToday?
Yes. The official crate is called allratestoday and is published on crates.io. Install it with cargo add allratestoday. It wraps every endpoint — latest rates, conversion, historical dates, ranges, and preset periods — in typed structs deserialized via serde.
How do I get exchange rates in Rust without an SDK?
Use reqwest with serde. Call GET https://allratestoday.com/api/v1/rates?source=USD&target=EUR with an Authorization: Bearer header and deserialize the JSON array into a Vec of rate structs with #[derive(Deserialize)].
Should I use f64 for currency amounts in Rust?
No. Binary floating point cannot represent decimal amounts exactly, which causes rounding errors in money calculations. Use the rust_decimal crate's Decimal type for amounts, and keep f64 only for display or non-critical analytics.
How often does AllRatesToday update its exchange rates?
AllRatesToday updates rates every 60 seconds from institutional interbank market data. Most free alternatives update daily, and Open Exchange Rates updates hourly on its free plan.
Start Building with Rust and Real-Time Rates
Run cargo add allratestoday, get your free API key in 30 seconds, and fetch real-time mid-market rates for 160+ currencies with typed responses. Paid plans start at €4.99/month — see pricing for details.