U.S. Department of the Treasury Exchange Rates API — ustreasury-exchange-rate
Official U.S. Department of the Treasury (the United States) quarterly exchange rates for Node.js and TypeScript. The published tax authority rates behind tax filings, customs valuations, audits, and compliant invoicing — not market estimates, but the numbers U.S. Department of the Treasury itself prints, every quarter.
🚀 Why this client?
- 🏛️ Official published rates — U.S. Department of the Treasury's own table, with the publisher's own
rate_date on every response
- 📅 History back to 2001 — point-in-time tables and daily series for any past date
- 🔀 Published vs derived, always flagged — computed inverse/cross pairs carry
derived: true, never mixed with official prints
- ⚡ Zero dependencies — pure ESM + CJS over global
fetch; Node 18+, Bun, Deno, and edge runtimes
- 🔷 Type-safe — full TypeScript definitions shipped with the package
- 🧾 Compliance-grade metadata —
rate_type, publication date, and source disclaimer on every response
Official rate, not mid-market: every value here is a number U.S. Department of the Treasury itself published, fixed once printed and carrying the tax authority's own rate_date — what filings and audits require. Need the live mid-market rate for pricing or display instead? Use the mid-market API or @allratestoday/sdk. The two can diverge by several percent.
🔑 Get your API key
Get a free API key at allratestoday.com/register — no credit card required. Latest rates are on every plan, including free.
📈 Latest published table
The image is rendered live from the keyless endpoint, so it follows the tax authority's publications on npm and on GitHub alike without a new release. The same table as text is folded below for search and copy-paste: on GitHub a daily Action refreshes it whenever the tax authority publishes a new table; on npm it is as of the package's publish date.
| Base | Quote | Type | Rate |
|---|
| USD | AED | quarterly | 3.673 |
| USD | AFN | quarterly | 65.15 |
| USD | ALL | quarterly | 80.75 |
| USD | AMD | quarterly | 360 |
| USD | AOA | quarterly | 913 |
| USD | ARS | quarterly | 1545 |
| USD | AUD | quarterly | 1.435 |
| USD | AZN | quarterly | 1.7 |
| USD | BAM | quarterly | 1.722 |
| USD | BBD | quarterly | 2.02 |
| USD | BDT | quarterly | 124 |
| USD | BGN | quarterly | 0.87 |
| USD | BHD | quarterly | 0.377 |
| USD | BIF | quarterly | 3443 |
| USD | BMD | quarterly | 1 |
| USD | BND | quarterly | 1.277 |
| USD | BOB | quarterly | 11.96 |
| USD | BRL | quarterly | 5.205 |
| USD | BSD | quarterly | 1 |
| USD | BWP | quarterly | 13.889 |
| USD | BYN | quarterly | 3.029 |
| USD | BZD | quarterly | 2 |
| USD | CAD |
Full table on the U.S. Department of the Treasury rates page · Source: Official rates published by USTREASURY, served by AllRatesToday. Rates are as printed by the tax authority; AllRatesToday is not affiliated with it.
📦 Installation
npm install ustreasury-exchange-rate
yarn add ustreasury-exchange-rate
pnpm add ustreasury-exchange-rate
Requires Node 18+ (global fetch); also runs on Bun, Deno and edge runtimes. Also published under the org scope as @allratestoday/ustreasury-exchange-rate — same code, same versions.
🏁 Quick start
import { getRate } from 'ustreasury-exchange-rate';
const pair = await getRate('USD', 'EUR', { apiKey: 'art_live_...' });
console.log(pair.rate, pair.rate_date); // the official U.S. Department of the Treasury rate, on the tax authority's own date
📚 API reference
Latest pair rate
Free plan and up. Pairs the tax authority does not print directly are resolved from its table and flagged (see Published vs derived rates below).
const pair = await getRate('USD', 'EUR', { apiKey: 'art_live_...' });
Response:
{
bank: 'ustreasury',
name: 'U.S. Department of the Treasury',
rate_date: '2026-09-30', // U.S. Department of the Treasury's own publication date
source: 'USD',
target: 'EUR',
rate: 0.881,
rate_type: 'quarterly',
derived: false,
method: 'published',
disclaimer: 'Official rates as published by the named central bank. On weekends/holidays the most recent published rate_date is returned.'
}
Full published table
Free plan and up. The complete table for the latest publication date.
import { getLatestRates } from 'ustreasury-exchange-rate';
const table = await getLatestRates({ apiKey: 'art_live_...' });
console.log(table.rate_date, table.rates.length);
Response:
{
bank: 'ustreasury',
name: 'U.S. Department of the Treasury',
rate_date: '2026-09-30',
rates: [
{ "base": "USD", "quote": "EUR", "type": "quarterly", "value": 0.881 },
// … the rest of the published table (145 currencies vs USD)
],
disclaimer: '…'
}
Table for a date
Paid plans. The official table for any date since 2001 — weekends and holidays return the most recent published date, flagged via published_on_requested_date, which is exactly the in-force rate a filing needs.
import { getRatesForDate } from 'ustreasury-exchange-rate';
const day = await getRatesForDate('2026-06-30', { apiKey: 'art_live_...' });
// Optionally narrow to one pair:
const one = await getRatesForDate('2026-06-30', { apiKey: 'art_live_...', source: 'USD', target: 'EUR' });
Response:
{
bank: 'ustreasury',
requested_date: '2026-06-30',
rate_date: '2026-06-30', // the date actually published
published_on_requested_date: true, // false when a weekend/holiday fell back
rates: [ /* the full table for that date */ ],
disclaimer: '…'
}
Daily time series
Paid plans. One resolved rate per publication date — ready for charting, revaluation runs, or audit workpapers.
import { getHistory } from 'ustreasury-exchange-rate';
const series = await getHistory(
{ source: 'USD', target: 'EUR', from: '2026-01-01', to: '2026-09-30' },
{ apiKey: 'art_live_...' }
);
Response:
{
bank: 'ustreasury',
source: 'USD',
target: 'EUR',
from: '2026-01-01',
to: '2026-09-30',
count: 152,
rates: [
// one entry per publication date
{ date: '2026-09-30', rate: 0.881, rate_type: 'quarterly', derived: false, method: 'published' },
// …
],
disclaimer: '…'
}
Pass { symbol: 'EUR' } instead of source/target to get the raw published rows for one currency (all rate types, no pair resolution).
🗺️ Currencies covered
U.S. Department of the Treasury currently publishes rates covering 145 currencies against the USD (as of the latest table):
🇦🇪 AED · 🇦🇫 AFN · 🇦🇱 ALL · 🇦🇲 AMD · 🇦🇴 AOA · 🇦🇷 ARS · 🇦🇺 AUD · 🇦🇿 AZN · 🇧🇦 BAM · 🇧🇧 BBD · 🇧🇩 BDT · 🇧🇬 BGN · 🇧🇭 BHD · 🇧🇮 BIF · 🇧🇲 BMD · 🇧🇳 BND · 🇧🇴 BOB · 🇧🇷 BRL · 🇧🇸 BSD · 🇧🇼 BWP · 🇧🇾 BYN · 🇧🇿 BZD · 🇨🇦 CAD · 🇨🇩 CDF · 🇨🇭 CHF · 🇨🇱 CLP · 🇨🇳 CNY · 🇨🇴 COP · 🇨🇷 CRC · 🇨🇺 CUC · 🇨🇺 CUP · 🇨🇻 CVE · 🇨🇿 CZK · 🇩🇯 DJF · 🇩🇰 DKK · 🇩🇴 DOP · 🇩🇿 DZD · 🇪🇬 EGP · 🇪🇷 ERN · 🇪🇹 ETB · 🇪🇺 EUR · 🇫🇯 FJD · 🇬🇧 GBP · 🇬🇪 GEL · 🇬🇭 GHS · 🇬🇲 GMD · 🇬🇳 GNF · 🇬🇹 GTQ · 🇬🇾 GYD · 🇭🇰 HKD · 🇭🇳 HNL · 🇭🇹 HTG · 🇭🇺 HUF · 🇮🇩 IDR · 🇮🇱 ILS · 🇮🇳 INR · 🇮🇶 IQD · 🇮🇷 IRR · 🇮🇸 ISK · 🇯🇲 JMD · 🇯🇴 JOD · 🇯🇵 JPY · 🇰🇪 KES · 🇰🇬 KGS · 🇰🇭 KHR · 🇰🇲 KMF · 🇰🇷 KRW · 🇰🇼 KWD · 🇰🇾 KYD · 🇰🇿 KZT · 🇱🇦 LAK · 🇱🇧 LBP · 🇱🇰 LKR · 🇱🇷 LRD · 🇱🇸 LSL · 🇱🇾 LYD · 🇲🇦 MAD · 🇲🇩 MDL · 🇲🇬 MGA · 🇲🇰 MKD · 🇲🇲 MMK · 🇲🇳 MNT · 🇲🇷 MRU · 🇲🇺 · 🇲🇻 · 🇲🇼 · 🇲🇽 · 🇲🇾 · 🇲🇿 · 🇳🇦 · 🇳🇬 · 🇳🇮 · 🇳🇴 · 🇳🇵 · 🇳🇿 · 🇴🇲 · 🇵🇪 · 🇵🇬 · 🇵🇭 · 🇵🇰 · 🇵🇱 · 🇵🇾 · 🇶🇦 · 🇷🇴 · 🇷🇸 · 🇷🇺 · 🇷🇼 · 🇸🇦 · 🇸🇧 · 🇸🇨 · 🇸🇩 · 🇸🇪 · 🇸🇬 · 🇸🇱 · 🇸🇴 · 🇸🇷 · 🇸🇸 · 🇸🇹 · 🇸🇾 · 🇸🇿 · 🇹🇭 · 🇹🇯 · 🇹🇲 · 🇹🇳 · 🇹🇴 · 🇹🇷 · 🇹🇹 · 🇹🇼 · 🇹🇿 · 🇺🇦 · 🇺🇬 · 🇺🇾 · 🇺🇿 · 🇻🇪 · 🇻🇳 · 🇻🇺 · 🇼🇸 · · · · · 🇾🇪 · 🇿🇦 · 🇿🇲 · 🇿🇼
🏛️ Source
The U.S. Department of the Treasury publishes the Treasury Reporting Rates of Exchange each quarter, through its Bureau of the Fiscal Service. Every US government agency must use these rates to convert foreign-currency balances into dollars for official reports — and contractors, grant recipients, and auditors follow the same table. Rates are amended mid-quarter when a currency moves sharply.
🧭 Reading the numbers
value is always quote currency per 1 unit of base currency (base: "EUR", quote: "USD", value: 1.15 means 1 EUR = 1.15 USD).
- U.S. Department of the Treasury quotes foreign currency per 1 USD (e.g.
base: "USD", quote: "USD" means USD per one USD).
- Need the other way round? Ask
getRate(target, source) and the API inverts or crosses for you, flagged derived: true — never divide a published rate yourself in a compliance workflow.
rate_type tells you which of the tax authority's series a row belongs to (quarterly here); some publishers print buy/sell or several fixings for the same pair.
🧩 ERP & accounting systems
Loading the official U.S. Department of the Treasury rate into an accounting system is a supported workflow, not a hack. Step-by-step guides with the direction each system expects:
The same keyed endpoints return ?format=csv, ?format=xml and ?format=xlsx, and accept the key as ?api_key= on the URL for importers that cannot send headers:
curl "https://allratestoday.com/api/v1/central-bank/ustreasury/latest?format=xml&api_key=art_live_..."
🤖 AI agents
- MCP server:
npx -y @allratestoday/central-bank-mcp (stdio) or the hosted endpoint https://allratestoday.com/api/mcp — tools for official rates, history, cross-bank comparison and publication calendars
- Already using the general SDK or MCP server? Since 2026-10-01
@allratestoday/sdk 1.4+ has officialRates('ustreasury') and @allratestoday/mcp-server 0.6+ has a get_official_rates tool — both return this source's latest table with no key, so you can add it without a second dependency
- Claude Code plugin (no key):
/plugin marketplace add AllRates-Today/claude-code-plugin then /plugin install allratestoday@allratestoday — bundles both MCP servers plus an /official-rate ustreasury ... command
- Evaluating? Agents can self-issue a trial key with no signup:
POST https://allratestoday.com/api/agent/keys (send Content-Type: application/json) returns a 100-call key valid 7 days that covers the free-plan methods (latest table, pairs); dated tables and history need a paid plan. The MCP servers expose it as request_trial_key
- Machine-readable site guide: llms.txt · for-ai-agents
⚖️ Published vs derived rates
If U.S. Department of the Treasury does not print a pair directly, the API resolves it from the tax authority's own table and says so — official and computed values are never confused:
method | derived | Meaning |
|---|
published | false | The tax authority printed this pair directly |
inverse | true | Computed as 1 ÷ the published opposite direction |
cross | true | Computed via USD from two published rates |
🛡️ Error handling
Errors are thrown as Error with status (HTTP code) and body (the API's JSON error) attached:
try {
const pair = await getRate('USD', 'XXX', { apiKey: 'art_live_...' });
} catch (err) {
console.log(err.message); // human-readable reason
console.log(err.status); // e.g. 404
}
| Status | Meaning |
|---|
| — | Missing apiKey (thrown before any request) |
400 | Malformed date or parameters |
401 | Invalid API key |
403 | Endpoint needs a paid plan (historical dates & series) |
404 | Pair or date range not covered by U.S. Department of the Treasury |
429 | Monthly quota exceeded |
🔷 TypeScript
Full definitions ship with the package — no @types install:
import type { LatestRates, PairRate, DatedRates, RateEntry, HistoryQuery, RequestOptions } from 'ustreasury-exchange-rate';
📦 CommonJS
const { getRate } = require('ustreasury-exchange-rate');
getRate('USD', 'EUR', { apiKey: 'art_live_...' }).then((pair) => console.log(pair.rate));
💡 Quota tips
- Rates change once a quarter — cache the published table locally and a small monthly quota goes a long way.
- Every request counts toward your AllRatesToday quota, shared across all AllRatesToday endpoints on your key.
📖 Methods reference
| Method | Plan | Description |
|---|
getRate(source, target, { apiKey }) | Free | Latest rate for one pair, resolved from the published table |
getLatestRates({ apiKey }) | Free | The tax authority's full latest published table |
getRatesForDate(date, { apiKey, source?, target? }) | Paid | The official table (or one pair) for a YYYY-MM-DD date |
getHistory({ symbol | source+target, from?, to? }, { apiKey }) | Paid | Daily series since 2001 |
📥 Bulk data (no key)
Need the whole archive rather than an API call? The same published tables are mirrored daily as open data:
🔗 Links
📜 License
MIT