1. 2つのレートを取得する
パスのUSDがベース通貨、symbolsのEURとGBPが取得対象です。必要な通貨コードに置き換えてください。
curl -fsS --max-time 10 "https://api.exchangerate.dev/v1/latest/USD?symbols=EUR,GBP"from urllib.request import Request, urlopenimport json# Identify your application explicitly when calling the API.request = Request("https://api.exchangerate.dev/v1/latest/USD?symbols=EUR,GBP", headers={"User-Agent": "exchangerate-docs/1.0"})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);統合ガイド: Python · JavaScript / Node.js · Google Sheets · Excel · Go · Swift · Zapier
2. レスポンスを読む
数値は変わりますが構造は同じです。rates.EURを読み、source、market_session、data_updated_atも保存します。
json
{ "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 }, "stale": { "EUR": false, "GBP": false }, "derived_symbols": [], "notice": "Indicative rates, not for settlement."}3. アカウント枠が必要になったらキーを追加する
無料キーを作り、Authorization: Bearer YOUR_KEYで送ります。公開ブラウザーコードには置かず、サーバー側で保管してください。
bash
curl "https://api.exchangerate.dev/v1/latest/USD?symbols=EUR,GBP" \ -H "Authorization: Bearer YOUR_KEY"