UniRate Rust Client
Official Rust client for the UniRate API — free, real-time and historical currency exchange rates plus VAT rates.
- Real-time exchange rates between 170+ currencies (fiat + crypto)
- Historical rates back to 1999
- Time-series ranges up to 5 years
- Currency conversion (current and historical)
- VAT rates for countries worldwide
- Free tier, no credit card required
- Modern Rust:
async/await,Send + Sync,serde-derived models - Pulls in only
reqwest(rustls) +serde+thiserror— no OpenSSL dependency
Requirements
- Rust 1.74+ (stable)
- An async runtime (examples and tests use [
tokio])
Installation
Add to your Cargo.toml:
[]
= "0.1"
= { = "1", = ["macros", "rt-multi-thread"] }
Or via the CLI:
Quick start
use Client;
async
Get a free API key at https://unirateapi.com.
API
Current rates
// Single pair
let rate: f64 = client.get_rate.await?;
// All rates for a base
let rates: HashMap =
client.get_all_rates.await?;
// Convert an amount
let result: f64 = client.convert.await?;
// Supported currency list
let codes: = client.get_supported_currencies.await?;
Historical data (Pro)
These endpoints return 403 on the free tier and surface as
UniRateError::Api { status: 403, .. }.
// Rate on a specific date
let rate = client.get_historical_rate.await?;
// All rates on a date
let rates = client.get_historical_rates.await?;
// Convert using historical rate
let amount = client
.convert_historical
.await?;
// Time series
let series = client
.get_time_series
.await?;
// Available historical coverage per currency
let limits = client.get_historical_limits.await?;
VAT rates
// All countries
let vat = client.get_vat_rates.await?;
// Single country (ISO-3166 alpha-2)
let germany = client.get_vat_rate.await?;
println!;
Error handling
All methods return Result<T, UniRateError>:
use UniRateError;
match client.get_rate.await
Advanced — custom reqwest::Client
Use Client::builder to swap in a pre-configured HTTP client — handy for
tests against a local wiremock::MockServer, or to share a connection pool
with the rest of your app:
use Duration;
use Client;
let http = builder
.timeout
.build?;
let client = builder
.http_client
.build?;
Rate limits
- Currency endpoints: standard rate limits apply
- Historical endpoints: 50 requests/hour on the free tier
- VAT endpoints: 1800 requests/hour on the free tier
Related clients
- unirate-api-python (PyPI:
unirate-api) - unirate-api-nodejs (npm:
unirate-api) - unirate-api-swift (Swift Package Manager)
Other UniRate clients
UniRate ships official client libraries and framework integrations across the ecosystem. The repos below are all maintained under the UniRate-API org.
- Languages: Python · Node.js / TypeScript · Go · Rust · Java · Ruby · PHP · .NET · Swift
- Web frameworks: NestJS · Django / Wagtail · FastAPI · Flask · React · tRPC
- Static-site generators: Astro · Eleventy · Hugo
- Data / orchestration: Airflow · dbt · LangChain
- Workflow / no-code: n8n · Google Sheets · MCP server
- Editors / tools: VS Code · Obsidian
- Specialty bridges: NodaMoney (.NET)
Get a free API key at unirateapi.com.
License
MIT — see LICENSE.