How to get Pakistan CPI inflation (national, YoY) — long history since 1965 data via API

Spliced: PBS national CPI YoY where published (Jul-2017 →), else SBP's base-2015-16 national CPI YoY (Jul-2016 →), else SBP's historical general CPI YoY (1965 → Apr-2020). One continuous series; base years differ across the splice points. Derived by PakDataHub from official series. It's updated monthly from PakDataHub, covering 31 Jul 1965 to today. The latest value is 9.60 (31 Oct 2026).

Endpoint: /v1/series/inflation.cpi.national.yoy.long · series id inflation.cpi.national.yoy.long

Fetch it — copy & paste

Replace pk_live_xxx with your key. JSON by default, CSV with format=csv, and add transform=yoy for year-over-year.

cURL

curl -H "X-API-Key: pk_live_xxx" \
  "https://api.pakdatahub.com/v1/series/inflation.cpi.national.yoy.long?from=2015-01-01&sort=asc"

Python

import httpx

r = httpx.get(
    "https://api.pakdatahub.com/v1/series/inflation.cpi.national.yoy.long",
    params={"from": "2015-01-01", "sort": "asc"},
    headers={"X-API-Key": "pk_live_xxx"}, timeout=30,
)
data = r.json()["data"]
print(len(data), "observations", data[-1])

JavaScript

const res = await fetch(
  "https://api.pakdatahub.com/v1/series/inflation.cpi.national.yoy.long?from=2015-01-01&sort=asc",
  { headers: { "X-API-Key": "pk_live_xxx" } },
);
const { data } = await res.json();
console.log(data.at(-1));

pandas

import pandas as pd
url = "https://api.pakdatahub.com/v1/series/inflation.cpi.national.yoy.long?format=csv&sort=asc&api_key=pk_live_xxx"
df = pd.read_csv(url, parse_dates=["date"])

No key yet? Get a free one. Then see the full API reference.

Explore

Chart & full history · Browse all datasets · More API guides

Questions

How do I fetch Pakistan CPI inflation (national, YoY) — long history since 1965 data from an API?

Send a GET request to /v1/series/inflation.cpi.national.yoy.long on the PakDataHub REST API with your X-API-Key header. It returns monthly observations as JSON (or CSV with format=csv). Get a free key at pakdatahub.com/signup.

Is Pakistan CPI inflation (national, YoY) — long history since 1965 available as JSON or CSV?

Both. The endpoint returns JSON by default; append format=csv for a downloadable CSV that loads straight into pandas or a spreadsheet.

How far back does the CPI inflation (national, YoY) — long history since 1965 data go?

PakDataHub carries this series from 1965-07-31 to today, sourced from PakDataHub and cross-validated against published figures.

Do I need an API key?

Yes — a free account. Sign up in under a minute at pakdatahub.com/signup: it charts the full history, downloads 5 CSV or Excel files a day and makes 20 API calls a day over the last 5 years; no card required.