API Reference

ALM DataHub API

Programmatic access to every series in the platform. Two endpoints cover almost every use case: POST /api/v1/lookup for batched scalar values, and GET /api/v1/range/{series} for time-series and cross-sections. The same endpoints back the Excel add-in, so anything Excel can do, your scripts can do.

For paste-ready Power Query snippets, see /docs/templates. For the auto-generated OpenAPI / Swagger reference, see /docs.

Authentication

Every request needs an Authorization: Bearer <token> header. Generate a personal token at Account → API Tokens. Tokens inherit your module permissions and can be revoked at any time.

Authorization: Bearer alm_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Endpoints

POST /api/v1/lookup

Resolve up to 500 scalar lookups in one round-trip. Each request supplies an opaque id echoed in the response. Per-request errors are reported in errors; the rest of the batch still resolves.

{
  "requests": [
    {"id": "a", "fn": "SONIA",   "args": {"date": "2024-03-15"}},
    {"id": "b", "fn": "GILT",    "args": {"tenor": 10, "date": "2024-03-15"}},
    {"id": "c", "fn": "FX",      "args": {"ccy": "USD", "date": "2024-03-15"}}
  ]
}

GET /api/v1/range/{series}

Bulk pull. Required args differ per series — see the function reference below. Add ?format=csv for a CSV download instead of JSON.

GET /api/v1/range/sonia?from=2024-01-01&to=2024-12-31
GET /api/v1/range/gilt?tenor=10&from=2024-01-01&to=2024-12-31
GET /api/v1/range/mortality?sex=male&period=2022-2024

Client examples

Worked example: fetch SONIA over a 1-year window. Replace $TOKEN with your token.

curl -H "Authorization: Bearer $TOKEN" \
     "https://almdatahub.com/api/v1/range/sonia?from=2024-01-01&to=2024-12-31"
import os
import pandas as pd
import requests

base = "https://almdatahub.com/api/v1"
headers = {"Authorization": f"Bearer {os.environ['ALM_TOKEN']}"}

resp = requests.get(
    f"{base}/range/sonia",
    params={"from": "2024-01-01", "to": "2024-12-31"},
    headers=headers,
    timeout=30,
)
resp.raise_for_status()
df = pd.DataFrame(resp.json()["rows"])
df["date"] = pd.to_datetime(df["date"])
print(df.tail())
library(httr)
library(jsonlite)

base <- "https://almdatahub.com/api/v1"
token <- Sys.getenv("ALM_TOKEN")

