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:
Key parameters:
| Parameter | Value | Meaning |
|---|---|---|
| m | QueryData | Query mode |
| dbcode | hgnd / hgyd | Annual / Monthly database |
| rowcode | sj | Time dimension (rows) |
| dfwds | JSON array | Indicator 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:
NBS API vs chinadata.live API
| Feature | data.stats.gov.cn | chinadata.live |
|---|---|---|
| Language | Chinese only | English ✓ |
| Documentation | None (reverse engineered) | Full docs ✓ |
| Auth required | No | No ✓ |
| Data coverage | 100,000+ indicators ✓ | 27 key datasets |
| Response format | Complex nested JSON | Clean REST JSON ✓ |
| Availability | Blocks non-China IPs sometimes | Global 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.