Currency Rates

1 min read Original article ↗

API

All rates are published as static JSON files. No authentication required. Base currency is CHF (Swiss franc).

Endpoints

Latest rates

curl https://currency-rates.github.io/rates.json

Rates for a specific date

curl https://currency-rates.github.io/YYYY/MM/DD/rates.json

Metadata (date, currency names)

curl https://currency-rates.github.io/meta.json

Examples with fx

Get USD/CHF rate

curl -s https://currency-rates.github.io/rates.json | fx .USD

Convert 100 USD to EUR

curl -s https://currency-rates.github.io/rates.json | fx 'x => 100 / x.USD * x.EUR'

Interactive exploration

curl -s https://currency-rates.github.io/rates.json | fx

Response format

rates.json returns an object mapping currency codes to their exchange rate relative to CHF:

{
  "EUR": 1.0902,
  "USD": 1.2861,
  "GBP": 0.9465,
  "BTC": 0.00001808,
  ...
}

Rates are updated every 4 hours. Each rate is the median across multiple providers.

Used by numbr.dev — a smart calculator combined with a notepad.