data.stats.gov.cn APIdata.stats.gov.cn ↗
Access China NBS economic and social statistics: GDP, money supply, price indices, population, and provincial data via 7 structured endpoints.
curl -X GET 'https://api.parse.bot/scraper/c388b348-261a-4275-a2a9-53ecd8ac542b/get_indicator_tree?dbcode=hgyd&wdcode=zb' \ -H 'X-API-Key: $PARSE_API_KEY'
Browse the hierarchical tree of indicators, regions, or time periods. Use this to discover IDs for querying data.
| Param | Type | Description |
|---|---|---|
| dbcoderequired | string | Database code (e.g., 'hgyd' for national monthly, 'fsnd' for provincial annual) |
| wdcode | string | Dimension code: 'zb' (indicators), 'reg' (regions), 'sj' (time) |
| parent_id | string | Parent ID to drill down into (empty for root) |
{
"type": "array",
"fields": {
"id": "string",
"pid": "string",
"name": "string",
"dbcode": "string",
"wdcode": "string",
"isParent": "boolean"
},
"sample": {
"data": [
{
"id": "A01",
"pid": "",
"name": "价格指数",
"dbcode": "hgyd",
"wdcode": "zb",
"isParent": true
},
{
"id": "A02",
"pid": "",
"name": "工业",
"dbcode": "hgyd",
"wdcode": "zb",
"isParent": true
},
{
"id": "A03",
"pid": "",
"name": "能源",
"dbcode": "hgyd",
"wdcode": "zb",
"isParent": true
}
],
"status": "success"
}
}About the data.stats.gov.cn API
This API exposes 7 endpoints for querying official statistical data published by China's National Bureau of Statistics (NBS), covering national and provincial economic indicators, demographic data, and time-series figures. The get_indicator_tree endpoint lets you navigate the full hierarchy of indicator codes before running targeted queries, while get_money_supply surfaces M0, M1, and M2 figures directly with a configurable month limit.
What the API Covers
The API wraps the NBS public data platform at data.stats.gov.cn, giving structured access to China's official macroeconomic and social statistics. Indicators span GDP, money supply (M0/M1/M2), price indices, population figures, and education statistics. Data is organized across multiple databases — for example, hgyd for national monthly data and fsnd for provincial annual data — and the API exposes both national-level and all-31-province breakdowns.
Navigating Indicators and Regions
The get_indicator_tree endpoint accepts a dbcode, an optional wdcode dimension (zb for indicators, reg for regions, sj for time), and an optional parent_id to drill into sub-nodes. Each node in the response includes id, pid, name, dbcode, wdcode, and isParent, making it straightforward to traverse from root categories down to specific leaf indicator codes. Pair this with get_regions (returns id and name for provinces or cities) and get_time_periods (available period codes for a given database) to assemble the exact filter parameters needed for a data query.
Querying Data
The query_data endpoint accepts wds (fixed dimension filters as a JSON list, e.g. locking an indicator code) and dfwds (display filters, e.g. LAST10 for the ten most recent periods), along with rowcode and colcode to control result orientation. Responses contain wdnodes (dimension metadata) and datanodes (the actual values). The get_provincial_data endpoint simplifies a common pattern: supply an indicator_code like A020101 for Regional GDP and an optional limit for recent years, and it returns region-by-year data for all provinces in the same wdnodes/datanodes structure. search_indicators supports keyword lookup in Chinese or English and returns paginated results with a pagecount field.
Indicator Discovery
Because the NBS data catalog uses opaque numeric and alphanumeric codes, the discovery flow matters: use search_indicators to find candidate indicator codes by keyword, confirm the right dbcode via get_indicator_tree, then pass those codes into query_data or get_provincial_data. The get_time_periods endpoint is useful when you need to confirm which periods are actually populated for a given database before constructing a time-series query.
- Track quarterly GDP growth trends by querying national and provincial indicator codes over multi-year time series.
- Monitor M0, M1, and M2 money supply changes month-over-month using
get_money_supplywith a rolling window. - Build cross-province economic comparison dashboards using
get_provincial_datafor indicators like Regional GDP. - Discover and map the full NBS indicator hierarchy programmatically with
get_indicator_treefor automated catalog indexing. - Search NBS datasets by keyword (e.g. '居民消费价格' or 'CPI') via
search_indicatorsto identify relevant indicator codes. - Retrieve province and city-level region codes via
get_regionsto filter multi-dimensional queries by geography. - Automate ingestion of official Chinese economic releases into data pipelines using structured
datanodesresponses.
| Tier | Price | Credits/month | Rate limit |
|---|---|---|---|
| Free | $0/mo | 100 | 5 req/min |
| Hobby | $30/mo | 1,000 | 20 req/min |
| Developer | $100/mo | 5,000 | 250 req/min |
One credit = one API call regardless of which marketplace API you call. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.
Does data.stats.gov.cn have an official developer API?+
What does `query_data` return and how do I filter it?+
wdnodes, which contains dimension metadata describing the axes of the result, and datanodes, which holds the actual statistical values. You filter using wds (fixed dimensions, e.g. locking a specific indicator code) and dfwds (display filters, e.g. LAST10 to retrieve the ten most recent periods). Set rowcode to zb for indicator rows or reg for region rows, and colcode to sj for time columns.Does the API cover city-level or county-level data below the provincial level?+
get_regions with a parent_id parameter. Sub-provincial city or county breakdowns are not currently returned by these endpoints. You can fork the API on Parse and revise it to add queries targeting finer administrative divisions if the underlying NBS database supports them for a given indicator.How current is the data, and how often is it updated?+
Can I retrieve historical data beyond what `LAST10` covers, or get full time-series going back decades?+
dfwds filter supports range and recency codes including LAST10 for the ten most recent periods. Older historical depth depends on what each specific dbcode database holds; not all indicators have decades of data available. For indicators with limited depth in the current databases, you can fork the API on Parse and revise it to target additional NBS database codes or alternative historical tables.