Swiss National Bank Data Portal API
Free Swiss National Bank data API with no key: monthly CHF exchange rate averages back to 1999, plus the full SNB statistical cube catalogue as JSON or CSV.
Endpoint tested and returned HTTP 200 on 21 Aug 2026
What is the Swiss National Bank Data Portal API?
The Swiss National Bank data portal serves its published statistics as free JSON or CSV cubes at data.snb.ch, with no key or registration. The devkum cube returns monthly average CHF exchange rates going back to 1999 in one request.
The SNB models everything as a cube — a named dataset with dimensions you can slice — rather than as one endpoint per statistic. That takes a moment to get used to, but it means the same URL shape retrieves exchange rates, policy rates, monetary aggregates and balance of payments data. Swap the cube id and the rest of your code is unchanged.
Because a cube returns its full history by default, the monthly FX cube hands back more than twenty-five years of observations in a single response. That is genuinely useful for charting, and genuinely wasteful if you only wanted last month. Slice with the date parameters rather than fetching everything and discarding it, and read the `unit` in each series' metadata — the exchange rate cube is quoted at 11am Zurich time and says so.
Quick facts
- Base URL
https://data.snb.ch/api/cube- Authentication
- No key or registration. Published by the SNB as open statistical data.
- Rate limit
- No documented limit. Series update monthly or quarterly depending on the cube.
- Pricing
- Free.
- CORS
- Not enabled — call it from your server
- Official docs
- Read the docs
How to use the Swiss National Bank Data Portal API
Every request below was executed against the live API on 21 Aug 2026, and the response shown is the real body it returned — not an illustration.
1. Monthly average CHF exchange rates since 1999
GET https://data.snb.ch/api/cube/devkum/data/json/en
curl 'https://data.snb.ch/api/cube/devkum/data/json/en'const res = await fetch("https://data.snb.ch/api/cube/devkum/data/json/en");
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);import requests
res = requests.get("https://data.snb.ch/api/cube/devkum/data/json/en", timeout=20)
res.raise_for_status()
print(res.json()){
"timeseries": [
{
"header": [
{
"dim": "Monthly average/End of month",
"dimItem": "Monthly average"
},
{
"dim": "Currency",
"dimItem": "Europe - EUR 1"
}
],
"metadata": {
"key": "EPB@SNB.devkum{M0,EUR1}",
"frequency": "P1M",
"scale": "",
"unit": "Rates at 11 am. in CHF"
},
"values": [
{
"date": "1999-01",
"value": 1.6052
},
{
"date": "1999-02",
"value": 1.5983
},
{
"date": "1999-03",
"value": 1.5948
},
{
"date": "1999-04",
"value": 1.6019
},
{
"date": "1999-05",
"value": 1.6028
},
{
"date": "1999-06",
"value": 1.5948
},
{
"date": "1999-07",
"value": 1.6041
},
{
"date": "1999-08",
"value": 1.6003
},
{
"date": "1999-09",
"value": 1.6016
},
{
"date": "1999-10",
"value": 1.594
},
{
"date": "1999-11",
"value": 1.6049
},
{
"date": "1999-12",
"value": 1.6012
},
{
"date": "2000-01",
"value": 1.6097
},
{
"date": "2000-02",
"value": 1.6069
},
{
"date": "2000-03",
"value": 1.6046
},
{
"date": "2000Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
cube id | path segment | Required | Identifier of the SNB dataset, for example `devkum` for monthly average FX rates. devkum |
format | path segment | Required | `json` or `csv`. JSON gives typed values; CSV is easier to load into a spreadsheet. json |
lang | path segment | Required | `en`, `de`, `fr` or `it`, controlling dimension labels. en |
fromDate / toDate | query | Optional | Restrict the returned observations. Format matches the cube frequency, so `1999-01` for a monthly cube. 2026-01 |
dimSel | query | Optional | Select specific dimension members instead of the whole cube. D0(EUR1) |
Response fields
timeseries[]array- One entry per dimension combination in the cube — several currencies come back as several series.
timeseries[].headerarray- The dimension members that identify this series, each as a `dim` / `dimItem` pair.
timeseries[].metadata.keystring- Canonical series key such as `EPB@SNB.devkum{M0,EUR1}`, stable enough to store as an identifier.
timeseries[].metadata.frequencystring- ISO 8601 duration for the observation interval — `P1M` for monthly.
timeseries[].metadata.unitstring- What the numbers mean, including the quotation time for FX cubes.
timeseries[].values[]array- Observations as `date` / `value` pairs, oldest first.
What you can build with the Swiss National Bank Data Portal API
- Chart a long CHF exchange rate history without stitching together yearly files
- Pull Swiss policy rates and monetary aggregates through the same URL shape
- Export a cube as CSV for analysis in a spreadsheet
- Store `metadata.key` as a stable series identifier in your own database
Common errors and how to fix them
404
Unknown cube id.
Fix: Cube ids are lowercase and short, like `devkum` or `rendoblim`. Browse the data portal to confirm the id before hard-coding it.
Huge response
No date filter was applied.
Fix: Cubes return their entire history by default. Add `fromDate` and `toDate` in the cube's own period format.
Empty values array
The dimension selection matched no data.
Fix: Check `dimSel` member codes against the `header` block of an unfiltered response.
Swiss National Bank Data Portal API — frequently asked questions
Is the Swiss National Bank data API free?
Yes. data.snb.ch needs no key or account, and the SNB publishes its statistics as open data in JSON and CSV.
Which cube holds Swiss exchange rates?
`devkum` holds monthly averages and end-of-month values; other cubes cover daily rates and different periodicities. The cube list on the data portal is the authoritative index.
Does this API return daily CHF rates?
The monthly cube used in the example does not. The SNB publishes daily FX cubes separately, and the same URL shape retrieves them once you substitute the cube id.
Can I call the SNB API from the browser?
It does not return permissive CORS headers, so a direct front-end fetch is blocked. Proxy the request through your own backend and cache the result — these series change monthly at most.
Tools that pair with this API
CSV to JSON Converter
Convert CSV to a JSON array of objects online. Header-row detection, comma/semicolon/tab delimiters and pretty-printed output — 100% in your browser.
JSON Formatter
Format, beautify and minify JSON online with 2-space, 4-space or tab indentation. Sort keys alphabetically and catch syntax errors instantly — free and private.
Percentage Change Calculator
Work out the percentage increase or decrease between an old and a new value. See the absolute change and whether it went up or down, instantly and privately.
Alternatives to Swiss National Bank Data Portal API
If Swiss National Bank Data Portal does not fit, these finance & crypto apis cover similar ground. Every one was called before publishing, and each links to its own reference page with a working curl command and the response it returned.
| API | What it does | Auth | CORS | Last verified |
|---|---|---|---|---|
| CoinGecko | Free cryptocurrency price API covering 10,000+ coins. Live prices, market cap and volume in any currency, no API key on the public tier. Tested curl example. | No key | Yes | 19 Aug 2026 |
| Binance Public API | Binance public market data API needs no API key: live ticker prices, order books, klines and 24h stats for every trading pair. Tested curl example and response. | No key | Yes | 19 Aug 2026 |
| Coinbase Exchange Rates | Coinbase public exchange rates API with no key: convert any cryptocurrency to 100+ fiat currencies in a single request. Tested curl example and live JSON. | No key | Yes | 19 Aug 2026 |
| Frankfurter | Free currency exchange rate API with no key, built on European Central Bank data. Latest and historical rates, time series and conversion. Tested curl example. | No key | Yes | 19 Aug 2026 |
| Central Bank of Türkiye (TCMB) | Free Central Bank of Türkiye exchange rate feed with no key: official lira buying and selling rates, forex and banknote, for any working day back to 1996. | No key | No | 21 Aug 2026 |
| US Treasury Yield Curve | Free US Treasury daily yield curve feed with no key: par yields for every maturity from 1 month to 30 years, one XML document per month. Tested example and live response. | No key | Yes | 21 Aug 2026 |
Swiss National Bank Data Portal is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 21 Aug 2026; always check the official documentation before relying on this API in production, as terms and limits can change.