▫️Convert Currency

This endpoint allows you to convert currency between different units using real-time exchange rates. Optionally, you can include the currency symbol in the response along with the converted value

/convert-currency

This endpoint performs currency conversion from one currency to another based on the provided parameters. It accepts a GET request with query parameters including the value, fromCurrency, and toCurrency. If any of these parameters are missing, it returns a custom HTML page indicating missing parameters. If the conversion is successful, it returns the converted value. If the format parameter is set to 'true', the converted value will be formatted with the currency symbol. If the conversion fails or an error occurs, it returns a corresponding error message with a status code of 400 or 500.

Query Parameters

ParameterTypeDescription

value

number

The value to be converted.

fromCurrency

string

The currency code of the value to be converted from.

toCurrency

string

The currency code of the value to be converted to.

format

string

(Optional) If set to 'true', the converted value will be formatted with the currency symbol.

Response

{
  "convertedValue": "string | number"
}

Example

GET /convert-currency?value=100&fromCurrency=USD&toCurrency=EUR&format=true

Supported Currency Codes and Symbols

  • USD: United States Dollar ($)

  • EUR: Euro (€)

  • GBP: British Pound Sterling (£)

  • JPY: Japanese Yen (¥)

  • CNY: Chinese Yuan (¥)

  • AUD: Australian Dollar (A$)

  • CAD: Canadian Dollar (C$)

  • CHF: Swiss Franc (CHF)

  • SEK: Swedish Krona (kr)

  • NZD: New Zealand Dollar (NZ$)

  • KRW: South Korean Won (₩)

  • SGD: Singapore Dollar (S$)

  • NOK: Norwegian Krone (kr)

  • MXN: Mexican Peso (Mex$)

  • INR: Indian Rupee (₹)

  • RUB: Russian Ruble (₽)

  • ZAR: South African Rand (R)

  • HKD: Hong Kong Dollar (HK$)

  • TRY: Turkish Lira (₺)

  • BRL: Brazilian Real (R$)

  • TWD: New Taiwan Dollar (NT$)

  • DKK: Danish Krone (kr)

  • PLN: Polish Złoty (zł)

  • THB: Thai Baht (฿)

  • CZK: Czech Crown (Kč)

Notes

  • If the conversion is successful, the converted value will be returned as a JSON response. Optionally formatted with the currency symbol if requested.

  • If the provided currency codes are invalid or not supported, a 400 error response with an error message will be returned.

  • If any error occurs during currency conversion, a 500 error response with an error message will be returned.

  • If the symbol is not available for the wanted currency you will receive a message like: This currency doesn't have a symbol

Last updated