Pull Pakistan CPI inflation in five minutes

20 Sept 2026 · 1 min read · how-to, inflation

Pakistan's Consumer Price Index is published by the Pakistan Bureau of Statistics (PBS). On PakDataHub it's a clean time series you can pull with one call. Here's the fastest path from zero to a chart.

1. Get a key

Sign up for a free key at /signup. Every account can call the API immediately.

2. The headline series

The headline year-over-year inflation series is inflation.cpi.national.yoy.

curl -H "X-API-Key: pk_live_xxx" \
  "https://api.pakdatahub.com/v1/series/inflation.cpi.national.yoy?from=2020-01-01&sort=asc"
{
  "success": true,
  "series": "inflation.cpi.national.yoy",
  "meta": { "name": "CPI National (YoY)", "unit": "percent",
            "frequency": "monthly", "source": "PBS" },
  "data": [ { "date": "2020-01-31", "value": 14.6, "dims": {} } ]
}

3. Compute YoY yourself — or don't

If you have the index level (inflation.cpi.national) and want year-over-year change, let the API do it with a server-side transform instead of writing the math:

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

The transform parameter also supports mom, pct_change, 3ma and index.

4. Go deeper: by group and by city

5. Straight into pandas

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

That's it. Discover thousands more series in the catalog, and see the full API reference for filtering, transforms and CSV export.

Related

Also as Markdown: pakistan-cpi-in-five-minutes.md · All posts