AI Template Search
N8N Bazar

Find n8n Templates with AI Search

Search thousands of workflows using natural language. Find exactly what you need, instantly.

Start Searching Free
Sep 14, 2025

n8n Webhook: Live ECB Euro Exchange Rates

n8n Webhook Workflow for Live ECB Euro Exchange Rates This reference guide documents an n8n workflow that exposes the European Central Bank (ECB) daily Euro foreign exchange reference rates through a simple HTTP webhook. The workflow retrieves the ECB XML feed, converts it to JSON, normalizes the data into one item per currency, and responds […]

n8n Webhook: Live ECB Euro Exchange Rates

n8n Webhook Workflow for Live ECB Euro Exchange Rates

This reference guide documents an n8n workflow that exposes the European Central Bank (ECB) daily Euro foreign exchange reference rates through a simple HTTP webhook. The workflow retrieves the ECB XML feed, converts it to JSON, normalizes the data into one item per currency, and responds with either the full rate set or a single currency based on an optional query parameter.

1. Workflow Overview

This n8n automation is designed as a lightweight, read-only API endpoint for live ECB EUR exchange rates. It is suitable for internal tools, dashboards, or backend services that need the latest EUR-based reference rates without integrating directly with the ECB XML feed.

Key capabilities

  • Expose a simple HTTP GET webhook endpoint that returns the latest ECB Euro exchange rates in JSON format.
  • Perform XML-to-JSON transformation inside n8n, avoiding external parsers or custom code.
  • Support query-based filtering using a foreign query parameter (for example, ?foreign=USD) to return a single currency rate.
  • Reduce stale data issues by appending a randomized query parameter to the ECB URL to avoid intermediary cache reuse.

Node sequence

The workflow is composed of the following nodes, executed in order:

  1. Webhook – Incoming HTTP trigger on path /eu-exchange-rate (GET).
  2. HTTP Request – Fetches https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml with a random query parameter.
  3. XML (XML to JSON) – Parses the ECB XML response into JSON.
  4. Split In Batches / Item List Split (referred to here as Split Out Data) – Extracts the currency entries and emits one item per currency.
  5. If (has URL query) – Determines whether the incoming request includes a foreign query parameter.
  6. Filter (Filter the currency symbol) – Filters items by the requested currency symbol when foreign is present.
  7. Respond Asked Item – Returns the filtered single-currency result.
  8. Respond All Items – Returns the full rate list when no currency filter is provided.

2. Architecture & Data Flow

The workflow follows a linear, request-driven architecture:

  1. A client issues a GET request to the n8n webhook endpoint, optionally including a foreign query parameter.
  2. The Webhook node forwards control to the HTTP Request node, which retrieves the ECB XML feed with a random query suffix to avoid cache hits.
  3. The XML node converts the XML payload into a JSON object with nested structure.
  4. The Split Out Data node selects the nested array of currency entries and outputs a separate n8n item for each currency-rate pair.
  5. The If node evaluates the presence of query parameters. If a foreign symbol is provided, execution continues through the filter path. Otherwise, it bypasses filtering.
  6. On the filtered path, the Filter node keeps only the item whose currency matches the requested symbol. The Respond Asked Item node sends this single item back to the caller.
  7. On the unfiltered path, the Respond All Items node returns the full list of items (all currencies) as a JSON array.

All operations are performed per request, so each call to the webhook fetches and parses the current ECB daily XML file.

3. Node-by-Node Breakdown

3.1 Webhook Node – Incoming Trigger

  • Node type: Webhook
  • HTTP method: GET
  • Path: eu-exchange-rate

Example endpoint URL (adjust to your deployment):

GET https://your-n8n-instance/webhook/eu-exchange-rate

Without any query parameters, the workflow returns all available ECB reference rates as a JSON array. To request a single currency, clients include the foreign query parameter:

GET https://your-n8n-instance/webhook/eu-exchange-rate?foreign=USD

In this case, the workflow attempts to return only the USD rate. The Webhook node exposes the full query object to subsequent nodes, which is later inspected by the If and Filter nodes.

