# Pull Pakistan CPI inflation in five minutes

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](https://pakdatahub.com/signup). Every account can call the API immediately.

## 2. The headline series

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

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

```json
{
  "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:

```bash
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](https://pakdatahub.com/tools/cost-of-living),
  built from weekly PBS prices across 17 cities.

## 5. Straight into pandas

```python
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](https://pakdatahub.com/coverage), and see the full
[API reference](https://pakdatahub.com/docs) for filtering, transforms and CSV export.

---
Published 2026-09-20 - https://pakdatahub.com/blog/pakistan-cpi-in-five-minutes
