ExchangeRate API icon

ExchangeRate API

Consume ExchangeRate API

Exchange Rate → Get Exchange Rates

AI-generated

Overview

This node interacts with an Exchange Rate API to provide currency exchange information. Specifically, for the "Exchange Rate" resource and the "Get Exchange Rates" operation, it fetches the latest exchange rates relative to a specified base currency.

Common scenarios:

  • Automatically retrieving up-to-date currency conversion rates for financial reports.
  • Integrating live exchange rate data into e-commerce platforms or accounting systems.
  • Monitoring currency fluctuations for investment or budgeting purposes.

Practical example:
You want to get the current exchange rates for USD against all other supported currencies. By setting the base currency to "USD," the node will return the latest exchange rates from USD to other currencies, which you can then use in your workflow for conversions or analysis.

Properties

Name Meaning
Base Currency The three-letter ISO currency code to get exchange rates for. Options include all standard currencies such as USD (US Dollar), EUR (Euro), JPY (Yen), GBP (Pound Sterling), AUD (Australian Dollar), and many others.

Output

The output is a JSON array where each item contains the response from the Exchange Rate API for the requested base currency. The main fields in the JSON output include:

  • result: Status of the API call, typically "success" if successful.
  • conversion_rates: An object mapping currency codes to their exchange rates relative to the base currency.
  • time_last_update_utc: Timestamp indicating when the exchange rates were last updated.

Example output snippet:

{
  "result": "success",
  "conversion_rates": {
    "EUR": 0.85,
    "JPY": 110.53,
    "GBP": 0.75,
    ...
  },
  "time_last_update_utc": "Fri, 23 Jun 2023 00:00:01 +0000"
}

No binary data is output by this node.

Dependencies

  • Requires an active API key credential for the Exchange Rate API service.
  • The node makes HTTP GET requests to the Exchange Rate API endpoint https://v6.exchangerate-api.com/v6/latest/{baseCurrency}.
  • Proper configuration of the API key in n8n credentials is necessary.

Troubleshooting

  • API Key Missing or Invalid: If the API key is empty or invalid, the node throws an error prompting to provide a valid API key.
  • Invalid Base Currency: If the base currency code is not recognized or supported by the API, the response may lack expected data, causing errors.
  • API Response Errors: The node checks the API response's result field; if it is not "success", it throws an error including the API's error type and message.
  • Missing Conversion Rates: If the API response does not contain the conversion_rates object or it is malformed, the node throws an error indicating an invalid API response.
  • Network Issues: Any network connectivity problems or API downtime will cause request failures.

To resolve these issues:

  • Ensure the API key is correctly set and has sufficient permissions.
  • Verify that the base currency code is valid and supported.
  • Check network connectivity and API service status.
  • Use the node's "Continue on Fail" option to handle errors gracefully in workflows.

Links and References

Discussion