External trade

GET /v1/trade 🔑

Monthly merchandise exports and imports by commodity, from the Pakistan Bureau of Statistics' trade releases.

Param Type Notes
flow string export or import
commodity string Commodity-name filter, partial and case-insensitive (e.g. RICE, COTTON, PETROLEUM)
group string Commodity-group filter (e.g. FOOD GROUP, TEXTILE GROUP)
from, to date Month window
limit int Default 1000
sort asc|desc Default desc
curl -H "X-API-Key: pk_live_xxx" \
  "https://api.pakdatahub.com/v1/trade?flow=export&commodity=RICE&limit=2"
{ "success": true, "count": 2, "data": [
  { "flow": "export", "commodity": "1.RICE", "group": "FOOD GROUP", "date": "2026-08-31",
    "unit": "M.T", "quantity": 308481.3520889, "value_pkr_mn": 53294.1391308608, "value_usd_th": 191791.4218023 },
  { "flow": "export", "commodity": "1.RICE / a) BASMATI", "group": "FOOD GROUP", "date": "2026-08-31",
    "unit": "M.T", "quantity": 77795.0193211, "value_pkr_mn": 24341.3079150581, "value_usd_th": 87612.2720203 } ] }
Field Meaning
commodity PBS line item. Sub-items are parent-qualified, e.g. 1.RICE / a) BASMATI
unit Quantity unit (M.T = metric tonnes, DOZ, SQM, …)
value_pkr_mn Value in Rs million
value_usd_th Value in US$ thousand

History: monthly from late 2025, growing month by month. For longer runs use the yearly product-by-country data below, or the SBP series in the external module (see the External dataset).

Trade by product and partner country

Every product line Pakistan exported or imported, with every partner country, for each fiscal year from 1990-91 (FY1991) to 2024-25. Product codes are 8-digit Pakistan Customs Tariff codes (HS-based) from 2002-03, and 7-digit SITC-based codes before that, so a product's history can continue under a new code in 2002-03. Each code has a total line (country: All countries); the overall total is code TOTAL. Values are in Rs thousand as published, and in US$ thousand at the fiscal year's average exchange rate. Flows: export, import, and to FY2021 re-export and re-import. Browse it on the trade explorer, with a page for every product and partner; what the data covers and how codes work: Trade by product and country.

GET /v1/trade/products

Product codes with readable names; no key needed. q matches every word against the name, PBS's own wording and the official heading, or a code prefix (buffalo hides, basmati, 5205); classification = HS or SITC.

Field Meaning
name Readable name: the official HS / SITC Rev.3 text where the code is itself the official item, otherwise PBS's wording spelled out ("LEATH BUFFAL HIDES,TANN,FINISH" → "Leather buffalo hides, tanned, finish")
hs_heading The official parent heading: HS 6-digit for 8-digit codes, SITC Rev.3 5-digit for 7-digit codes (UN Statistics Division classification text)
description PBS's original abbreviated text, unchanged
unit Quantity unit (KG, NO, MT, DOZ, SQM, …)
{ "success": true, "data": [
  { "code": "10063010", "classification": "HS", "name": "Rice basmati", "short_name": "Rice basmati",
    "hs_heading": "Cereals; rice, semi-milled or wholly milled, whether or not polished or glazed",
    "description": "RICE BASMATI", "unit": "MT", "first_fy": 2003, "last_fy": 2025 } ] }

GET /v1/trade/hs 🔑

Yearly values for a product or code prefix (code=5205*), by partner. Give code, country or both; from / to are fiscal years (end year: 2025 = FY2024-25).

curl -H "X-API-Key: pk_live_xxx"   "https://api.pakdatahub.com/v1/trade/hs?flow=export&code=10063010&country=All%20countries"
{ "success": true, "data": [
  { "flow": "export", "fiscal_year": "2024-25", "fy": 2025, "code": "10063010", "product": "Rice basmati",
    "product_raw": "RICE BASMATI", "hs_heading": "Cereals; rice, semi-milled or wholly milled, whether or not polished or glazed",
    "classification": "HS", "country": "All countries", "quantity": 808069, "unit": "MT",
    "value_pkr_th": 231888812.789, "value_usd_th": 829868.6 } ] }

