Currency Exchange Rates API Documentation

This API is part of our FOREX REFERENCE SUITE service

1. What is the Currency Exchange Rates API?


This API provides an automation capability to our Forex Reference Suite service.
It provides an easy way to retrieve accurate and up to date currency exchange rates data.

This API is designed to be light, fast and easy to integrate.
With a single GET or POST request you may retrieve all 154 currency exchange rates for a given currency code.

2. Currency Exchange Rates API Requests



The accepted parameters by the API are listed in the table below:

Field Name Length Type Description
currency 3 String 3 letter ISO currency code for which to retrieve the exchange rates. For example ( usd,eur,gbp ... etc )
api_key 128 String Your personal API key.
format 5 String Format of the response XML and JSON supported.

*To obtain an API key, please contact us at contact@iban.com or purchase a subscription at our order page

EXAMPLE – Retrieve currency rates
Feel free to use the sample code below to test the API in the most common programming languages.

curl "https://api.iban.com/clients/api/currency/rates/" \
    -X POST \
    -d format=json \
	-d api_key=[YOUR_API_KEY] \
	-d currency=USD
<?php
$curl = curl_init();

$post = [
    'format' => 'json',
    'api_key' => '[YOUR_API_KEY]',
    'currency'   => 'USD',
];

curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://api.iban.com/clients/api/currency/rates/',
	CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POSTFIELDS => $post
));

$output = curl_exec($curl);
$result = json_decode($output);

print_r($result);

curl_close($curl);
?>
require 'net/http'

uri = URI('https://api.iban.com/clients/api/currency/rates/')

res = Net::HTTP.post_form(uri, "format" => "json", "api_key" => "[YOUR_API_KEY]","currency" => "USD")

puts res.body
import requests

post_data = {'format':'json', 'api_key':'[YOUR_API_KEY]','currency':'USD'}

response = requests.post('https://api.iban.com/clients/api/currency/rates/',post_data)
print(response.text)
use LWP::UserAgent;

my $ua = LWP::UserAgent->new;
my $server_endpoint = "https://api.iban.com/clients/api/currency/rates/";

my $format = 'json';
my $api_key = '[YOUR_API_KEY]';
my $currency = 'USD';


my $req = HTTP::Request->new( POST => $server_endpoint );
$req->content_type('application/x-www-form-urlencoded');

my $post_data = 'format=' . $format . '&api_key=' . $api_key . '¤cy=' . $currency;

$req->content($post_data);

my $resp = $ua->request($req);

if ( $resp->is_success ) {
    my $message = $resp->decoded_content;
	print $message;
}

JAVA

import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import javax.net.ssl.HttpsURLConnection;
import org.json.simple.JSONObject;
import org.json.simple.JSONArray;
import org.json.simple.parser.ParseException;
import org.json.simple.parser.JSONParser;


public class ibanapi {

	private final String USER_AGENT = "API Client/1.0";

	public static void main(String[] args) throws Exception {

		ibanapi http = new ibanapi();

		
		System.out.println("\nTesting API - Send API POST request");
		http.sendPost();

	}

	// HTTP POST request
	private void sendPost() throws Exception {

		String url = "https://api.iban.com/clients/api/currency/rates/";
		URL obj = new URL(url);
		HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();

		//add reuqest header
		con.setRequestMethod("POST");
		con.setRequestProperty("User-Agent", USER_AGENT);
		con.setRequestProperty("Accept-Language", "en-US,en;q=0.5");

		String urlParameters = "api_key=[YOUR_API_KEY]&format=json¤cy=USD";

		// Send post request
		con.setDoOutput(true);
		DataOutputStream wr = new DataOutputStream(con.getOutputStream());
		wr.writeBytes(urlParameters);
		wr.flush();
		wr.close();

		int responseCode = con.getResponseCode();
		System.out.println("\nSending 'POST' request to URL : " + url);
		System.out.println("Post parameters : " + urlParameters);
		System.out.println("Response Code : " + responseCode);

		BufferedReader in = new BufferedReader(
		new InputStreamReader(con.getInputStream()));
		String inputLine;
		StringBuffer response = new StringBuffer();

		while ((inputLine = in.readLine()) != null) {
			response.append(inputLine);
		}
		in.close();

		//print result
		System.out.println(response.toString());

	}

}

