Client library

C# Client Library for Global Exchange Rates API

Published Updated 2 min read

Integrating with our GlobalExchange Rates API is already straightforward thanks to our clean and consistent JSON\XML endpoints.

Now, to make working with our service even easier for .NET developers, we’ve published an official C# client library on NuGet.

This library targets standard .NET, meaning it works with both .NET Framework and .NET Core, making it useful for modern applications as well as older systems.

This new NuGet package is part of our effort to support the developer ecosystem around our API. If you’re working on a .NET based accounting system, ERP integration, or just need reliable exchange rate data in your app, this library should help you get up and running faster.

You can find the package here: GlobalExchangeRates.Client on NuGet

Quick Start

To get started, just install the package via the .NET CLI:

Code
dotnet add package GlobalExchangeRates.Client

Then, create an instance of the client in your code using your API key:

Code
var client = new GlobalExchangeRatesClient("YOUR_API_KEY");

You can now call methods to interact with the API. For example, to retrieve the latest exchange rates:

Code
var rates = await client.GetLatestAsync();

This library includes helper methods for all the available endpoints.

Converting Amounts and Historical Rates

Convert an amount directly using the official rates:

Code
var conversion = await client.ConvertAsync(100, "EUR", new[] { "USD", "GBP" });

Retrieve the official rates for a specific date, and optionally from a specific provider such as the ECB:

Code
var historical = await client.GetHistoricalAsync(
    new DateTime(2025, 1, 1),
    currencies: new[] { "USD" },
    baseCurrency: "EUR");

Providers, Currencies, and Error Handling

List the available institutions and currency codes, or request rates from a single provider:

Code
var providers  = await client.GetProvidersAsync();
var currencies = await client.GetCurrenciesAsync(new[] { "EUR", "USD" });
var ecb        = await client.GetLatestAsync(provider: "ECB", currencies: new[] { "USD", "GBP" });

API errors are raised as ApiException, which carries the HTTP status and message:

Code
try
{
    var rates = await client.GetLatestAsync(baseCurrency: "EUR");
}
catch (ApiException ex)
{
    Console.WriteLine($"API error {ex.StatusCode}: {ex.Message}");
}

Keeping the Rates Up to Date

Official rates are published once per business day, so refreshing on a schedule (for example a daily background job or scheduled task) is usually enough to keep your data current.

The same official rates are available in other languages and tools — see our Python and JavaScript client libraries, or the guides for Power BI and Google Sheets. The full method reference is in the API documentation. If you don’t have an API key yet, you can get one on the get-started page, with official rates from central banks and tax authorities worldwide.

Let us know if you build something with it—or if there are features you’d like to see added.