3.2 HTTP Request Node – Fetch ECB XML

  • Node type: HTTP Request
  • HTTP method: GET
  • Base URL: https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml

To avoid stale responses from intermediary caches or CDNs, the node uses an expression to append a randomized numeric query parameter to the URL:

{{  "https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml?"  + (Math.floor(Math.random() * (999999999 - 100000000 + 1)) + 100000000) 
}}

This expression generates a random integer between 100000000 and 999999999 and appends it as a query string, for example:

https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml?567432198

As a result, each request uses a unique URL, which significantly reduces caching issues and helps ensure that the latest daily file is retrieved.

Response format: configure the HTTP Request node to return raw XML (for example, by setting Response Format to String or File, depending on your n8n version) so that the XML node can parse it correctly.

3.3 XML Node – XML to JSON Conversion

  • Node type: XML
  • Operation: XML to JSON

The XML node consumes the raw XML body from the HTTP Request node and converts it into a JSON object. After parsing, the ECB XML document is represented as nested JSON properties, which can be accessed using JavaScript-style property paths in expressions.

This transformation enables downstream nodes to work with the data using n8n’s standard JSON item model instead of raw XML.

3.4 Split Out Data Node – Extract Currency Array

  • Node type: Item list / Split (referred to as Split Out Data)
  • Input: JSON output from XML node
  • Target path: ['gesmes:Envelope'].Cube.Cube.Cube

The ECB JSON structure after parsing is nested under several Cube elements. The Split Out Data node uses the path:

['gesmes:Envelope'].Cube.Cube.Cube

to access the innermost array of currency entries. Each element of this array is an object with at least two properties:

[  { "currency": "USD", "rate": "1.0987" },  { "currency": "JPY", "rate": "152.34" },  ...
]

The node is configured to iterate over this array and emit one n8n item per object. This normalization step is critical for filtering and conditional responses later in the workflow.

3.5 If Node – Query Presence Check

  • Node type: If
  • Purpose: Detect whether the webhook was called with a query parameter.

The If node inspects the data coming from the Webhook node, typically checking whether the query object is non empty and specifically whether a foreign field is present. Conceptually, the condition is:

  • If the request includes a foreign query parameter, follow the “true” branch.
  • If not, follow the “false” branch and return all items.

This node does not modify the exchange rate data itself. It only controls the routing logic based on the inbound HTTP request metadata.

3.6 Filter Node – Filter the Currency Symbol

  • Node type: Filter (or similar item filtering node)
  • Input: Items from Split Out Data node
  • Condition: item.currency === $json["query"]["foreign"] (conceptually)

When the If node determines that a foreign query parameter is present, execution continues into the Filter node. This node compares each item’s currency property to the requested currency symbol supplied by the client. For example, if the query is:

?foreign=USD

then only items where currency equals USD are kept. All other items are discarded.

If there is no matching currency for the provided symbol, the filter will output an empty item list. How this case is handled depends on the configuration of the subsequent Respond node (for example, it may return an empty array or an empty object).

3.7 Respond Asked Item Node – Single Currency Response

  • Node type: Webhook Reply / Respond to Webhook
  • Input: Filtered item list (typically 0 or 1 item)

For requests that include foreign, this node sends the filtered result back to the original HTTP client. When there is exactly one match, the response is a single JSON object representing that currency-rate pair:

{  "currency": "USD",  "rate": "1.0987"
}

If the filter produced multiple items (which should not happen with valid ECB data and unique currency codes) or zero items, the actual response will reflect that configuration. In typical ECB usage, you should expect at most one item per currency code.

3.8 Respond All Items Node – Full Rate List Response

  • Node type: Webhook Reply / Respond to Webhook
  • Input: All items from Split Out Data node

When the If node determines that there is no foreign query parameter, the workflow bypasses the Filter node and passes all items directly to this Respond node. The response body is a JSON array of currency objects:

[  { "currency": "USD", "rate": "1.0987" },  { "currency": "JPY", "rate": "152.34" },  ...
]

This is the default behavior for simple GET requests without query filters.

4. Request & Response Examples

4.1 Full rate list (no query)

Request:

GET https://your-n8n-instance/webhook/eu-exchange-rate

Example response:

[  {"currency":"USD","rate":"1.0987"},  {"currency":"JPY","rate":"152.34"},  ...
]

4.2 Single currency rate (with foreign query)

Request:

GET https://your-n8n-instance/webhook/eu-exchange-rate?foreign=USD

Example response:

{  "currency":"USD",  "rate":"1.0987"
}

All rates are relative to EUR, as provided by the ECB reference feed.

5. Configuration Notes & Edge Cases

5.1 XML structure and Split path

The correctness of the ['gesmes:Envelope'].Cube.Cube.Cube path in the Split Out Data node depends on the exact JSON structure produced by the XML node. If the ECB XML format changes or your XML node settings differ, you may need to adjust this path.

Use the Execute Node feature on the XML node to inspect the raw JSON output and confirm that the nested Cube elements appear as expected.

5.2 Dealing with caching & ECB rate limits

  • The random query parameter on the ECB URL is intended to bypass intermediate caches that might otherwise serve outdated rates.
  • ECB endpoints are public, but they may enforce rate limits such as HTTP 429 (Too Many Requests) or 403 (Forbidden) under heavy load or misuse.
  • For high traffic scenarios, consider adding caching at the n8n level instead of requesting the ECB feed on every single webhook call.

5.3 XML parsing issues

If the XML node fails to parse the response, verify the following:

  • The HTTP Request node is configured to return the body as plain text or a format that the XML node supports.
  • No unexpected Content-Encoding or compression is interfering with the response. If necessary, adjust the HTTP Request node’s Response Format.
  • Optionally, set an explicit header in the HTTP Request node:
    Accept: application/xml

    to ensure you receive XML instead of another format.

5.4 Handling missing or invalid currency codes

  • If a client provides a currency symbol that is not present in the ECB feed, the Filter node will output zero items.
  • Depending on your Respond node configuration, this may result in an empty array, an empty object, or a default response. Adjust your response handling if you want to return a specific error message or HTTP status code for “currency not found”.

6. Customization & Advanced Usage

6.1 Adjusting the JSON response schema

If you want to return a different JSON structure, insert a Set node before the Respond nodes. Typical customizations include:

  • Renaming keys, for example:
    • currency to symbol
    • rate to value
  • Adding a base field:
    base: "EUR"
  • Converting the rate from string to number using an expression for easier downstream calculations.

6.2 Caching inside or outside n8n

To reduce the number of HTTP calls to the ECB endpoint, especially if your webhook is invoked frequently during the same day, you can:

  • Use an in-memory cache pattern inside n8n (for example, via a separate workflow that refreshes rates periodically and stores them in a database or key-value store).
  • Integrate an external cache such as Redis, a database, or an HTTP cache layer in front of your n8n instance.

The current template always fetches live data on each request, which is simple but may not be optimal under heavy load.

6.3 Supporting other ECB feeds (historical data)

The ECB provides additional XML endpoints, including 90-day and long term historical feeds. You can reuse the same workflow structure with small adjustments:

  • Change the HTTP Request node URL to the desired ECB historical or 90-day feed.
  • Verify the resulting XML structure and update the Split Out Data path if necessary.
  • Optionally add query parameters or logic to select specific dates from historical data.

6.4 Adding authentication to the webhook

If you expose this webhook publicly, you may want to restrict access. Common options include:

  • Using the Webhook node’s built-in authentication mechanisms (for example, HTTP Basic Auth or API key).
  • Implementing custom authentication logic in front of the workflow, such as a

Leave a Reply

Your email address will not be published. Required fields are marked *

AI Workflow Builder
N8N Bazar

AI-Powered n8n Workflows

🔍 Search 1000s of Templates
✨ Generate with AI
🚀 Deploy Instantly
Try Free Now