data.stats.gov.cn API Guide

How to access China's official National Bureau of Statistics (NBS) data via the EasyQuery API — plus a simpler English-language alternative.

NBS EasyQuery API (data.stats.gov.cn)

The NBS provides an undocumented JSON API at data.stats.gov.cn/easyquery.htm. It's powerful but complex:

# Example: Query annual GDP data
POST https://data.stats.gov.cn/easyquery.htm?m=QueryData
dbcode=hgnd&rowcode=sj&colcode=zb&wds=[]&dfwds=[{"wdcode":"zb","valuecode":"A020101"}]

Key parameters:

Parameter Value Meaning
mQueryDataQuery mode
dbcodehgnd / hgydAnnual / Monthly database
rowcodesjTime dimension (rows)
dfwdsJSON arrayIndicator filters (wdcode + valuecode)

The API is in Chinese, requires knowledge of NBS indicator codes (like A020101 for GDP), and responses vary by database. It's not officially documented for external use.

Simpler Alternative: chinadata.live API

If you need key China statistics in English with a clean REST API, no registration needed:

# Get China GDP data — no auth, no indicator codes
curl https://chinadata.live/api/v2/data/china-gdp

NBS API vs chinadata.live API

Feature data.stats.gov.cn chinadata.live
LanguageChinese onlyEnglish ✓
DocumentationNone (reverse engineered)Full docs ✓
Auth requiredNoNo ✓
Data coverage100,000+ indicators ✓27 key datasets
Response formatComplex nested JSONClean REST JSON ✓
AvailabilityBlocks non-China IPs sometimesGlobal CDN ✓

FAQ

What is the data.stats.gov.cn EasyQuery API?

The NBS provides an unofficial JSON API at data.stats.gov.cn/easyquery.htm. It powers the official NBS data visualization tool and returns data in JSON format. The API uses POST requests with Chinese indicator codes. It is not officially documented for external use but is widely used by researchers.

Why can't I access data.stats.gov.cn from outside China?

The NBS website sometimes restricts access from non-Chinese IP addresses or slows significantly. This is why researchers use a proxy, VPN, or an alternative data source like chinadata.live which mirrors key datasets on a global CDN.

What is the NBS indicator code for China GDP?

The NBS indicator code for GDP (国内生产总值) is A020101 in the annual database (dbcode=hgnd). Alternatively, use curl https://chinadata.live/api/v2/data/china-gdp for a pre-formatted English response.

💬 Need custom data?