dataseries.orgbeta
← Home

Libraries & APIs

There are several ways to get data out of dataseries. They all read the same published files, so the numbers are identical no matter which one you use. Pick whichever fits your workflow.

JSON API

A small read-only HTTP API. Base URL https://dataseries.org. No key required.

EndpointReturns
GET /catalogthe full list of datasets (id, title, source, license, frequency, span, last updated)
GET /dataset/{id}/metaone dataset's metadata: dimensions, levels, labels, units, hierarchy
GET /series?dataset={id}&dims={spec}&from={date}&to={date}the selected series as columnar JSON
GET /series.csv?dataset={id}&dims={spec}&from={date}&to={date}the same selection as tidy CSV (one row per observation), readable by any tool that opens a CSV URL
GET /healthservice status

dims selects levels within each dimension, semicolon-separated, e.g. structure=gdp;type=nom;seas_adj=csa. Omit dims for the whole dataset. from/to are optional ISO dates.

# Whole catalog
curl https://dataseries.org/catalog

# SECO GDP, nominal, seasonally adjusted, from 2000
curl "https://dataseries.org/series?dataset=ch_seco_gdp&dims=structure=gdp;type=nom;seas_adj=csa&from=2000-01-01"

# A single-series dataset
curl "https://dataseries.org/series?dataset=ch_kof_barometer"

Interactive API docs: browse the endpoints and try them in the browser at /__docs__/. The OpenAPI spec is at /openapi.json.

R

The dataseries package, which revives the original CRAN name, is the easiest way in: ds() takes a dataset id plus one named argument per dimension and returns a tidy data frame (the date column is already a Date). Use ds_catalog() to list datasets, ds_meta() for a dataset's dimensions and codes, and ds_search() to find individual series. Prefer no dependency? The JSON API above reads just as well with httr2.

install.packages("dataseries")
library(dataseries)

# SECO GDP, nominal, seasonally adjusted, from 2000
df <- ds("ch_seco_gdp", structure = "gdp", type = "nom", seas_adj = "csa",
         from = "2000-01-01")

# A single-series dataset: no dimension arguments
df <- ds("ch_kof_barometer")

Python

The same interface as R, returning a pandas DataFrame. Dimensions are keyword arguments; lang gets you German, French or Italian labels.

pip install dataseries
from dataseries import ds

# SECO GDP, nominal, seasonally adjusted, from 2000
df = ds("ch_seco_gdp", structure="gdp", type="nom", seas_adj="csa",
        start="2000-01-01")

# A single-series dataset: no dimension arguments
df = ds("ch_kof_barometer")

Prefer to skip the wrapper? The API is a plain GET: requests.get("https://dataseries.org/series", params={"dataset": "ch_seco_gdp"}).json() returns column-oriented JSON that maps straight into pandas or polars.

Any other tool: one CSV URL

You don't need a dedicated package. Because /series.csv returns a tidy CSV over plain HTTP, any tool that can open a URL reads a series directly, with your dims, from and to filters already applied server-side, so you pull only what you need. Each dataset's Use this series card generates the exact snippet below for your current selection; copy and paste.

# Stata
import delimited "https://dataseries.org/series.csv?dataset=ch_seco_gdp&dims=structure=gdp;type=nom;seas_adj=csa", clear

# MATLAB
T = readtable("https://dataseries.org/series.csv?dataset=ch_kof_barometer");

# Julia
using CSV, DataFrames, Downloads
df = CSV.read(Downloads.download("https://dataseries.org/series.csv?dataset=ch_kof_barometer"), DataFrame)

# Excel / Power Query: Data > Get Data > From Web, then paste the URL (refreshes in place)
https://dataseries.org/series.csv?dataset=ch_kof_barometer

# SAS
filename ds url "https://dataseries.org/series.csv?dataset=ch_kof_barometer";
proc import file=ds out=work.ds dbms=csv replace; run;

# curl / shell
curl "https://dataseries.org/series.csv?dataset=ch_kof_barometer"

This is deliberate: rather than build and maintain a wrapper for every language, we keep the data behind one documented URL and let each tool's own CSV reader do the rest. The R and Python packages exist for convenience (catalog search, tidy reshaping); everything else is a one-liner.

Downloads: CSV, Excel, JSON

Every series view offers a direct download of your current selection (with any transform applied) as CSV, Excel or JSON, plus PNG/SVG of the chart. For bulk use, the complete per-dataset files (one tidy long CSV, a JSON metadata sidecar and a Parquet copy) live in the public dataseries-data repository and can be fetched by URL.

Embeddable charts

Drop a live, interactive chart of any series into a web page with an iframe. Each series view's Use this series → Embed tab generates the exact snippet for your current selection, dimensions and transform and title included.

<iframe
  src="https://dataseries.org/d/ch_kof_barometer?embed=1"
  width="100%" height="580" style="border:0;border-radius:12px"
  loading="lazy" title="KOF Barometer, dataseries.org">
</iframe>

The embedded chart updates automatically when the underlying data is refreshed. For a static picture instead, use the PNG or SVG download on any chart.