.NET

public static void Main(string[] args)
		{						
			var request = (HttpWebRequest)WebRequest.Create("https://api.iban.com/clients/api/currency/rates/");
 
			var postData = "api_key=[YOUR_API_KEY]";
			 postData += "&format=json";
			 postData += "¤cy=USD";
			 
			var data = Encoding.ASCII.GetBytes(postData);
			 
			request.Method = "POST";
			request.ContentType = "application/x-www-form-urlencoded";
			request.ContentLength = data.Length;
			 
			using (var stream = request.GetRequestStream())
			{
			 stream.Write(data, 0, data.Length);
			}
			 
			var response = (HttpWebResponse)request.GetResponse();
			 
			var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
			
			Console.WriteLine(responseString);
			
			Console.Write("Press any key to continue . . . ");
			Console.ReadKey(true);
		}

NODE

var request = require('request');

var headers = {
    'User-Agent':       'CURRENCY RATES API Client/0.0.1',
    'Content-Type':     'application/x-www-form-urlencoded'
}

var options = {
    url: 'https://api.iban.com/clients/api/currency/rates/',
    method: 'POST',
    headers: headers,
    form: {'api_key': '[YOUR_API_KEY]', 'format': 'json', 'currency': 'USD'}
}

request(options, function (error, response, body) {
    if (!error && response.statusCode == 200) {
     
		var data = JSON.parse(body);

		console.log(data.errors);
		
		console.log("Base Currency: " + data.base_currency);
		console.log("Rates Updated: " + data.time);
		console.log("USD to EUR rate " + data.rates.EUR);
		
    }
})


An example usage of the IBAN Validation API with a GET request can be found below:

https://api.iban.com/clients/api/currency/rates/?api_key=key&format=xml&currency=USD

Where:
  • key is your API key
  • IBAN sent for validation by the API module.
  • xml is the response format. Also a json keyword can be specified for json formatted response.

Once an HTTP GET or POST request is made with the correct API key, the system will return the results in the specified format. You can find an sample response in the next section “API Response Structure”

3. Currency Rates API Response

The API response default format is in JSON format ( XML format is also supported ). It is simplified and structured for easy access to all elements:

