认证与限额 数据接口支持匿名试用:每个 IP 每分钟 12 次、每小时 100 次。带密钥的请求使用账户月度额度。
bash · header COPY
Authorization: Bearer YOUR_KEY
X-RateLimit-Remaining: 9999
X-RateLimit-Reset: 1788220800 说明数据新鲜度的字段 `source` 表示来源类别,`market_session` 表示市场状态,`data_updated_at` 表示数值写入时间。建议全部保存。
接口 GET /v1/latest[/{BASE}]当前汇率,可返回全部或按 symbols 筛选。
GET /v1/{YYYY-MM-DD}[/{BASE}]指定日期和基准货币的历史快照。
GET /v1/convert/{FROM}/{TO}[/{AMOUNT}] · POST /v1/convert金额换算,支持单次 GET 和批量 POST。
GET /v1/rate/{slug}按 slug 返回单一货币对。
GET /v1/range每日时间序列,支持分页和下载。
GET /v1/currencies支持的货币列表,不接受参数。
GET /v1/account账户、套餐、当前密钥和本月用量。
错误 错误统一为 `{ result: "error", code, message }`。429 还会返回 `Retry-After`;数据源失败时不会悄悄改用模拟值。
json · error COPY
{
"result": "error",
"code": "missing_parameter",
"message": "missing required parameter: symbols"
} English complete field-by-field reference →
在你的技术栈中使用 同一个请求可用于 curl、Python 和 JavaScript。评估 API 无需密钥。
打开快速入门 → curl Python JavaScript / Node.js
复制代码 curl -fsS --max-time 10 "https://api.exchangerate.dev/v1/latest/USD?symbols=EUR,GBP" from urllib.request import Request, urlopen
import json
request = Request("https://api.exchangerate.dev/v1/latest/USD?symbols=EUR,GBP")
with urlopen(request, timeout=10) as response:
data = json.load(response)
print(data["rates"]["EUR"]) const response = await fetch("https://api.exchangerate.dev/v1/latest/USD?symbols=EUR,GBP", {
signal: AbortSignal.timeout(10_000),
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();
console.log(data.rates.EUR); 响应示例 {
"result": "success",
"base": "USD",
"source": "live",
"sources": {
"EUR": "live",
"GBP": "live"
},
"market_session": "open",
"timestamp": "2026-06-15T12:00:00Z",
"data_updated_at": "2026-06-15T12:00:00Z",
"effective_at": {
"EUR": "2026-06-15T12:00:00Z",
"GBP": "2026-06-15T12:00:00Z"
},
"rates": {
"EUR": 0.86207,
"GBP": 0.74627
},
"derived_symbols": [],
"notice": "Indicative rates, not for settlement."
} rates.EUR 表示 1 USD 对应的 EUR 数量。effective_at.EUR 是观测时间,sources.EUR 表示来源类别。数值和时间仅为示例。
Python → JavaScript / Node.js → Google Sheets → Excel → Go → Swift → Zapier →