# XE API

> XE returns currency conversions and historical exchange rates as a workflow and API.

XE converts amounts between currencies using its displayed mid-market rate; it needs an amount and source and destination currencies. Get historical rate returns a daily mid-market rate and converted amount for a past UTC date; it needs a date and two currencies. Get historical rate can also convert an optional amount.

- Page: https://fous.com/workflows/xe
- Handle: `@xe`
- Category: [Finance](https://fous.com/workflows/category/finance)
- Source website: https://xe.com
- Last verified: Sep 30, 2026
- Fous is not affiliated with XE.

## Methods

### Convert currency

Operation `convert_currency`, version 1. 1 credit per call.

Convert an amount using XE’s displayed mid-market rate, with the rate time and an XE converter link. Rates are informational, not transfer quotes.

**Input**

| Field | Type | Required | Example | Description |
|---|---|---|---|---|
| `amount` | number | yes | `100` | Amount to convert, for example 100. |
| `to_currency` | string | yes | `"Japanese yen"` | Currency to convert to, for example Japanese yen or JPY. |
| `from_currency` | string | yes | `"euro"` | Currency to convert from, for example euro or EUR. |

**Input schema**

```json
{
  "type": "object",
  "required": [
    "amount",
    "from_currency",
    "to_currency"
  ],
  "properties": {
    "amount": {
      "type": "number",
      "minimum": 0,
      "description": "Amount to convert, for example 100.",
      "examples": [
        100,
        37.29
      ]
    },
    "to_currency": {
      "type": "string",
      "minLength": 1,
      "description": "Currency to convert to, for example Japanese yen or JPY.",
      "examples": [
        "Japanese yen",
        "VND"
      ]
    },
    "from_currency": {
      "type": "string",
      "minLength": 1,
      "description": "Currency to convert from, for example euro or EUR.",
      "examples": [
        "euro",
        "USD"
      ]
    }
  },
  "additionalProperties": false,
  "examples": [
    {
      "amount": 100,
      "to_currency": "Japanese yen",
      "from_currency": "euro"
    },
    {
      "amount": 37.29,
      "to_currency": "VND",
      "from_currency": "USD"
    }
  ]
}
```

**Output**

| Field | Type | Example | Description |
|---|---|---|---|
| `rate` | number | `178.56503053178463` | Mid-market units of the destination currency per one unit of the source currency. |
| `amount` | number | `100` | Amount entered. |
| `rate_time` | string | `"2026-09-28T10:07:00Z"` | XE rate timestamp in UTC. |
| `inverse_rate` | number | `0.005600200649712317` | Units of the source currency per one unit of the destination currency. |
| `converted_amount` | number | `17857` | Converted amount rounded to the destination currency’s minor units (two decimals, or zero for currencies without minor units). |
| `to_currency_code` | string | `"JPY"` | To currency code. |
| `to_currency_name` | string | `"Japanese Yen"` | To currency name. |
| `xe_converter_link` | string | `"https://www.xe.com/currencyconverter/convert/?Amount=100&From=EUR&To=JPY"` | XE converter page for this conversion. |
| `from_currency_code` | string | `"EUR"` | From currency code. |
| `from_currency_name` | string | `"Euro"` | From currency name. |

**Example input**

```json
{
  "amount": 100,
  "to_currency": "Japanese yen",
  "from_currency": "euro"
}
```

**Example output**

```json
{
  "rate": 178.56503053178463,
  "amount": 100,
  "rate_time": "2026-09-28T10:07:00Z",
  "inverse_rate": 0.005600200649712317,
  "converted_amount": 17857,
  "to_currency_code": "JPY",
  "to_currency_name": "Japanese Yen",
  "xe_converter_link": "https://www.xe.com/currencyconverter/convert/?Amount=100&From=EUR&To=JPY",
  "from_currency_code": "EUR",
  "from_currency_name": "Euro"
}
```

### Get historical rate

Operation `get_historical_rate`, version 1. 1 credit per call.

Get an XE daily mid-market exchange rate and converted amount for a past UTC date. Dates and currencies without a published table rate are unavailable.

**Input**

| Field | Type | Required | Example | Description |
|---|---|---|---|---|
| `date` | string | yes | `"2024-01-15"` | Past date of the XE daily UTC table, for example 2024-01-15. |
| `amount` | number | no | `100` | Amount of the starting currency to convert, for example 100. |
| `to_currency` | string | yes | `"euro"` | Currency to convert to, by name or three-letter code, for example US Dollar or USD. |
| `from_currency` | string | yes | `"USD"` | Currency to convert from, by name or three-letter code, for example euro or EUR. |

**Input schema**

```json
{
  "type": "object",
  "required": [
    "from_currency",
    "to_currency",
    "date"
  ],
  "properties": {
    "date": {
      "type": "string",
      "format": "date",
      "description": "Past date of the XE daily UTC table, for example 2024-01-15.",
      "examples": [
        "2024-01-15",
        "2023-06-12"
      ]
    },
    "amount": {
      "type": "number",
      "default": 1,
      "description": "Amount of the starting currency to convert, for example 100.",
      "examples": [
        100,
        25
      ]
    },
    "to_currency": {
      "type": "string",
      "description": "Currency to convert to, by name or three-letter code, for example US Dollar or USD.",
      "examples": [
        "euro",
        "Japanese Yen"
      ]
    },
    "from_currency": {
      "type": "string",
      "description": "Currency to convert from, by name or three-letter code, for example euro or EUR.",
      "examples": [
        "USD",
        "euro"
      ]
    }
  },
  "additionalProperties": false,
  "examples": [
    {
      "date": "2024-01-15",
      "amount": 100,
      "to_currency": "euro",
      "from_currency": "USD"
    },
    {
      "date": "2023-06-12",
      "amount": 25,
      "to_currency": "Japanese Yen",
      "from_currency": "euro"
    }
  ]
}
```

**Output**

| Field | Type | Example | Description |
|---|---|---|---|
| `date` | string | `"2024-01-15"` | Date of the daily UTC table. |
| `rate` | number | `0.9134791648608974` | Units of destination currency per one starting currency. |
| `to_currency` | string | `"EUR"` | Destination currency code. |
| `inverse_rate` | number | `1.0947157181765363` | Units of starting currency per one destination currency. |
| `from_currency` | string | `"USD"` | Starting currency code. |
| `table_page_link` | string | `"https://www.xe.com/currencytables/?from=USD&date=2024-01-15"` | XE historic table page for the starting currency and date. |
| `converted_amount` | number | `91.35` | Amount converted to the destination currency, rounded to two decimal places. |
| `to_currency_name` | string | `"Euro"` | Destination currency name. |
| `from_currency_name` | string | `"US Dollar"` | Starting currency name. |

**Example input**

```json
{
  "date": "2024-01-15",
  "amount": 100,
  "to_currency": "euro",
  "from_currency": "USD"
}
```

**Example output**

```json
{
  "date": "2024-01-15",
  "rate": 0.9134791648608974,
  "to_currency": "EUR",
  "inverse_rate": 1.0947157181765363,
  "from_currency": "USD",
  "table_page_link": "https://www.xe.com/currencytables/?from=USD&date=2024-01-15",
  "converted_amount": 91.35,
  "to_currency_name": "Euro",
  "from_currency_name": "US Dollar"
}
```

## Quick start

Call the API with a Fous API key (`FOUS_API_KEY`). To create one, turn on Developer mode in Fous Studio, then open Keys & connections → API keys (https://app.fous.com/keys).

```bash
# First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
: "${FOUS_API_KEY:?Set FOUS_API_KEY before running this example}"

curl 'https://api.fous.com/v1/query' \
  --fail-with-body --silent --show-error --max-time 120 \
  -H "Authorization: Bearer $FOUS_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "api": "@xe",
  "visibility": "public",
  "operation": "convert_currency",
  "version": 1,
  "input": {
    "amount": 100,
    "to_currency": "Japanese yen",
    "from_currency": "euro"
  },
  "response": {
    "format": "json"
  }
}'
```

```python
# Save as fous.py and run with python3 fous.py. No packages needed.
# First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
import json
import os
import urllib.error
import urllib.request

api_key = os.environ.get("FOUS_API_KEY")
if not api_key:
    raise RuntimeError("Set FOUS_API_KEY before running this example")

body = json.loads("{\n  \"api\": \"@xe\",\n  \"visibility\": \"public\",\n  \"operation\": \"convert_currency\",\n  \"version\": 1,\n  \"input\": {\n    \"amount\": 100,\n    \"to_currency\": \"Japanese yen\",\n    \"from_currency\": \"euro\"\n  },\n  \"response\": {\n    \"format\": \"json\"\n  }\n}")
request = urllib.request.Request(
    "https://api.fous.com/v1/query",
    data=json.dumps(body).encode("utf-8"),
    headers={
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json",
    },
    method="POST",
)
try:
    with urllib.request.urlopen(request, timeout=120) as response:
        result = json.load(response)
except urllib.error.HTTPError as error:
    raise RuntimeError(f"HTTP {error.code}: {error.read().decode('utf-8', errors='replace')}") from error
if result.get("success") is False:
    raise RuntimeError(result.get("error", {}).get("message", "Request failed"))
print(json.dumps(result["data"]["output"], indent=2))
```

```typescript
// Save as fous.mts and run with npx tsx fous.mts.
// First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
const apiKey = process.env.FOUS_API_KEY;
if (!apiKey) throw new Error("Set FOUS_API_KEY before running this example");

const response = await fetch("https://api.fous.com/v1/query", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${apiKey}`,
    "Content-Type": "application/json",
  },
  signal: AbortSignal.timeout(120_000),
  body: JSON.stringify({
  "api": "@xe",
  "visibility": "public",
  "operation": "convert_currency",
  "version": 1,
  "input": {
    "amount": 100,
    "to_currency": "Japanese yen",
    "from_currency": "euro"
  },
  "response": {
    "format": "json"
  }
}),
});
type ApiResult = { success: boolean; data?: { output: unknown }; error?: { message: string } };
const result: ApiResult = await response.json();
if (!response.ok || result.success === false) {
  throw new Error(result.error?.message ?? `HTTP ${response.status}`);
}
if (!result.data) throw new Error("Missing API response data");
console.log(result.data.output);
```

Or describe the data in plain language: send `{"api":"@xe","prompt":"Describe the data you need, with every detail"}` to the same URL. Fous fills in the input, runs the method that fits and returns only the fields you asked for; `data.route.calls[].request` is the exact call it made. Routing is free; the run costs the same.

## Use cases

- Convert prices between currencies for planning.
- Compare exchange rates across selected dates.
- Estimate converted amounts for financial reports.
- Review historical currency rates for a selected date.

## FAQ

### Is Fous affiliated with XE?

No. Fous is not affiliated with XE. This workflow reads the public xe.com website and returns its data.

### How much does it cost?

Each run costs 1 credit. With pay-as-you-go, a credit costs 1¢; monthly plans cost less per credit.

### Do I need a XE account?

No. You only need a Fous account.

### How current is the data?

Fous gets the data from xe.com when you run it; repeating the same request within a day may return the saved result. Fous checks this workflow automatically; it last passed a check on Sep 30, 2026.

### How much is an amount in another currency?

Convert currency returns the converted amount and mid-market rate. It needs an amount, source currency and destination currency.

### What was the exchange rate on a past date?

Get historical rate returns the daily rate for a past UTC date and the selected currencies.

## Related

- [European Central Bank API](https://fous.com/workflows/european-central-bank.md): The European Central Bank provides official euro reference rates and informational currency conversions using the latest preceding published rates when needed, plus current key interest rates and optionally earlier changes.
- [Wise API](https://fous.com/workflows/wise.md): Wise provides current mid-market exchange rates, optional daily rate history, published transfer cost comparisons and delivery estimates, and bank SWIFT/BIC codes and branch locations when available.
- [Google Finance API](https://fous.com/workflows/google-finance.md): Google Finance returns possibly delayed prices and figures, indexes, up to four movers timed by oldest quote, currency conversions, and up to five financial periods.
- [US Treasury API](https://fous.com/workflows/us-treasury.md): US Treasury provides official daily interest rates and national debt figures for requested or latest available dates, plus quarterly reporting exchange rates using the latest preceding quarter when needed.
- [CoinGecko API](https://fous.com/workflows/coingecko.md): CoinGecko returns cryptocurrency prices and histories, sector rankings and details, and trending coins; non-USD historical values cover 365 days, histories 7–365 days, and today’s prices may change.
- [Kitco API](https://fous.com/workflows/kitco.md): Precious metals spot prices and market coverage.
- [Yahoo Finance API](https://fous.com/workflows/yahoo-finance.md): Yahoo Finance provides quotes, movers, company financials, analyst ratings, earnings, news, and up to 5,000 price rows with adjusted returns; prices may be delayed.
- [Weather Underground API](https://fous.com/workflows/weather-underground.md): Historical and current weather conditions from stations worldwide.
- [All Finance workflows](https://fous.com/workflows/category/finance)
