Docs
Comprehensive C# Guide to Using the Currency Exchange Rate API

Comprehensive C# Guide to Using the Currency Exchange Rate API

Learn how to efficiently integrate our Currency Exchange Rate API into your C# projects with this detailed guide.

Currency Exchange Rate API for C#: Easy Integration & High Accuracy

Our Currency Exchange Rate API offers a seamless experience for C# developers, delivering accurate and reliable data that’s perfect for both personal and professional use. Whether you're building a financial application or simply need real-time currency conversion, our API provides the data you need with minimal hassle.

Quick and Simple C# Integration

Integrating our C# Currency Exchange Rate API is straightforward—just make a GET request, and you're good to go. Our API’s JSON responses are not only fast to parse but also easily readable, making data handling a breeze. C# offers high-performance native libraries for processing JSON, so you can start using our API with minimal effort.

For detailed information on the various request types we support, please refer to our Main Documentation.

Step-by-Step Guide: C# Currency Conversion Example

To get you started quickly, here’s a simple C# code example. This code fetches the latest exchange rates with USD as the base currency:

You'll need to sign up for a free account to receive your API key. Visit this link to get started.

using System;
using Newtonsoft.Json;
 
namespace ExchangeRate_API
    {
 
    class Rates
        {
        public static bool Import()
            {
            try
                {
                String URLString = "https://api.currencyexchangerate-api.com/v1/YOUR-API-KEY/latest/USD";
                using (var webClient = new System.Net.WebClient())
                    {
                    var json = webClient.DownloadString(URLString);
                    API_Obj Test = JsonConvert.DeserializeObject<API_Obj>(json);
                    return true;
                    }
                }
            catch (Exception)
                {
                return false;
                }
            }
        }
 
    public class API_Obj
        {
        public string result { get; set; }
        public int qouta { get; set; }
        public int remining { get; set; }
        public string base_code { get; set; }
        public ConversionRate conversion_rates { get; set; }
        }
 
    public class ConversionRate
        {
        public double AED { get; set; }
        public double ARS { get; set; }
        public double AUD { get; set; }
        public double BGN { get; set; }
        public double BRL { get; set; }
        public double BSD { get; set; }
        public double CAD { get; set; }
        public double CHF { get; set; }
        public double CLP { get; set; }
        public double CNY { get; set; }
        public double COP { get; set; }
        public double CZK { get; set; }
        public double DKK { get; set; }
        public double DOP { get; set; }
        public double EGP { get; set; }
        public double EUR { get; set; }
        public double FJD { get; set; }
        public double GBP { get; set; }
        public double GTQ { get; set; }
        public double HKD { get; set; }
        public double HRK { get; set; }
        public double HUF { get; set; }
        public double IDR { get; set; }
        public double ILS { get; set; }
        public double INR { get; set; }
        public double ISK { get; set; }
        public double JPY { get; set; }
        public double KRW { get; set; }
        public double KZT { get; set; }
        public double MXN { get; set; }
        public double MYR { get; set; }
        public double NOK { get; set; }
        public double NZD { get; set; }
        public double PAB { get; set; }
        public double PEN { get; set; }
        public double PHP { get; set; }
        public double PKR { get; set; }
        public double PLN { get; set; }
        public double PYG { get; set; }
        public double RON { get; set; }
        public double RUB { get; set; }
        public double SAR { get; set; }
        public double SEK { get; set; }
        public double SGD { get; set; }
        public double THB { get; set; }
        public double TRY { get; set; }
        public double TWD { get; set; }
        public double UAH { get; set; }
        public double USD { get; set; }
        public double UYU { get; set; }
        public double ZAR { get; set; }
        }
 
    }
 

Sample JSON Response

Here’s a sample JSON response from the API with USD as the base currency code:

{
  "result": "success",
  "base_code": "USD",
  "qouta": 100,
  "remining": 78,
  "conversion_rates": {
    "USD": 1,
    "AED": 3.6725,
    "AFN": 71.3023,
    ...
  }
}

For additional details on request types, error handling, and more, please visit our Main Documentation.

Need Help?

If you have any questions or need further assistance, don’t hesitate to contact us. We’re here to assist you!