Welcome to the UniRate API Rust documentation. Our free exchange rate API gives you real-time and historical currency conversion — drop it into your Tokio/axum/warp service, CLI, or embedded data pipeline and you're done.
The official Rust client crate uses modern async/await, returns Send + Sync models via serde, and pulls in reqwest with rustls so there's no OpenSSL dependency to manage.
async/await, Send + Sync, serde-derived models
reqwest (rustls) + serde + thiserror — no OpenSSL
UniRateError via thiserror
For full reference on endpoints, rate limits, and advanced options, see our main API documentation.
Below you'll find examples using the official UniRate Rust crate.
Add the crate to your Cargo.toml with cargo add unirate-api, or declare it manually alongside a Tokio async runtime.
// Cargo.toml
// [dependencies]
// unirate-api = "0.1"
// tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
use unirate_api::Client;
#[tokio::main]
async fn main() -> Result<(), Box> {
let client = Client::new("YOUR_API_KEY");
// Current rate
let rate = client.get_rate("USD", "EUR").await?;
println!("USD -> EUR: {rate}");
// Convert an amount
let euros = client.convert(100.0, "USD", "EUR").await?;
println!("100 USD = {euros} EUR");
// All rates for a base
let rates = client.get_all_rates("USD").await?;
println!("{} rates for USD", rates.len());
// Supported currencies
let codes = client.get_supported_currencies().await?;
println!("{} currencies supported", codes.len());
// Historical rate on a specific date
let hist = client.get_historical_rate("2024-01-01", "USD", "EUR").await?;
println!("USD -> EUR on 2024-01-01: {hist}");
// Time series (up to 5 years)
let series = client
.get_time_series(
"2024-01-01",
"2024-01-07",
"USD",
Some(&["EUR", "GBP"]),
1.0,
)
.await?;
let _ = series;
// VAT rate for a country (ISO-3166 alpha-2)
let germany = client.get_vat_rate("DE").await?;
println!("Germany VAT: {}%", germany.vat_data.vat_rate);
Ok(())
}
USD -> EUR: 0.9245
100 USD = 92.45 EUR
593 rates for USD
593 currencies supported
USD -> EUR on 2024-01-01: 0.9056
Germany VAT: 19%
We offer paid implementation services to integrate our API into your application without you needing to write any code.
Contact Us for a QuoteSign up now to get your API key and start converting currencies in your Rust applications.
Get Your API Key