ExchangeRate API icon

ExchangeRate API

Consume ExchangeRate API

Get Exchange Rates

AI-generated

Overview

This node integrates with the ExchangeRate API to provide currency exchange functionalities. It supports two main operations:

  • Get Exchange Rates: Retrieves the latest exchange rates for a specified base currency against various other currencies.
  • Convert Value: Converts a specified amount from one currency to another, optionally applying a conversion fee and rounding to a set number of decimal places.

Common scenarios where this node is beneficial include financial applications, e-commerce platforms, accounting systems, or any workflow requiring up-to-date currency conversion data. For example, an e-commerce store can use it to display product prices in different currencies based on real-time exchange rates, or a finance team can automate currency conversions for international transactions.

Properties

Name Meaning
Base Currency The three-letter ISO currency code used as the base for retrieving exchange rates. Options include all standard currencies such as USD, EUR, JPY, GBP, etc. (default: USD).

Note: The above property applies specifically to the "Get Exchange Rates" operation.

Output

The node outputs JSON data structured according to the selected operation:

  • Get Exchange Rates:
    Outputs an object containing:

    • result: Status string, typically "success" if the request succeeded.
    • conversion_rates: An object mapping currency codes to their exchange rate relative to the base currency.
    • Additional metadata such as timestamps may be included depending on the API response.
  • Convert Value (not requested but part of the node):
    Depending on the "Return Detailed Response" option, outputs either:

    • A detailed object including original amount, source and target currencies, exchange rate used, any applied conversion fee percentage, converted amount, and timestamp of last update.
    • Or simply the converted amount as a number.

The node does not output binary data.

Dependencies

  • Requires an API key credential for the ExchangeRate API to authenticate requests.
  • Makes HTTP GET requests to the ExchangeRate API endpoint https://v6.exchangerate-api.com/v6/latest/{currency_code}.
  • No additional environment variables are required beyond the API key credential configuration in n8n.

Troubleshooting

  • Empty or missing API key: The node will throw an error if the API key is empty or not provided. Ensure that a valid API key is configured in the node credentials.
  • Invalid API response: If the API response lacks the expected conversion_rates object or it is malformed, the node throws an error indicating an invalid API response.
  • Currency not found: When converting values, if the target currency is not present in the retrieved exchange rates, an error is thrown specifying the missing currency.
  • Amount validation: For conversion, the amount must be a positive number; otherwise, an error is raised.
  • Decimal places validation: If decimal places are specified, they must be a non-negative integer.
  • API errors: Any API error responses are surfaced with their error type and message when available.

To resolve these issues, verify API key validity, ensure correct currency codes, and validate input parameters before execution.

Links and References

Discussion