0-CodeKit icon

0-CodeKit

A toolbox of no-code utilities

Overview

The Convert Currency operation in the "Convert" resource of this n8n node allows you to convert a specified amount from one currency to another, optionally using historical exchange rates for a given date. This is useful for financial workflows, reporting, invoicing, or any automation where currency conversion is required.

Practical examples:

  • Automatically converting sales amounts from various currencies into your home currency for accounting.
  • Generating reports that require all values in a single currency, even if transactions occurred in different ones.
  • Calculating historical currency values for auditing or analytics.

Properties

Name Meaning
Amount The numeric value to be converted. Must be at least 0.01.
Source Currency The currency code of the original amount. Options include a wide range of international currencies (e.g., USD, EUR, JPY, etc.).
Target Currency The currency code to which the amount should be converted. Options are the same as for Source Currency.
Date (Optional) The date for which the conversion rate should be used. If provided, the conversion will use the historical rate for that date. Useful for past transactions or audits.

Output

The output will be a JSON object containing the result of the currency conversion. While the exact structure may depend on the API response, it typically includes:

{
  "amount": 100,
  "sourceCurrency": "USD",
  "targetCurrency": "EUR",
  "convertedAmount": 92.5,
  "rate": 0.925,
  "date": "2024-06-01"
}
  • amount: The original amount provided.
  • sourceCurrency: The source currency code.
  • targetCurrency: The target currency code.
  • convertedAmount: The result after conversion.
  • rate: The exchange rate used for the conversion.
  • date: The date for which the rate was applied (if provided).

Note: The actual field names may vary depending on the backend service.

Dependencies

  • External Service: Requires access to the CodeKit API for performing the currency conversion.
  • API Key: You must configure the codeKitApi credential in n8n for authentication.
  • n8n Configuration: No additional environment variables are needed beyond the credential setup.

Troubleshooting

Common issues:

  • Missing or invalid credentials: Ensure the codeKitApi credential is correctly set up in n8n.
  • Unsupported currency codes: Only supported ISO currency codes can be used; check the options list.
  • Invalid amount: The amount must be a number greater than or equal to 0.01.
  • Date format errors: If specifying a date, ensure it is in a valid format (typically YYYY-MM-DD).

Error messages and resolutions:

  • "error":"Request failed with status code 401": Check your API credentials.
  • "error":"Invalid currency code": Verify that both source and target currencies are selected from the available options.
  • "error":"Amount must be greater than 0": Enter a valid amount.

Links and References

Discussion