# ECB Exchange Rates (Official EUR Reference Rates) (`accommodating_aptitude/ecb-exchange-rates`) Actor

Pulls the European Central Bank's official daily reference rates from the ECB Data Portal API and the eurofxref feed. 30+ currencies, historical data over a date range, cross rates for non-EUR bases. No API key needed.

- **URL**: https://apify.com/accommodating_aptitude/ecb-exchange-rates.md
- **Developed by:** [Korhan Coşan Ergün](https://apify.com/accommodating_aptitude) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 exchange rate founds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## ECB Exchange Rates (Official EUR Reference Rates)

Pulls the **official euro reference rates** of the European Central Bank (ECB)
from key-free, open sources. No scraping — one is a REST/SDMX API, the other the
official XML feed.

- **ECB Data Portal REST API (SDMX)** — historical data over a date range.
  `https://data-api.ecb.europa.eu/service/data/EXR/<key>?format=csvdata`
  (the official successor of the old `sdw-wsrest.ecb.europa.eu` address, which is no longer live)
- **eurofxref daily feed** — the latest business day, 30+ currencies, a single request.
  `https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml`

ECB statistics may be used freely with attribution
([terms of use](https://www.ecb.europa.eu/stats/policy_and_rules/html/index.en.html)).

### Two run modes

| Input | Mode | What it does |
|---|---|---|
| `dateFrom`/`dateTo` empty | Daily XML feed | Rates for the latest business day — a single request, ~50 ms |
| `dateFrom` and/or `dateTo` filled in | Data Portal API | A series over a date range (daily/monthly/annual) |

If the API has an outage, the actor automatically falls back to the 90-day XML feed.

### Input

| Field | Description |
|---|---|
| `currencies` | ISO 4217 codes, e.g. `["USD","GBP","TRY"]`. Use `["ALL"]` for all of them |
| `baseCurrency` | `EUR` by default. If another value is given, the cross rate is computed via EUR |
| `dateFrom` / `dateTo` | ISO 8601 date range. If both are empty, the latest business day |
| `frequency` | `daily`, `monthly` (monthly average), `annual` (annual average) |
| `maxItems` | Maximum records (1 record = 1 date × 1 currency) |

Supported currencies: USD, JPY, BGN, CZK, DKK, GBP, HUF, PLN, RON, SEK,
CHF, ISK, NOK, TRY, AUD, BRL, CAD, CNY, HKD, IDR, ILS, INR, KRW, MXN, MYR,
NZD, PHP, SGD, THB, ZAR.

### Output (each record)

```json
{
  "id": "EUR-USD-daily-2026-11-09",
  "title": "EUR/USD 2026-11-09: 1.1193",
  "date": "2026-11-09",
  "source": "ecb_daily_xml_feed",
  "currency": "USD",
  "base_currency": "EUR",
  "currency_pair": "EUR/USD",
  "rate": 1.1193,
  "inverse_rate": 0.89341553,
  "frequency": "daily",
  "series_key": "D.USD.EUR.SP00.A",
  "eur_rate": 1.1193,
  "is_cross_rate": false,
  "publisher": "European Central Bank"
}
```

- `rate` = **how much `currency` one unit of `base_currency` buys** (the ECB convention).
- `inverse_rate` = the inverse.
- `eur_rate` = the raw EUR rate for the same day (for auditing cross-rate calculations).
- `is_cross_rate` = when `true`, the value was derived from two ECB reference rates.

`sample_output.json` contains 4 records taken from real local runs (covering the
daily feed, a non-EUR cross rate and the monthly series modes).

### Pricing (PPE)

A `rate-found` event is fired for every rate record — **$0.001 per record**.

### Local run

```bash
cd ~/rua/products/apify/ecb-exchange-rates
mkdir -p storage/key_value_stores/default
cat > storage/key_value_stores/default/INPUT.json <<'EOF'
{"currencies": ["USD","GBP","TRY"], "baseCurrency": "EUR",
 "dateFrom": "2026-10-01", "dateTo": "2026-11-09", "maxItems": 100}
EOF
APIFY_LOCAL=1 python3 main.py
## output: storage/datasets/default/*.json
```

### Known limitations

- ECB reference rates are only published on **TARGET business days** (there are
  no records for weekends/holidays) and are updated around 16:00 CET each day.
- On a cold cache the Data Portal API can return 504 on the first request; the
  actor retries automatically, so the first call over a wide date range may take
  30–60 s.
- The rates are for information purposes; ECB does not warrant them for
  transactional use.
- At monthly/annual frequency the date field comes back as `2026-10` / `2026`
  (no day).

# Actor input Schema

## `currencies` (type: `array`):

ISO 4217 codes, e.g. \['USD','GBP','TRY']. Enter \['ALL'] or leave empty for all ECB reference currencies. Supported: USD, JPY, BGN, CZK, DKK, GBP, HUF, PLN, RON, SEK, CHF, ISK, NOK, TRY, AUD, BRL, CAD, CNY, HKD, IDR, ILS, INR, KRW, MXN, MYR, NZD, PHP, SGD, THB, ZAR.

## `baseCurrency` (type: `string`):

The base currency the rates are computed against (EUR by default). If a non-EUR base is chosen, the cross rate is computed from ECB reference rates.

## `dateFrom` (type: `string`):

ISO 8601 date, e.g. '2026-01-01'. If both dateFrom and dateTo are left empty, only the rates of the latest business day are pulled (a single request, very fast).

## `dateTo` (type: `string`):

ISO 8601 date, e.g. '2026-11-10'. If left empty, today is used.

## `frequency` (type: `string`):

Data frequency. Daily rates are published for business days.

## `maxItems` (type: `integer`):

Maximum number of rate records to pull (one record = one date + one currency).

## Actor input object example

```json
{
  "currencies": [
    "USD",
    "GBP",
    "TRY",
    "JPY",
    "CHF",
    "CNY",
    "CAD",
    "AUD",
    "SEK",
    "PLN"
  ],
  "baseCurrency": "EUR",
  "dateFrom": "",
  "dateTo": "",
  "frequency": "daily",
  "maxItems": 200
}
```

# Actor output Schema

## `dataset` (type: `string`):

Dataset containing all records found in this run.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "currencies": [
        "USD",
        "GBP",
        "TRY",
        "JPY",
        "CHF",
        "CNY",
        "CAD",
        "AUD",
        "SEK",
        "PLN"
    ],
    "baseCurrency": "EUR"
};

// Run the Actor and wait for it to finish
const run = await client.actor("accommodating_aptitude/ecb-exchange-rates").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "currencies": [
        "USD",
        "GBP",
        "TRY",
        "JPY",
        "CHF",
        "CNY",
        "CAD",
        "AUD",
        "SEK",
        "PLN",
    ],
    "baseCurrency": "EUR",
}

# Run the Actor and wait for it to finish
run = client.actor("accommodating_aptitude/ecb-exchange-rates").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "currencies": [
    "USD",
    "GBP",
    "TRY",
    "JPY",
    "CHF",
    "CNY",
    "CAD",
    "AUD",
    "SEK",
    "PLN"
  ],
  "baseCurrency": "EUR"
}' |
apify call accommodating_aptitude/ecb-exchange-rates --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,accommodating_aptitude/ecb-exchange-rates"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/S9uLzLNvsQZga21ip/builds/rS8pa9tqroJBXSpud/openapi.json