{  
   "base_currency":"USD",
   "time":"03-22-2019 10:00:02",
   "timestamp":1553248802,
   "rates":{  
      "AED":3.6733,
      "AFN":76.05,
      "ALL":110.1196,
      "AMD":486.9206,
      "ANG":1.8392,
      "AOA":316.854,
      "ARS":41.025,
      "AUD":1.4099,
      "AWG":1.801,
      "AZN":1.705,
      "BAM":1.7205,
      "BBD":1.9953,
      "BDT":84.232,
      "BGN":1.73,
      "BHD":0.3771,
      "BIF":1809.95,
      "BMD":1,
      "BND":1.3506,
      "BOB":6.9041,
      "BRL":3.7927,
      "BSD":1.0005,
      "BTN":69.0055,
      "BWP":10.656,
      "BYR":19600,
      "BZD":2.0197,
      "CAD":1.3375,
      "CDF":1630,
      "CHF":0.9964,
      "CLP":667.4036,
      "CNY":6.7131,
      "COP":3089,
      "CRC":598.295,
      "CUP":26.5,
      "CVE":97.1965,
      "CZK":22.7319,
      "DJF":177.72,
      "DKK":6.6003,
      "DOP":50.715,
      "DZD":118.825,
      "EGP":17.252,
      "ERN":14.9997,
      "ETB":28.523,
      "EUR":0.8845,
      "FJD":2.1228,
      "FKP":0.76,
      "GBP":0.763,
      "GEL":2.685,
      "GHS":5.232,
      "GIP":0.76,
      "GMD":49.665,
      "GNF":9142.9029,
      "GTQ":7.7052,
      "GYD":208.455,
      "HKD":7.8471,
      "HNL":24.496,
      "HRK":6.5618,
      "HTG":82.8325,
      "HUF":279.337,
      "IDR":14187.55,
      "ILS":3.6125,
      "INR":68.98,
      "IQD":1196,
      "IRR":42105.0001,
      "ISK":118.77,
      "JMD":125.0002,
      "JOD":0.709,
      "JPY":110.5194,
      "KES":100.6989,
      "KGS":69.7563,
      "KHR":4003.9502,
      "KMF":432.7006,
      "KPW":900.0853,
      "KRW":1133.5973,
      "KWD":0.3035,
      "KYD":0.8353,
      "KZT":378.4803,
      "LAK":8605.297,
      "LBP":1513.8497,
      "LKR":178.1502,
      "LRD":162.125,
      "LSL":14.3802,
      "LYD":1.388,
      "MAD":9.6189,
      "MDL":17.307,
      "MGA":3563.2112,
      "MKD":54.1195,
      "MMK":1533.5499,
      "MNT":2630.9246,
      "MOP":8.1017,
      "MUR":34.5265,
      "MVR":15.492,
      "MWK":723.985,
      "MXN":18.9725,
      "MYR":4.0606,
      "MZN":63.2301,
      "NAD":14.3801,
      "NGN":361.84,
      "NIO":32.9555,
      "NOK":8.5262,
      "NPR":109.955,
      "NZD":1.4558,
      "OMR":0.385,
      "PAB":1.0005,
      "PEN":3.2879,
      "PGK":3.3755,
      "PHP":52.5155,
      "PKR":140.1702,
      "PLN":3.7946,
      "PYG":6162.7502,
      "QAR":3.641,
      "RON":4.206,
      "RSD":104.3399,
      "RUB":64.0834,
      "RWF":903.735,
      "SAR":3.75,
      "SBD":8.0557,
      "SCR":13.6745,
      "SDG":47.7279,
      "SEK":9.2607,
      "SGD":1.351,
      "SHP":1.3209,
      "SLL":8875.0003,
      "SOS":581.9998,
      "SRD":7.458,
      "SVC":8.7708,
      "SYP":515.0002,
      "SZL":14.269,
      "THB":31.69,
      "TJS":9.4613,
      "TMT":3.5,
      "TND":3.0197,
      "TOP":2.2572,
      "TRY":5.5488,
      "TTD":6.7911,
      "TWD":30.827,
      "TZS":2344.103,
      "UAH":27.1951,
      "UGX":3708.5025,
      "USD":1,
      "UYU":33.24,
      "UZS":8396.1022,
      "VEF":9.9875,
      "VND":23201.5,
      "VUV":113.8588,
      "WST":2.5987,
      "XAF":577.0605,
      "XCD":2.7033,
      "XDR":0.7187,
      "XOF":577.0602,
      "XPF":104.9098,
      "YER":250.3504,
      "ZAR":14.3397,
      "ZMW":12.029,
      "ZWL":322.355
   }
}


A detailed description of the response object fields returned can be seen in the table below:

Field Name Length Type Description
base_currency 3 String The currency ISO code of the base currency you submitted to the API.
time 19 String This is the time of the latest update of the rates data from our data sources. This field is in human readable format.
timestamp 10 Integer The same time of the latest update of the rates data as 'time'. This field is in Unix Time format
rates 154 Array This element contains an array of the exchange rates for the requested base currency.
Each element of the array has the currency ISO code as a key and the exchange rate as a value.

4. Supported Currencies

This is a list of the supported base currencies which can be submitted to the Exchange Rates API.

