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
- By COICOP group (food, housing, transport, …):
inflation.cpi.urban.food,inflation.cpi.urban.transport, and so on. - Urban vs rural:
inflation.cpi.urban,inflation.cpi.rural. - Cost of living by city: try the free cost-of-living tool, built from weekly PBS prices across 17 cities.
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.