Exchange Rate API C# Documentation

How To Use Our C# Exchange Rates API

We offer an easy to use, accurate and reliable currency conversion API for C# that's perfect for both personal and professional use. It's available for free or as a paid service.

Fetching exchange rates using our C# exchange rates API is as easy as making GET requests. This means you can easily integrate our API into your C# project however you'd prefer.

For more details on the different types of request we support please see our Main Documentation.

Alternatively simply use the C# example code below to get started with our exchange rate data as fast as you can copy & paste!

You'll need to sign up for a free account to get your API key. Use the form below or visit this link to get started.

Simple C# Currency Conversion Example


using System;
using Newtonsoft.Json;

namespace ExchangeRate_API
    {

    class Rates
        {
        public static bool Import()
            {
            try
                {
                String URLString = "https://prime.exchangerate-api.com/v5/Your-API-Key/latest/USD";
                using (var webClient = new System.Net.WebClient())
                    {
                    var json = webClient.DownloadString(URLString);
                    API_Obj Test = JsonConvert.DeserializeObject(json);
                    return true;
                    }
                }
            catch (Exception)
                {
                return false;
                }
            }
        }

    public class API_Obj
        {
        public string result { get; set; }
        public string documentation { get; set; }
        public string terms_of_use { get; set; }
        public string time_zone { get; set; }
        public string time_last_update { get; set; }
        public string time_next_update { 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; }
        }

    }
							

This will return the exchange rates from USD to all the other currencies we support.

Here is an example of the JSON response that the above code is using,

{
"result":"success",
"documentation":"https://www.exchangerate-api.com/docs",
"terms_of_use":"https://www.exchangerate-api.com/terms",
"time_zone":"UTC",
"time_last_update":1581379262,
"time_next_update":1581382982,
"base":"USD",
"conversion_rates":{
	"USD":1,
	"AED":3.6721,
	"ARS":60.7704,
	"AUD":1.4955,
	"BGN":1.7861,
	"BRL":4.3155,
	"BSD":1.0000,
	"CAD":1.3310,
	etc. etc. etc.
	}
}

Please see our main documentation for more info on this and other available request types & error response details.

Additionally, please email us if you'd like to submit a code example, we'll credit you!

Thanks to Patrick for help with this example code.