Welcome to the UniRate API C# / .NET documentation. Our free exchange rate API lets you add real-time and historical currency conversion to any .NET application — ASP.NET Core services, Blazor apps, MAUI, Xamarin, WPF, or background workers.
We ship an official .NET client library on NuGet. It uses async/await, supports CancellationToken on every method, parses responses with System.Text.Json, and has zero external dependencies — pure BCL.
async/await, CancellationToken, System.Text.Json
UniRateException
IHttpClientFactory
For full reference on endpoints, rate limits, and advanced options, see our main API documentation.
Below you'll find examples using the official UniRate .NET client.
Install the official NuGet package with dotnet add package UniRateApi. The library targets modern .NET and uses System.Text.Json under the hood.
// Install: dotnet add package UniRateApi
using UniRateApi;
using UniRateApi.Exceptions;
using var client = new UniRateClient("YOUR_API_KEY");
// Current rate
decimal rate = await client.GetRateAsync("USD", "EUR");
Console.WriteLine($"USD -> EUR: {rate}");
// Convert an amount
decimal euros = await client.ConvertAsync(100m, "USD", "EUR");
Console.WriteLine($"100 USD = {euros} EUR");
// All rates for a base currency
IReadOnlyDictionary rates = await client.GetAllRatesAsync("USD");
Console.WriteLine($"{rates.Count} rates for USD");
// Supported currencies
IReadOnlyList codes = await client.GetSupportedCurrenciesAsync();
Console.WriteLine($"{codes.Count} currencies supported");
// Historical rate on a specific date
var historical = await client.GetHistoricalRateAsync("2024-01-01", "USD", "EUR");
// Time series (up to 5 years)
var series = await client.GetTimeSeriesAsync(
startDate: "2024-01-01",
endDate: "2024-01-07",
@base: "USD",
currencies: new[] { "EUR", "GBP" });
// VAT rate for a country (ISO-3166 alpha-2)
var germany = await client.GetVatRateAsync("DE");
Console.WriteLine($"Germany VAT: {germany.VatData.VatRateValue}%");
// Error handling — typed exceptions
try
{
var bad = await client.GetRateAsync("USD", "ZZZ");
}
catch (AuthenticationException) { /* invalid API key */ }
catch (InvalidCurrencyException) { /* unknown currency code */ }
catch (RateLimitException) { /* back off and retry */ }
catch (ApiException ex) { Console.Error.WriteLine($"{ex.StatusCode}: {ex.Body}"); }
USD -> EUR: 0.9245
100 USD = 92.45 EUR
593 rates for USD
593 currencies supported
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 csharp applications.
Get Your API Key