GET /v1/trade/partners 🔑

Partner countries ranked by value for one fiscal year (fy, required), for all products or one code / prefix. Each row has value_pkr_th, value_usd_th and share_pct.

GET /v1/trade/partner-products 🔑

One partner's products ranked by value for a fiscal year: country, flow, fy. With country=All countries it ranks every product by its total.

GET /v1/trade/partner-history 🔑

One partner's total trade with Pakistan in each fiscal year: country, flow.

GET /v1/trade/countries

Partner names and the years each appears; no key needed. Country names are standardised across the years ("U S A" and "U.S.America" are both United States). Places that genuinely changed keep their own names: Czechoslovakia, Yugoslavia, Serbia and Montenegro, and the individual UAE emirates listed separately until 2013.

GET /v1/trade/product/{code} 🔑

Everything about one product in one call — what its page on the site shows. code is a 4-digit HS heading (1006: its 8-digit codes added up, FY2002-03 on) or a product code (10063010, or a 7-digit SITC code). fy picks the year for the partner ranking (default: the latest year the product traded).

curl -H "X-API-Key: pk_live_xxx" "https://api.pakdatahub.com/v1/trade/product/1006"
{ "success": true, "data": {
  "code": "1006", "level": "heading", "classification": "HS", "name": "Rice", "official_name": "Rice",
  "chapter": { "code": "10", "name": "Cereals" }, "heading": null, "unit": null,
  "first_fy": 2003, "last_fy": 2025, "fy": 2025, "fiscal_year": "2024-25", "latest_fy": 2025,
  "path": "/trade/products/1006-rice", "indexable": true,
  "recent": { "years": 3, "export_usd_th": 3158672.1, "import_usd_th": 38848.9 },
  "history": [ { "fy": 2025, "fiscal_year": "2024-25", "export_pkr_th": 944220972.1, "export_usd_th": 3379116.7,
                 "export_quantity": null, "import_pkr_th": 16763390.4, "import_usd_th": 59991.7, "import_quantity": null } ],
  "partners": { "export": [ { "country": "Afghanistan", "value_pkr_th": 86850094.5, "value_usd_th": 310811.1,
                              "share_pct": 9.198, "path": "/trade/partners/afghanistan" } ],
                "import": [ { "country": "China", "value_pkr_th": 16748133.1, "value_usd_th": 59937.1,
                              "share_pct": 99.909, "path": "/trade/partners/china" } ] },
  "related": [ { "code": "10063090", "name": "Rice other varieties", "path": "/trade/products/10063090-rice-other-varieties",
                 "indexable": true, "export_usd_th": 1626612.4, "import_usd_th": 0.0 } ] } }
Field Meaning
level heading (an HS-4 heading, its codes summed) or code
history Every fiscal year: exports and imports in Rs thousand and US$ thousand; quantities for a single code (in unit)
partners The top 25 partners each way for fy, with each one's share
related A heading's codes, or a code's sister codes in its heading, by recent trade
recent Average exports and imports a year over the last three fiscal years
heading, hs6_heading, pbs_name For a code: its HS-4 heading, the official HS 6-digit text and PBS's own wording
path, indexable The page on pakdatahub.com, and whether search engines are asked to index it

GET /v1/trade/partner/{country} 🔑

Everything about one partner in one call. country is the page slug (china, united-arab-emirates) or the name. Returns yearly exports and imports (history), the partner's rank among Pakistan's export markets and suppliers (rank, share_pct, out of partners_ranked) and its top 25 products each way (products) for fy (default: the latest year).

curl -H "X-API-Key: pk_live_xxx" "https://api.pakdatahub.com/v1/trade/partner/china?fy=2024"

GET /v1/trade/pages

The product headings, product codes and partners that have an indexed page on pakdatahub.com, with their path and recent trade (US$ thousand a year, averaged over the last three fiscal years); no key needed. data.headings carry their HS chapter, and chapters names them. Which pages are indexed is explained in Trade by product and country.

·

Also as Markdown: api-trade.md · All docs