---
title: "匯率 API | Narwhal API"
description: "支援 144 種貨幣和 10,296 個貨幣對的匯率 API，提供目前指示性匯率、貨幣換算和歷史觀測值。"
url: "https://narwhalapi.com/zh-tw/api/fx"
---

所有 API

# 匯率 API

透過 REST 或 MCP 取得目前匯率。同一個 API 金鑰可用於金額換算及查詢已儲存的歷史匯率。每月免費 10 美元，無需綁卡。

[取得免費 API 金鑰](https://narwhalapi.com/zh-tw/signup)
[閱讀文件 →](https://narwhalapi.com/zh-tw/docs/api/fx.md)

## 首次請求

### 取得目前匯率

```
curl --request GET \
  --url "https://api.narwhalapi.com/v1/fx/rates/USD?currencies=EUR,JPY" \
  --header "Authorization: Bearer $NARWHAL_API_KEY"
```

回應範例

```
{
  "base": "USD",
  "market_session": "open",
  "rates": [
    {
      "currency": "EUR",
      "rate": "0.9200",
      "timestamp": "2026-08-22T06:29:41Z",
      "stale": false
    },
    {
      "currency": "JPY",
      "rate": "147.23",
      "timestamp": "2026-08-22T06:29:39Z",
      "stale": false
    }
  ]
}
```

### 將美元兌換為韓元

```
curl --request GET \
  --url "https://api.narwhalapi.com/v1/fx/convert?from=USD&to=KRW&amount=100.00" \
  --header "Authorization: Bearer $NARWHAL_API_KEY"
```

回應範例

```
{
  "from": "USD",
  "to": "KRW",
  "rate": "1330.99",
  "converted": "133099",
  "market_session": "open",
  "timestamp": "2026-11-12T06:45:46.265344Z",
  "stale": false
}
```

### 換算金額

```
curl --request GET \
  --url "https://api.narwhalapi.com/v1/fx/convert?from=USD&to=JPY&amount=100.00" \
  --header "Authorization: Bearer $NARWHAL_API_KEY"
```

回應範例

```
{
  "from": "USD",
  "to": "JPY",
  "rate": "159.200",
  "converted": "15920",
  "market_session": "open",
  "timestamp": "2026-11-20T05:54:38.708502Z",
  "stale": false
}
```

### 取得歷史匯率

```
curl --request GET \
  --url "https://api.narwhalapi.com/v1/fx/rates/USD/observations?currencies=EUR,NZD&start_date=2026-08-20&end_date=2026-08-28&limit=100" \
  --header "Authorization: Bearer $NARWHAL_API_KEY"
```

回應範例

```
{
  "base": "USD",
  "observations": [
    {
      "date": "2026-08-20",
      "rates": [
        {
          "currency": "EUR",
          "rate": "0.85609"
        },
        {
          "currency": "NZD",
          "rate": "1.681"
        }
      ]
    }
  ],
  "next_cursor": null
}
```

## 端點

GET 取得目前匯率`/v1/fx/rates/{base}`

某一種基準貨幣的目前匯率。用來顯示價格或匯率表。

#### 參數

- `base` 必填 基準貨幣，使用大寫的 ISO 4217 代碼。
- `currencies` 選填 以逗號分隔的 1 到 64 種不同報價貨幣。省略則回傳所有受支援的報價貨幣。

#### 回應欄位

- `base` 字串 基準貨幣。
- `market_session` 字串 市場是開市、週末還是處於交易時段之間的休市。
- `rates` 陣列 每種報價貨幣一筆記錄。
- `rates[].currency` 字串 報價貨幣。
- `rates[].rate` 字串 1 單位基準貨幣折合多少報價貨幣，以十進位字串表示。
- `rates[].timestamp` 日期時間 此匯率的時間。
- `rates[].stale` 布林值 此匯率是否已過時。

---

[完整參考文件 →](https://narwhalapi.com/zh-tw/docs/api/fx/rates.md)

GET 換算金額`/v1/fx/convert`

使用一個選定匯率換算正數金額。The result is rounded once, to the target currency’s minor unit.

#### 參數

- `from` 必填 來源貨幣。
- `to` 必填 目標貨幣。必須與 from 不同。
- `amount` 必填 正的十進位字串，最大 1000000000000。

#### 回應欄位

- `from` 字串 來源貨幣。
- `to` 字串 目標貨幣。
- `rate` 字串 所用匯率。
- `converted` 字串 換算後的金額，以十進位字串表示。
- `market_session` 字串 市場是開市、週末還是處於交易時段之間的休市。
- `timestamp` 日期時間 匯率的時間。
- `stale` 布林值 匯率是否已過時。

---

[完整參考文件 →](https://narwhalapi.com/zh-tw/docs/api/fx/conversion.md)

GET 取得歷史匯率`/v1/fx/rates/{base}/observations`

按日期順序分頁回傳已儲存的匯率。沒有儲存匯率的日期會被略去，絕不會補上資料。

#### 參數

- `base` 必填 基準貨幣，使用大寫的 ISO 4217 代碼。
- `currencies` 必填 以逗號分隔的 1 到 64 種不同報價貨幣。其中不能包含基準貨幣。
- `start_date` 必填 第一天，不早於 1971-01-01。包含當天。
- `end_date` 必填 最後一天，不早於 start_date，且不能在未來。包含當天。
- `limit` 選填 每page.日期The default is 100 and the most is 366.
- `cursor` 選填 沿用上一頁回傳的 next_cursor，並使用相同的篩選條件。

#### 回應欄位

- `base` 字串 基準貨幣。
- `observations` 陣列 每個日期一筆記錄，附帶為該日儲存的匯率。
- `next_cursor` 字串 下一頁的游標。最後一頁為 Null。

---

[完整參考文件 →](https://narwhalapi.com/zh-tw/docs/api/fx/history.md)

## 使用情境

### 過去某一天的匯率

取得某一天的匯率，並處理沒有匯率的日子。

[閱讀指南 →](https://narwhalapi.com/zh-tw/how-to/get-an-exchange-rate-on-a-past-date.md)

### 發票日期的匯率

換算有日期的發票，並處理週末和貨幣方向。

[閱讀指南 →](https://narwhalapi.com/zh-tw/how-to/find-the-exchange-rate-on-an-invoice-date.md)

### 交叉匯率

由兩個美元報價算出 EUR 兌 IDR。

[閱讀指南 →](https://narwhalapi.com/zh-tw/how-to/calculate-a-cross-rate.md)

### 月平均匯率

為你的帳目計算一個月內每日匯率的平均值。

[閱讀指南 →](https://narwhalapi.com/zh-tw/how-to/calculate-a-monthly-average-exchange-rate.md)

### 每日資料拉取

每天執行一次小腳本，把匯率附加到 CSV 檔案。

[閱讀指南 →](https://narwhalapi.com/zh-tw/how-to/schedule-a-daily-data-pull.md)

## 涵蓋範圍

- [USD → IDR](https://narwhalapi.com/zh-tw/fx/usd-idr.md)
- [USD → INR](https://narwhalapi.com/zh-tw/fx/usd-inr.md)
- [GBP → INR](https://narwhalapi.com/zh-tw/fx/gbp-inr.md)
- [AED → INR](https://narwhalapi.com/zh-tw/coverage.md#fx)
- [USD → PHP](https://narwhalapi.com/zh-tw/fx/usd-php.md)
- [EUR → INR](https://narwhalapi.com/zh-tw/fx/eur-inr.md)
- [USD → PKR](https://narwhalapi.com/zh-tw/coverage.md#fx)
- [USD → AUD](https://narwhalapi.com/zh-tw/fx/usd-aud.md)
- [GBP → USD](https://narwhalapi.com/zh-tw/fx/gbp-usd.md)
- [CAD → USD](https://narwhalapi.com/zh-tw/fx/cad-usd.md)
- [SAR → INR](https://narwhalapi.com/zh-tw/coverage.md#fx)
- [AED → PKR](https://narwhalapi.com/zh-tw/coverage.md#fx)

Show all 24 pairs

- [USD → NGN](https://narwhalapi.com/zh-tw/coverage.md#fx)
- [KWD → INR](https://narwhalapi.com/zh-tw/coverage.md#fx)
- [SAR → PKR](https://narwhalapi.com/zh-tw/coverage.md#fx)
- [AED → PHP](https://narwhalapi.com/zh-tw/coverage.md#fx)
- [USD → AED](https://narwhalapi.com/zh-tw/coverage.md#fx)
- [AUD → PKR](https://narwhalapi.com/zh-tw/coverage.md#fx)
- [GBP → PKR](https://narwhalapi.com/zh-tw/coverage.md#fx)
- [EUR → USD](https://narwhalapi.com/zh-tw/fx/eur-usd.md)
- [USD → MXN](https://narwhalapi.com/zh-tw/fx/usd-mxn.md)
- [EUR → GBP](https://narwhalapi.com/zh-tw/fx/eur-gbp.md)
- [OMR → INR](https://narwhalapi.com/zh-tw/coverage.md#fx)
- [QAR → INR](https://narwhalapi.com/zh-tw/coverage.md#fx)

## 相關 API

### 現貨金屬價格 API

黃金、白銀、鉑金和鈀金的現貨價格，以及 WTI、布蘭特和銅的參考價格。

[探索 API →](https://narwhalapi.com/zh-tw/api/commodities/spot.md)

### 國定假日 API

按國家列出的官方公共假日，區分全國與地區範圍。

[探索 API →](https://narwhalapi.com/zh-tw/api/calendars/holidays.md)

### 價格

預付額度，每1,000次呼叫2美元，沒有方案或級別。

[查看價格 →](https://narwhalapi.com/zh-tw/pricing.md)

## 常見問題

FX 匯率是什麼意思？

一單位的基準貨幣可兌換回傳金額所示的報價貨幣。

支援哪些貨幣？

144 種貨幣。涵蓋範圍頁面列出了每一種。

API 是否包含歷史匯率？

是。歷史資料使用實際儲存的日期、每頁有大小限制的分頁，以及不透明游標。

週末會發生什麼？

最新接受的匯率可能仍會連同時間戳、stale 狀態和週末市場時段一起提供。缺少的發布日期不會用合成匯率填補。

有免費額度嗎？

可以。每個帳戶每月可免費獲得 10 美元，匯率介面每 1,000 次呼叫 2 美元。 [查看價格](https://narwhalapi.com/zh-tw/pricing.md).

這些是可直接成交的交易商報價嗎？

不是。匯率和換算結果僅供參考，不是交易商報價或官方定盤價。

## 從免費金鑰開始

每月 10 美元免費額度，無需綁卡。每月 10 美元免費額度，無需綁卡。

[取得免費 API 金鑰](https://narwhalapi.com/zh-tw/signup)
