Documentation

    Amazon Web Services

    Microsoft Azure

    RapidAPI

    APILayer

Last Update: 2024-09-11

Currency Exchange API


Table of Content


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

Subscribe on Azure Marketplace


Visit our listings page on the Azure Marketplace and click on 'Get It Now'.

In the Azure portal click on 'Subscribe'.

Select a resource group, give the subscription an internal name, and click on 'Review + subscribe'.

Click on 'Subscribe' to finalize your subscription.

Begin creating your account on our platform by clicking on 'Configure account now'.

You will be directed to the registration page. Here, fill in your account details in the provided fields. After entering all necessary information, click on 'Subscribe' 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


The following code sample demonstrates calling the /rates endpoint with the US dollar as the base currency ("USD"). Replace <YourApiKey> with the actual API Key you received during the sign-up process:

var client = new RestClient("https://api-azr.silverlining.cloud/forex/rates");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Ocp-Apim-Subscription-Key", "<YourApiKey>");
request.AddHeader("Content-Type", "application/json");
var body = @"{" + "\n" +
@"    ""base"": ""USD""" + "\n" +
@"}";
request.AddParameter("application/json", body,  ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);

Call the /historical-rates endpoint to get the USD to GBP exchange rate for September 27, 2022. 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://api-azr.silverlining.cloud/forex/historical-rates");
request.Headers.Add("Ocp-Apim-Subscription-Key", "<YourApiKey>");
var content = new StringContent("{\n    \"base\": \"USD\",\n    \"target\": \"GBP\",\n    \"date\": \"2022-09-27\"\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());

Current Rates Playground

This API Playground for our Currency Exchange API allows you to explore how the service works in real-time. Simply pass a base currency in the standard 3-letter format, and you’ll receive live exchange rate data directly from the API. Whether you’re integrating exchange rates into your application or just experimenting, the playground provides an intuitive interface to see real-time responses instantly.

    "To see the result, please send a request to the API."
    API endpoint: rates


    URL endpoint: https://api-azr.silverlining.cloud/forex/rates
    
    
    Method: POST
    
    
    "header": {
      "Ocp-Apim-Subscription-Key": STRING,
      "Content-Type": "application/json"
    }
    
    
    "body": {
      "base": STRING,
    }



    Required

    "base": The base currency for which exchange rates need to be calculated - must be the currency code. See the list of all 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 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 given base currency

    API endpoint: convert

    URL endpoint: https://api-azr.silverlining.cloud/forex/convert
    
    
    Method: POST
    
    
    "header": {
      "Ocp-Apim-Subscription-Key": STRING,
      "Content-Type": "application/json"
    }
    
    
    "body": {
      "base": STRING,
      "target": STRING,
      "base_amount": NUMBER
    }


    Required

    "base": The base currency for the conversion - must be the currency code. See the list of all available currencies below.
    "target": The target currency for the conversion - must be the currency code. See the list of all available currencies below.
    "base_amount": The amount to be converted from the base to the 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 the currency rates were last updated

    API endpoint: historical-rates


    URL endpoint: https://api-azr.silverlining.cloud/forex/historical-rates
    
    Method: POST
    
    "header": {
      "Ocp-Apim-Subscription-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 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.

    API endpoint: usage


    URL endpoint: https://api-azr.silverlining.cloud/forex/usage
    
    Method: POST
    
    "header": {
      "Ocp-Apim-Subscription-Key": STRING,
      "Content-Type": "application/json"
    }


    Required

    You must include the API key in the Ocp-Apim-Subscription-Key header. The body parameters can be left empty.


    Response:
    
    
    "body": {
      "reportUrl": STRING,
      "downloadLink": STRING,
      "description": STRING
    }  


    "reportUrl"
    : A URL linking to a web-based report that displays all requests made to the API. Note that this report is only accessible if the total number of requests is below 100,000.

    "downloadLink": A URL to download a .CSV file containing all requests made to our API using the specified API key.

    "description": You can access usage statistics either by visiting the website using the 'reportUrl' or by downloading the usage data as a .csv file using the 'downloadLink'. Please note that, depending on the number of requests you have previously sent to our API, these links may become available up to 10 minutes after the request is made.

    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.

    Receiving 503 "The service is unavailable."

    You may occasionally encounter the error message: "503 - The service is unavailable." This issue is temporary and typically resolves on its own. It is a problem originating from Microsoft Azure APIM platform and not from our service. Unfortunately, there is nothing we can do on our end to prevent it. We apologize for any inconvenience this may cause.

    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