Documentation
    Amazon Web Services
    Microsoft Azure
    RapidAPI
    APILayer
Last Update: 2024-03-01

Currency Exchange API


Table of Content


Subscribe on AWS Marketplace
Code samples
API endpoint: rates
API endpoint: convert
API endpoint: historical-rates
Troubleshooting
List of all available currencies

Subscribe on AWS Marketplace


Navigate to our product listing on the AWS Marketplace. Select the "View purchase options" button to proceed.

On the following page, click the "Subscribe" button to initiate the subscription process.

After subscribing, you will need to set up your account on our platform. Do this by clicking the "Set up your account" link provided.

You will be directed to the registration page. Here, fill in your account details in the provided fields. Once you have entered all necessary information, click the 'Subscribe' button to proceed.

Upon successful registration, your unique API key will be displayed. It is crucial to store this key in a secure location for future use.

Code samples


Call the /rates endpoint with US dollars as the base currency ("USD"). Replace <YourApiKey> with the actual API Key you received during the sign-up process:

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://forex-aws.silverlining.cloud/rates");
request.Headers.Add("x-api-key", "<YourApiKey>");
var content = new StringContent("{\n    \"base\": \"USD\"\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());

Call the /historical-rates endpoint to get the USD to EUR exchange rate for October 1, 2020. Replace <YourApiKey> with the actual API Key you received during the sign-up process:

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://forex-aws.silverlining.cloud/historical-rates");
request.Headers.Add("x-api-key", "<YourApiKey>");
var content = new StringContent("{\n    \"base\": \"USD\",\n    \"target\": \"EUR\",\n    \"date\": \"2020-10-01\"\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
API endpoint: rates


URL endpoint: https://forex-aws.silverlining.cloud/rates


Method: POST


"header": {
  "x-api-key": STRING,
  "Content-Type": "application/json"
}


"body": {
  "base": STRING,
}



Required

"base": The base currency for calculating exchange rates. Must be the currency code. See the list of available currencies below.


Response:

"body": {
  "base_code": STRING,
  "base_name": STRING,
  "base_amount": NUMBER,
  "last_updated": DATETIME,
  "rates": [
    {
      "code": STRING,
      "name": STRING,
      "rate": NUMBER
    },
    ...
  ]
}   


"base_code": The provided currency code.
"base_name": The English name of the provided currency.
"base_amount": Always returns 1.
"last_updated": The date and time when the currency rates were last updated.
"rates": Returns a list of arrays containing all available currencies with their currency code, English name, and the exchange rate relative to the provided base currency.

API endpoint: convert

URL endpoint: https://forex-aws.silverlining.cloud/convert


Method: POST


"header": {
  "x-api-key": STRING,
  "Content-Type": "application/json"
}


"body": {
  "base": STRING,
  "target": STRING,
  "base_amount": NUMBER
}


Required

"base": The base currency for conversion. Must be the currency code. See the list of available currencies below.
"target": The target currency for conversion. Must be the currency code. See the list of available currencies below.
"base_amount": The amount to be converted from the base to target currency.

Response:

"body": {
  "base_code": STRING,
  "base_name": STRING,
  "target_code": STRING,
  "target_name": STRING,
  "converted_rate": NUMBER,
  "converted_amount": NUMBER,
  "last_updated": DATETIME
}   


"base_code": The provided base currency code.
"base_name": The English name of the provided base currency.
"target_code": The provided target currency code.
"target_name": The English name of the provided target currency.
"converted_rate": The rate used for the conversion.
"converted_amount": The converted amount (base_amount * converted_rate).
"last_updated": The date and time when the currency rates were last updated.

API endpoint: historical-rates


URL endpoint: https://forex-aws.silverlining.cloud/historical-rates

Method: POST

"header": {
  "x-api-key": STRING,
  "Content-Type": "application/json"
}

"body": {
  "base": STRING,
  "target": STRING,
  "date": DATE
}


Required

"base": This parameter refers to the base currency for which the rate is sought. It must be specified using the currency code. Please see the list of available currencies below for reference.

"target": This parameter represents the target currency for which the rate is to be fetched. It should be inputted as the currency code. Refer to the list of the available currencies below.

"date": This parameter indicates the date of the historical exchange rate you wish to retrieve, providing the end of day rate. The date must be in the "YYYY-MM-DD" format, such as "2023-01-31".


Response:

"body": {
  "base_code": STRING,
  "base_name": STRING,
  "target_code": STRING,
  "target_name": STRING,
  "rate": NUMBER,
  "date": DATE
}   


"base_code"
: The provided base currency code.

"base_name": The English name of the provided base currency.

"target_code": The provided target currency code.

"target_name": The English name of the provided target currency.

"rate": This represents the end-of-day exchange rate for the provided date and specified currency pair.

"date": This parameter refers to the supplied date for which the exchange rate was required.


If you are interested in accessing our complete forex dataset, please review our offering on the AWS Data Exchange.

Troubleshooting

"message": "Invalid Input: The request contains incorrectly formatted parameters"

This error message means that the body parameters you have passed are malformed. Please follow the instructions given in the endpoint descriptions. Common issues include forgetting to add a comma (',') after every parameter line or missing a parenthesis somewhere.

"message": "Invalid Input: The request contains incorrectly formatted parameters"

You receive this error message when the code execution exceeds the maximum timeout (usually 29 seconds).

Supported currencies


Below is a full list of all available currencies and their corresponding currency codes supported by our API:


AED, United Arab Emirates dirham
AFN, Afghan afghani
ALL, Albanian lek
AMD, Armenian dram
ANG, Netherlands Antillean guilder
AOA, Angolan kwanza
ARS, Argentine peso
AUD, Australian dollar
AWG, Aruban florin
AZN, Azerbaijani manat
BAM, Bosnia and Herzegovina convertible mark
BBD, Barbadian dollar
BDT, Bangladeshi taka
BGN, Bulgarian lev
BHD, Bahraini dinar
BIF, Burundian franc
BMD, Bermudian dollar
BND, Brunei dollar
BOB, Bolivian boliviano
BRL, Brazilian real
BSD, Bahamian dollar
BTN, Bhutanese ngultrum
BWP, Botswana pula
BYN, Belarusian ruble
BZD, Belize dollar
CAD, Canadian dollar
CDF, Congolese franc
CHF, Swiss franc
CLP, Chilean peso
CNY, Chinese yuan
COP, Colombian peso
CRC, Costa Rican colón
CUP, Cuban peso
CVE, Cape Verdean escudo
CZK, Czech koruna
DJF, Djiboutian franc
DKK, Danish krone
DOP, Dominican peso
DZD, Algerian dinar
EGP, Egyptian pound
ETB, Ethiopian birr
EUR, Euro
FJD, Fijian dollar
GBP, British pound
GEL, Georgian lari
GHS, Ghanaian cedi
GMD, Gambian dalasi
GNF, Guinean franc
GTQ, Guatemalan quetzal
GYD, Guyanese dollar
HKD, Hong Kong dollar
HNL, Honduran lempira
HTG, Haitian gourde
HUF, Hungarian forint
IDR, Indonesian rupiah
ILS, Israeli new shekel
INR, Indian rupee
IQD, Iraqi dinar
IRR, Iranian rial
ISK, Icelandic króna
JMD, Jamaican dollar
JOD, Jordanian dinar
JPY, Japanese yen
KES, Kenyan shilling
KGS, Kyrgyzstani som
KHR, Cambodian riel
KMF, Comorian franc
KRW, South Korean won
KWD, Kuwaiti dinar
KYD, Cayman Islands dollar
KZT, Kazakhstani tenge
LAK, Lao kip
LBP, Lebanese pound
LKR, Sri Lankan rupee
LRD, Liberian dollar
LSL, Lesotho loti
LYD, Libyan dinar
MAD, Moroccan dirham
MDL, Moldovan leu
MGA, Malagasy ariary
MKD, Macedonian denar
MMK, Burmese kyat
MOP, Macanese pataca
MRU, Mauritanian ouguiya
MUR, Mauritian rupee
MVR, Maldivian rufiyaa
MWK, Malawian kwacha
MXN, Mexican peso
MYR, Malaysian ringgit
MZN, Mozambican metical
NAD, Namibian dollar
NGN, Nigerian naira
NIO, Nicaraguan córdoba
NOK, Norwegian krone
NPR, Nepalese rupee
NZD, New Zealand dollar
OMR, Omani rial
PAB, Panamanian balboa
PEN, Peruvian sol
PGK, Papua New Guinean kina
PHP, Philippine peso
PKR, Pakistani rupee
PLN, Polish złoty
PYG, Paraguayan guaraní
QAR, Qatari riyal
RON, Romanian leu
RSD, Serbian dinar
RUB, Russian ruble
RWF, Rwandan franc
SAR, Saudi riyal
SBD, Solomon Islands dollar
SCR, Seychellois rupee
SDG, Sudanese pound
SEK, Swedish krona
SGD, Singapore dollar
SLL, Sierra Leonean leone
SOS, Somali shilling
SRD, Surinamese dollar
SZL, Swazi lilangeni
THB, Thai baht
TJS, Tajikistani somoni
TMT, Turkmenistan manat
TND, Tunisian dinar
TOP, Tongan paʻanga
TRY, Turkish lira
TTD, Trinidad and Tobago dollar
TWD, New Taiwan dollar
TZS, Tanzanian shilling
UAH, Ukrainian hryvnia
UGX, Ugandan shilling
USD, United States dollar
UYU, Uruguayan peso
UZS, Uzbekistani soʻm
VES, Venezuelan bolívar soberano
VND, Vietnamese đồng
XAF, Central African CFA franc
XCD, Eastern Caribbean dollar
XOF, West African CFA franc
XPF, CFP franc
YER, Yemeni rial
ZAR, South African rand
ZMW, Zambian kwacha