resp <- GET(
    paste0(base, "/range/sonia"),
    query = list(`from` = "2024-01-01", `to` = "2024-12-31"),
    add_headers(Authorization = paste("Bearer", token))
)
stop_for_status(resp)
rows <- fromJSON(content(resp, "text"))$rows
rows$date <- as.Date(rows$date)
tail(rows)
let
    Token = "alm_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    Url = "https://almdatahub.com/api/v1/range/sonia?from=2024-01-01&to=2024-12-31",
    Source = Json.Document(Web.Contents(Url, [
        Headers = [Authorization = "Bearer " & Token]
    ])),
    Rows = Source[rows],
    Table = Table.FromList(Rows, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    Expanded = Table.ExpandRecordColumn(Table, "Column1", {"date", "value"})
in
    Expanded

Function reference

All registered functions, grouped by source module. Each is callable via /api/v1/lookup (scalar) and most have a matching /api/v1/range/{name}.

boe curves

Function Scalar args Range args Unit
CURVE_DATES
List of dates that have a stored spot curve for the given curve type, most recent first. Useful for verifying availability before calling SW_FIT.
curve_type date
CURVE_TYPES
List of curve type codes available for Smith-Wilson fitting (GILT_NOMINAL, OIS, INFLATION, RFR_UK, …). Use as input to ALM.CURVE_DATES, ALM.LATEST_CURVE_DATE, or SW_FIT.
text
GILT
UK Gilt nominal rate at a given tenor (%) — spot by default; pass data_type='forward' for the forward curve.
tenor, date, data_type tenor, from, to, data_type %
INFLATION
UK Gilt inflation curve rate at a given tenor (%) — spot by default; pass data_type='forward' for the forward curve.
tenor, date, data_type tenor, from, to, data_type %
LATEST_CURVE_DATE
Most recent date that has a stored spot curve for the given curve type. Common pattern: =SW_FIT("GILT_NOMINAL", ALM.LATEST_CURVE_DATE("GILT_NOMINAL")). Returns an Excel date serial number; format the cell as a date.
curve_type no range date
OIS
SONIA OIS rate at a given tenor (%) — spot by default; pass data_type='forward' for the forward curve.
tenor, date, data_type tenor, from, to, data_type %
RFR
Risk-free rate spot at a given tenor and date (UK / EU / US / CA)
ccy, tenor, date ccy, tenor, from, to %
SW_CURVE
Smith-Wilson interpolated full curve to 60y at monthly tenors. Use `columns=spot|zcb|both` (default both).
curve_type, curve_date, columns, alpha, ufr, backfill mixed
SW_META
Smith-Wilson fit metadata: 8 rows of (label, value) covering alpha, ufr, llp, day_count, curve_type, and the actual curve_date used (which differs from the requested one when backfill resolves to an earlier date).
curve_type, curve_date, alpha, ufr, day_count, backfill mixed
SW_RATE
Smith-Wilson interpolated spot rate (%) from `curve_date` to `df_date`. Returns 0.0 for zero tenor, #N/A for df_date < curve_date.
curve_type, curve_date, df_date, alpha, ufr, day_count, backfill no range %
SW_ZCB
Smith-Wilson zero-coupon bond price (= discount factor) from `curve_date` to `df_date`. Returns 1.0 for zero tenor, #N/A for df_date < curve_date.
curve_type, curve_date, df_date, alpha, ufr, day_count, backfill no range price

boe rates

Function Scalar args Range args Unit
BANKRATE
Official Bank Rate as set by the MPC (%)
date from, to %
FX
Sterling spot exchange rate — units of given currency per 1 GBP.
ccy, date ccy, from, to rate
SONIA
Sterling Overnight Index Average — daily rate (%)
date from, to %
SONIA_INDEX
SONIA Compounded Index (BoE IUDZOS2)
date from, to index
STERLING_ERI
Sterling Effective Exchange Rate Index (BoE narrow trade-weighted, XUDLBK67)
date from, to index

meta

Function Scalar args Range args Unit
AVAILABLE_DATES
Dates with stored data for one canonical series, newest-first. Use ALM.AVAILABLE_SERIES() to list valid series names.
series date
AVAILABLE_SERIES
List of all canonical series available across the ALM DataHub API. Each row is one series — pass the `series` value to AVAILABLE_DATES, LATEST_DATE, or SERIES_INFO.
text
LATEST_DATE
Most recent date with stored data for a canonical series. Returns an Excel date serial — format the cell as a date. Equivalent to the first row of ALM.AVAILABLE_DATES.
series no range date
SERIES_INFO
Metadata block for a canonical series — N×2 vertical label/value table (same shape as SW_META). Fields: name, description, unit, category, source, frequency, first_date, latest_date, observations.
series mixed

ons data

Function Scalar args Range args Unit
CPI
Consumer Prices Index level
date from, to index
CPIH
CPI including Owner-Occupiers' Housing Costs
date from, to index
CPIH_YOY
CPIH year-on-year change (%)
date from, to %
CPI_YOY
CPI year-on-year change (%)
date from, to %
RPI
Retail Prices Index level
date from, to index
RPIX
RPI excluding Mortgage Interest Payments
date from, to index
RPIX_YOY
RPIX year-on-year change (%)
date from, to %
RPI_YOY
RPI year-on-year change (%)
date from, to %

ons life tables

Function Scalar args Range args Unit
LIFE_EXPECTANCY
ONS period life table remaining life expectancy (ex), in years
age, sex, period sex, period years
LIFE_PERIODS
List of ONS rolling-3-year periods that have stored life-table data, newest first. Discovery helper — useful for picking a valid period before calling MORTALITY / SURVIVORS / LIFE_EXPECTANCY / LIFE_TABLE.
text
LIFE_TABLE
Full ONS period life table (mx, qx, lx, dx, ex) for one (sex, period). One row per age 0–100.
sex, period mixed
MORTALITY
ONS period life table mortality probability (qx)
age, sex, period sex, period probability
SURVIVORS
ONS period life table number of survivors (lx) per 100,000 starting cohort
age, sex, period sex, period count

pra data

Function Scalar args Range args Unit
LATEST_PRA_DATE
Most recent PRA effective date stored for one (currency, sector). Returns an Excel date serial — format the cell as a date.
currency, sector no range date
PRA_COD
Cost-of-downgrade component (bps) of the PRA fundamental spread. Source: PRA fundamental-spread tables, Block 4.
rating, tenor, currency, sector, date no range bps
PRA_CQS_LABELS
CQS↔rating label mapping (0=AAA … 6=CCC). Discovery helper — useful as a reference table or to look up the agency label for a given CQS.
text
PRA_CURRENCIES
List of currencies stored in the PRA tables. Discovery helper — useful for verifying which currencies have data before calling other PRA functions.
text
PRA_DATES
List of PRA effective dates with stored data for one (currency, sector), newest first. Discovery helper — useful for picking a valid date before calling other PRA functions.
currency, sector text
PRA_FS
PRA fundamental spread (bps) for a credit-quality step, tenor, currency, sector, and effective date.
rating, tenor, currency, sector, date no range bps
PRA_FS_BREAKDOWN
PRA fundamental-spread breakdown for one (rating, currency, sector, date) — sweeps tenors and emits PD+CoD, 35%×LTAS, FS, and the binding component (PD + CoD vs LTAS Floor). Mirrors the website's FS Breakdown view.
rating, currency, sector, date mixed
PRA_LTAS
Long-term average spread (bps) used as the LTAS-floor input to the PRA fundamental spread (FS = max(PD_spread + CoD, 35% × LTAS)).
rating, tenor, currency, sector, date no range bps
PRA_PD_PROB
Probability of default (decimal, 0-1) underlying the PRA fundamental spread. Source: PRA fundamental-spread tables, Block 1.
rating, tenor, currency, sector, date no range probability
PRA_PD_SPREAD
PD-spread component (bps) of the PRA fundamental spread. Source: PRA fundamental-spread tables, Block 2.
rating, tenor, currency, sector, date no range bps
PRA_SECTORS
List of sectors stored in the PRA tables. Discovery helper.
text
PRA_TABLE
Full PRA fundamental-spread table for one (currency, sector, date). Long format: one row per (CQS × tenor) combination, with all 5 components (pd_prob, pd_spread, cod, ltas, fs).
currency, sector, date mixed
PRA_TENORS
List of tenors (years) stored in the PRA tables for one (currency, sector). Discovery helper.
currency, sector years