Currency CodeNumberCurrency NameRegion
AED784United Arab Emirates DirhamUNITED ARAB EMIRATES
AFN971AfghaniAFGHANISTAN
ALL008Albanian LekALBANIA
AMD051Armenian DramARMENIA
ANG532Netherlands Antillean GuilderCURACAO
AOA973Angolan KwanzaANGOLA
ARS032Argentine PesoARGENTINA
AUD036Australian DollarAUSTRALIA
AWG533Aruban FlorinARUBA
AZN944Azerbaijanian ManatAZERBAIJAN
BAM977Convertible MarkBOSNIA AND HERZEGOVINA
BBD052Barbados DollarBARBADOS
BDT050Bangladeshi TakaBANGLADESH
BGN975Bulgarian LevBULGARIA
BHD048Bahraini DinarBAHRAIN
BIF108Burundi FrancBURUNDI
BMD060Bermudian DollarBERMUDA
BND096Brunei DollarBRUNEI DARUSSALAM
BOB068BolivianoBOLIVIA
BRL986Brazilian RealBRAZIL
BSD044Bahamian DollarBAHAMAS (THE)
BTN064Bhutanese NgultrumBHUTAN
BWP072Botswanan PulaBOTSWANA
BYR974Belarussian RubleBELARUS
BZD084Belize DollarBELIZE
CAD124Canadian DollarCANADA
CDF976Congolese FrancCONGO
CHF756Swiss FrancSWITZERLAND
CLP152Chilean PesoCHILE
CNY156Yuan RenminbiCHINA
COP170Colombian PesoCOLOMBIA
CRC188Costa Rican ColonCOSTA RICA
CUP192Cuban PesoCUBA
CVE132Cabo Verde EscudoCABO VERDE
CZK203Czech KorunaCZECH REPUBLIC (THE)
DJF262Djibouti FrancDJIBOUTI
DKK208Danish KroneDENMARK
DOP214Dominican PesoDOMINICAN REPUBLIC (THE)
DZD012Algerian DinarALGERIA
EGP818Egyptian PoundEGYPT
ERN232Eritrean NakfaERITREA
ETB230Ethiopian BirrETHIOPIA
EUR978EuroEUROPEAN UNION
FJD242Fiji DollarFIJI
FKP238Falkland Islands PoundFALKLAND ISLANDS
GBP826Pound SterlingGUERNSEY
GEL981Georgian LariGEORGIA
GHS936Ghana CediGHANA
GIP292Gibraltar PoundGIBRALTAR
GMD270Gambian DalasiGAMBIA (THE)
GNF324Guinea FrancGUINEA
GTQ320Guatemalan QuetzalGUATEMALA
GYD328Guyana DollarGUYANA
HKD344Hong Kong DollarHONG KONG
HNL340Honduran LempiraHONDURAS
HRK191Croatian KunaCROATIA
HTG332Haitian GourdeHAITI
HUF348Hungarian ForintHUNGARY
IDR360Indonesian RupiahINDONESIA
ILS376New Israeli SheqelISRAEL
INR356Indian RupeeINDIA
IQD368Iraqi DinarIRAQ
IRR364Iranian RialIRAN (ISLAMIC REPUBLIC OF)
ISK352Iceland KronaICELAND
JMD388Jamaican DollarJAMAICA
JOD400Jordanian DinarJORDAN
JPY392Japanese YenJAPAN
KES404Kenyan ShillingKENYA
KGS417Kyrgystani SomKYRGYZSTAN
KHR116Cambodian RielCAMBODIA
KMF174Comoro FrancCOMOROS (THE)
KPW408North Korean WonKOREA (THE DEMOCRATIC PEOPLE'S REPUBLIC OF)
KRW410South Korean WonKOREA (THE REPUBLIC OF)
KWD414Kuwaiti DinarKUWAIT
KYD136Cayman Islands DollarCAYMAN ISLANDS (THE)
KZT398Kazakhstani TengeKAZAKHSTAN
LAK418Laotian KipLAO PEOPLE'S DEMOCRATIC REPUBLIC (THE)
LBP422Lebanese PoundLEBANON
LKR144Sri Lanka RupeeSRI LANKA
LRD430Liberian DollarLIBERIA
LSL426Lesotho LotiLESOTHO
LYD434Libyan DinarLIBYA
MAD504Moroccan DirhamMOROCCO
MDL498Moldovan LeuMOLDOVA (THE REPUBLIC OF)
MGA969Malagasy AriaryMADAGASCAR
MKD807Macedonian DenarMACEDONIA
MMK104Myanma KyatMYANMAR
MNT496Mongolian TugrikMONGOLIA
MOP446Macanese PatacaMACAO
MUR480Mauritius RupeeMAURITIUS
MVR462Maldivian RufiyaaMALDIVES
MWK454Malawian KwachaMALAWI
MXN484Mexican PesoMEXICO
MYR458Malaysian RinggitMALAYSIA
MZN943Mozambique MeticalMOZAMBIQUE
NAD516Namibia DollarNAMIBIA
NGN566Nigerian NairaNIGERIA
NIO558Cordoba OroNICARAGUA
NOK578Norwegian KroneNORWAY
NPR524Nepalese RupeeNEPAL
NZD554New Zealand DollarNEW ZEALAND
OMR512Rial OmaniOMAN
PAB590Panamanian BalboaPANAMA
PEN604Peruvian Nuevo SolPERU
PGK598Papua KinaPAPUA NEW GUINEA
PHP608Philippine PesoPHILIPPINES (THE)
PKR586Pakistan RupeePAKISTAN
PLN985Polish ZlotyPOLAND
PYG600Paraguayan GuaraniPARAGUAY
QAR634Qatari RialQATAR
RON946Romanian LeuROMANIA
RSD941Serbian DinarSERBIA
RUB643Russian RubleRUSSIAN FEDERATION (THE)
RWF646Rwanda FrancRWANDA
SAR682Saudi RiyalSAUDI ARABIA
SBD090Solomon Islands DollarSOLOMON ISLANDS
SCR690Seychelles RupeeSEYCHELLES
SDG938Sudanese PoundSUDAN (THE)
SEK752Swedish KronaSWEDEN
SGD702Singapore DollarSINGAPORE
SHP654Saint Helena PoundSAINT HELENA, ASCENSION AND TRISTAN DA CUNHA
SLL694LeoneSIERRA LEONE
SOS706Somali ShillingSOMALIA
SRD968Surinam DollarSURINAME
SVC222El Salvador ColonEL SALVADOR
SYP760Syrian PoundSYRIAN ARAB REPUBLIC
SZL748Swazi LilangeniSWAZILAND
THB764Thai BahtTHAILAND
TJS972Tajikistani SomoniTAJIKISTAN
TMT934Turkmenistan New ManatTURKMENISTAN
TND788Tunisian DinarTUNISIA
TOP776Tongan PaʻangaTONGA
TRY949Turkish LiraTURKEY
TTD780Trinidad and Tobago DollarTRINIDAD AND TOBAGO
TWD901New Taiwan DollarTAIWAN (PROVINCE OF CHINA)
TZS834Tanzanian ShillingTANZANIA, UNITED REPUBLIC OF
UAH980Ukrainian HryvniaUKRAINE
UGX800Uganda ShillingUGANDA
USD840US DollarUNITED STATES OF AMERICA
UYU858Peso UruguayoURUGUAY
UZS860Uzbekistan SumUZBEKISTAN
VEF937Venezuelan BolivarVENEZUELA (BOLIVARIAN REPUBLIC OF)
VND704Vietnamese DongVIET NAM
VUV548Vanuatu VatuVANUATU
WST882Samoan TalaSAMOA
XAF950CFA Franc BEACCENTRAL AFRICAN
XCD951East Caribbean DollarEASTERN CARIBBEAN STATES
XDR960SDR (Special Drawing Right)INTERNATIONAL MONETARY FUND (IMF)
XOF952CFA Franc BCEAOWEST AFRICAN
XPF953CFP FrancFRENCH COLONIES OF THE PACIFIC
YER886Yemeni RialYEMEN
ZAR710South African RandSOUTH AFRICA
ZMW967Zambian KwachaZAMBIA
ZWL932Zimbabwe DollarZIMBABWE

5. Currency Rates API errors

Upon an error, the API will return one of the following 'error' responses.

Status Code Type Description Solution
401 Account Error API Key is invalid You need to supply a valid API key. Your API key can be found in your Client Area -> API Access section.
402 Account Error Subscription expired You need to renew your membership. This can be done from your Client Area -> My Services section.
406 Account Error No queries available Your account ran out of available credits. You need to refill your account by purchasing a new package.
403 Account Error You have no access to this API Your account has no access to this service, you need to purchase a plan for this service from your Client Area -> Purchase Plans section.
405 Account Error IP Address not allowed You had enabled the IP restriction in your Client Area -> Account -> Security Section. You need to allow the IP address of the computer/server making the request in your access list.
410 Input Validation Failed Invalid currency code You have submitted an invalid currency code as an input parameter. The supported currencies are available above in Section 4: Supported Currencies
400 Input Validation Failed Bad Request ( Missing required parameters: api_key, currency ) You have not submitted all parameters required for retrieving currency exchange rate data.
500 Server Error Internal Server Error. Contact Support. An unexpected error occurred in our system. This error is caused by a problem on our end. Please contact our support if you encounter this error.