Search
#GET /v1/search
Ranked search. Every word of the query has to match. Exact matches rank first, then prefix matches, then other name matches, then description matches. It powers the search on the website (⌘K, the catalog page and the dashboard). Public, no key.
By default it searches series only. Pass kinds=all to also search everything that isn't a series, and get back the page each result lives on:
kind |
What it is | Opens |
|---|---|---|
series |
a time series in the catalog | /series/{id} |
trade_product |
a product code in the customs record (official HS/SITC name, PBS's own wording, the code), or an HS-4 heading | /trade/products/{code}-{slug} |
trade_country |
a trade partner | /trade/partners/{slug} |
district |
a district (2023 boundaries) | /districts/{slug} |
plant |
a power plant (any of its names: NEPRA's legal name, ISMO's short name, the merit-order label) | the plant series |
mandi_crop |
a crop in the wholesale (mandi) markets of Punjab and Sindh, by English or Urdu name; "onion karachi" also gives the crop-in-market page | /mandi/{crop} |
mandi_market |
a wholesale market | /mandi?market= |
fund |
a mutual fund reporting NAVs | /funds/{id} |
amc |
an asset-management company | /amcs/{amc} |
security |
a debt security (floating PIB, GoP Ijara Sukuk, corporate TFC/sukuk) | /securities/{code} |
river_site |
a dam, barrage or river gauge (Tarbela, Guddu, Nowshera, Ganda Singh Wala …) | its river-flow series (dims=site:) |
If no name matches word for word, the closest names are returned (so small typos still find things).
| Param | Type | Default | Notes |
|---|---|---|---|
q |
string | required | Search text (at least 1 character) |
kinds |
string | series |
series, all, or a comma list of the kinds above |
module |
string | - | Restrict series results to one module |
limit |
int | 20 | 1-50 |
curl "https://api.pakdatahub.com/v1/search?q=kibor&limit=3"
{ "success": true, "count": 3, "data": [
{ "id": "rates.kibor.1y", "module": "fixed-income", "name": "KIBOR 1-Year", "unit": "percent", "frequency": "daily", "source": "SBP", "tier": "basic" },
{ "id": "rates.kibor.3m", "module": "fixed-income", "name": "KIBOR 3-Month", "unit": "percent", "frequency": "daily", "source": "SBP", "tier": "basic" },
{ "id": "rates.kibor.6m", "module": "fixed-income", "name": "KIBOR 6-Month", "unit": "percent", "frequency": "daily", "source": "SBP", "tier": "basic" }
] }
curl "https://api.pakdatahub.com/v1/search?q=onion%20karachi&kinds=all&limit=3"
{ "success": true, "count": 3, "data": [
{ "kind": "mandi_crop", "key": "onion@sindh_karachi", "title": "Onion in Karachi",
"subtitle": "Today's wholesale price · Sindh", "url": "/mandi/onion?market=sindh_karachi" },
{ "kind": "mandi_crop", "key": "onion@karachi", "title": "Onion in Karachi (Punjab's report)",
"subtitle": "Today's wholesale price · Sindh", "url": "/mandi/onion?market=karachi" },
{ "kind": "series", "id": "prices.grocery_basket.karachi", "module": "prices",
"name": "Monthly grocery basket cost — Karachi", "unit": "pkr", "frequency": "weekly",
"source": "PakDataHub", "tier": "basic", "title": "Monthly grocery basket cost — Karachi",
"subtitle": "prices.grocery_basket.karachi", "url": "/series/prices.grocery_basket.karachi" }
] }
url is a path on https://pakdatahub.com. Series rows keep every catalog field, so code written for the series-only response keeps working.
#Good queries
| Looking for | Try |
|---|---|
| Exchange rates | q=usd, q=exchange rate, q=reer |
| Inflation | q=cpi, q=cpi urban food, q=wpi |
| Rates | q=kibor, q=pkrv, q=policy, q=cut off yield |
| External sector | q=remittances, q=current account, q=reserves, q=foreign direct investment |
| Money & banking | q=broad money, q=m2, q=deposits, q=npl |
| Real economy | q=gdp, q=auto sales, q=cement |
| Energy | q=petrol, q=marginal price, q=karot&kinds=all |
| Payments | q=raast, q=pos, q=cards |
| Trade by product | q=buffalo hides&kinds=trade_product, q=basmati&kinds=trade_product |
| Districts | q=lahore population&kinds=all, q=tharparkar&kinds=district |
| Mandi prices | q=tomato&kinds=mandi_crop, q=onion karachi&kinds=all |
| Funds | q=meezan&kinds=fund,amc |
Then fetch a series with /v1/series/{id}. To filter the catalog rather than rank it, use /v1/catalog?q=.