# US Treasury Rates of Exchange API
> The official US government foreign-exchange rates, served live from the US Treasury's FiscalData API — no key, nothing cached. These are the rates the federal government uses to convert foreign-currency balances into US dollars for reporting, and US companies use them for tax and compliance; they are published every quarter for around 168 currencies and go back two decades. The rates endpoint returns the whole quarterly set — every country and currency with its rate to one US dollar (the euro near 0.87, the yen near 159) — and accepts a date to pull any past quarter. The currency endpoint returns one currency's official rate with its history quarter by quarter, looked up by ISO code, country or currency name. The convert endpoint turns an amount from any currency into any other, crossed through the US dollar at the official Treasury rate. Everything is the Treasury's own published data, live, nothing stored; rates are quarterly and authoritative for accounting, not a live market quote. This is the official FX layer for any accounting, tax-compliance, treasury, government-contracting or historical-FX app. Distinct from central-bank and market FX APIs — this is the US Treasury's quarterly reporting rates of exchange. 4 endpoints, no key on our side.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/treasuryfx-api/..."
```

## Pricing
- **Free** (Free) — 2,200 calls/Mo, 2 req/s
- **Starter** ($9/Mo) — 32,000 calls/Mo, 6 req/s
- **Pro** ($25/Mo) — 175,000 calls/Mo, 15 req/s
- **Mega** ($60/Mo) — 920,000 calls/Mo, 40 req/s

## Endpoints

### Treasury

#### `GET /v1/convert` — Convert between currencies via USD

**Parameters:**
- `from` (query, required, string) — Source ISO code Example: `EUR`
- `to` (query, required, string) — Target ISO code Example: `GBP`
- `amount` (query, optional, string) — Amount (default 1) Example: `100`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/treasuryfx-api/v1/convert?from=EUR&to=GBP&amount=100"
```

**Response:**
```json
{
    "data": {
        "to": "GBP",
        "via": "USD",
        "from": "EUR",
        "note": "crossed through USD at the US Treasury quarterly reporting rate",
        "rate": 0.868966,
        "amount": 100,
        "result": 86.896552,
        "source": "US Treasury (FiscalData)",
        "to_per_usd": 0.756,
        "record_date": "2026-03-31",
        "from_per_usd": 0.87
    },
    "meta": {
        "timestamp": "2026-06-09T11:38:08.180Z",
        "request_id": "04210349-cc12-4786-971c-134f2150b7f9"
    },
    "status": "ok",
    "message": "Conversion retrieved successfully",
    "success": true
}
```

#### `GET /v1/currency` — One currency official rate + history

**Parameters:**
- `code` (query, required, string) — ISO code (or use q= for name) Example: `EUR`
- `history` (query, optional, string) — Number of past quarters (default 8) Example: `4`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/treasuryfx-api/v1/currency?code=EUR&history=4"
```

**Response:**
```json
{
    "data": {
        "code": "EUR",
        "source": "US Treasury (FiscalData)",
        "country": "Euro Zone",
        "history": [
            {
                "record_date": "2026-03-31",
                "rate_per_usd": 0.87
            },
            {
                "record_date": "2025-12-31",
                "rate_per_usd": 0.851
            },
            {
                "record_date": "2025-09-30",
                "rate_per_usd": 0.852
            },
            {
                "record_date": "2025-06-30",
                "rate_per_usd": 0.853
            }
        ],
        "currency": "Euro",
        "frequency": "quarterly",
        "record_date": "2026-03-31",
        "rate_per_usd": 0.87,
        "country_currency": "Euro Zone-Euro"
    },
    "meta": {
        "timestamp": "2026-06-09T11:38:08.539Z",
        "request_id": "93133a29-f5f6-48f1-801b-d4bdb3abe44c"
    },
    "status": "ok",
    "message": "Currency retrieved successfully",
    "success": true
}
```

#### `GET /v1/rates` — Quarterly set — all currencies per USD

**Parameters:**
- `date` (query, optional, string) — YYYY-MM-DD for a past quarter

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/treasuryfx-api/v1/rates"
```

**Response:**
```json
{
    "data": {
        "base": "USD",
        "note": "rate_per_usd = units of the currency per 1 US dollar",
        "count": 168,
        "rates": [
            {
                "country": "Afghanistan",
                "currency": "Afghani",
                "rate_per_usd": 64.77,
                "country_currency": "Afghanistan-Afghani"
            },
            {
                "country": "Albania",
                "currency": "Lek",
                "rate_per_usd": 83.3,
                "country_currency": "Albania-Lek"
            },
            {
                "country": "Algeria",
                "currency": "Dinar",
                "rate_per_usd": 132.596,
                "country_currency": "Algeria-Dinar"
            },
            {
                "country": "Angola",
                "currency": "Kwanza",
                "rate_per_usd": 912.13,
                "country_currency": "Angola-Kwanza"
            },
            {
                "country": "Antigua & Barbuda",
                "currency": "East Caribbean Dollar",
                "rate_per_usd": 2.7,
                "country_currency": "Antigua & Barbuda-East Caribbean Dollar"
            },
            {
                "country": "Argentina",
                "currency": "Peso",
                "rate_per_usd": 1420,
                "country_currency": "Argentina-Peso"
            },
            {
                "country": "Armenia",
                "currency": "Dram",
                "rate_per_usd
…(truncated, see openapi.json for full schema)
```

### Meta

#### `GET /v1/meta` — Spec

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/treasuryfx-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "source": "US Treasury FiscalData — Rates of Exchange (live)",
        "service": "treasuryfx-api",
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/rates": "The quarterly set — all currencies per USD (date=YYYY-MM-DD for a past quarter).",
            "GET /v1/convert": "Convert between two currencies via USD (from=USD&to=EUR&amount=100).",
            "GET /v1/currency": "One currency's rate + history (code=EUR, or q=Japan)."
        },
        "description": "The official US government foreign-exchange rates from the US Treasury's FiscalData API — the quarterly Reporting Rates of Exchange used for federal reporting and US tax/compliance, ~168 currencies back two decades. The rates endpoint returns the whole quarterly set (every currency's rate to one US dollar, any past quarter by date); the currency endpoint returns one currency's official rate with quarter-by-quarter history (by ISO code, country or currency name); and the convert endpoint converts between any two currencies crossed through the US dollar. Live, no key, nothing stored; rates are quarterly and authoritative for accounting, not a live market quote. Distinct from central-bank and market FX APIs — this is the US Treasury's quarterly reporting rates of exchange.",
        "latest_quarter": "2026-03-31",
        "upstream_status": "ok",
        "iso_codes_supported": [
            "EUR",
            "GBP",
            "JPY",
            "C
…(truncated, see openapi.json for full schema)
```


---
Marketplace page: https://www.oanor.com/api/treasuryfx-api
OpenAPI spec: https://www.oanor.com/api/treasuryfx-api/openapi.json
