# 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/tools/xe
- Handle: `@xe`
- Category: [Finance](https://fous.com/tools/category/finance)
- Source website: https://xe.com
- Last verified: Sep 30, 2026

## Methods

### Convert currency

Operation `convert_currency`, version 1. 1 credit per completed call. Failed calls without a completed billing receipt are free; completed work can remain charged if delivery is interrupted.

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 completed call. Failed calls without a completed billing receipt are free; completed work can remain charged if delivery is interrupted.

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

Replace `YOUR_API_KEY` with a Fous API key. To create one, open Developers at the bottom of Fous Studio, turn on Developer mode, then go to API keys (https://app.fous.com/keys). Change the values in `input` to run the same tool on new data.

```bash
curl 'https://api.fous.com/v1/query' \
  --fail-with-body --silent --show-error --max-time 180 \
  -H "Authorization: Bearer YOUR_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.
import json
import urllib.error
import urllib.request

api_key = "YOUR_API_KEY"

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=180) 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.
const apiKey = "YOUR_API_KEY";

const response = await fetch("https://api.fous.com/v1/query", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${apiKey}`,
    "Content-Type": "application/json",
  },
  signal: AbortSignal.timeout(180_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);
```

## Use from an AI assistant

Connect this tool to Claude Code, Claude Desktop, Cursor, VS Code, Codex and any MCP client as its own MCP server. Each method is a typed tool whose arguments are the method’s input.

- Server URL: `https://api.fous.com/mcp/tools/xe`
- Authorization: `Authorization: Bearer <Fous API key>`

**Tools**

- `convert_currency`: Convert currency. 1 credit per completed call. Failed calls without a completed billing receipt are free; completed work can remain charged if delivery is interrupted.
- `get_historical_rate`: Get historical rate. 1 credit per completed call. Failed calls without a completed billing receipt are free; completed work can remain charged if delivery is interrupted.
- `fous_get_run`: the result of a run that was still going, by its `request_id`. Free.

Claude Code:

```bash
claude mcp add --scope user --transport http fous-xe https://api.fous.com/mcp/tools/xe --header "Authorization: Bearer ${FOUS_API_KEY:?Set FOUS_API_KEY to your Fous API key}"
```

To give the assistant every tool, connect `https://api.fous.com/mcp`: it finds one with `fous_search_tools` and runs it with `fous_run_tool`. Setup for other clients: https://fous.com/llms-full.txt.

## 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

### Can I run it with my own inputs?

Yes. Change the inputs in Studio and press Run, or send new inputs from your code, or ask a connected AI assistant.

### Can I call this XE tool as an API?

Yes. Send a POST request to /v1/query with your Fous API key and the inputs, and get JSON back.

### How much does it cost?

Each completed run costs 1 credit. Failed runs without a completed receipt are free; completed work can remain charged if delivery is interrupted. 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. Some results are reused for up to 24 hours, and results that use your account or key are never reused. It was last verified 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/tools/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/tools/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/tools/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/tools/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/tools/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/tools/kitco.md): Precious metals spot prices and market coverage.
- [Yahoo Finance API](https://fous.com/tools/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/tools/weather-underground.md): Historical and current weather conditions from stations worldwide.
- [All Finance tools](https://fous.com/tools/category/finance)
