# /nbs_china/indicators/data

`POST /api/nbs_china/indicators/data`

Price: 160 credits

Get NBS China observations for one catalogue leaf: national, provincial, city and international series

## How to use it

Needs the leaf_id and the dataset it came from, both returned by nbs_china/indicators/tree and nbs_china/indicators/search. One call covers at most 5 regions and 60 periods (months, quarters or years of the dataset); a wider window or more regions answers 422 naming the cap, so split the request. Without date_from the window is the 60 calendar periods ending at date_to, at the current period, or at the last year of a discontinued series, so periods not yet published count toward the 60 and come back without rows; one row per indicator, region and period with a value. Codes for regions are listed by nbs_china/indicators/regions.

## Parameters

- `access-token` (string, required)

## Request body

- `timeout` (integer) — Max scrapping execution timeout (in seconds) (default: 300; min: 20; max: 1500)
- `count` (integer, required) — Max number of observations (min: 1)
- `dataset` (string, required) — Statistical database the leaf belongs to (one of: "national_monthly", "national_quarterly", "national_annual", "province_monthly", "province_quarterly", "province_annual", "city_monthly", "city_annual", "major_economies_monthly", "commodity_prices_monthly", "countries_annual", "hong_kong_annual", "macao_annual", "taiwan_annual")
- `leaf_id` (string, required) — Leaf node id from the indicator tree or a search result (examples: "5c7452825c7c4dcba391db5ca7f335c5"; minLength: 1)
- `indicator_ids` (array, nullable) — Indicator ids of the leaf to keep; omit for every indicator of the leaf (examples: ["53180dfb9c14411ba4b762307c85920c"]; minItems: 1; maxItems: 100)
- `regions` (array, nullable) — Region codes to keep on a regional or international dataset, at most 5; omit only on a leaf publishing 5 regions or fewer (examples: ["110000000000","440000000000"], ["JPN","KOR"]; minItems: 1; maxItems: 5)
- `date_from` (integer, nullable) — Earliest period to include, unix seconds; the window spans at most 60 periods, and without date_from it is the latest 60 periods up to date_to (examples: 1735689600; min: 0)
- `date_to` (integer, nullable) — Latest period to include, unix seconds (examples: 1788220800; min: 0)
- `language` (string) — Language of indicator, region and period names (default: "zh"; one of: "zh", "en")

## Response

### 200 — Successful Response

- `@type` (string) (default: "NbsChinaObservation")
- `indicator_id` (string, required)
- `indicator_name` (string, required)
- `leaf_id` (string, required)
- `dataset` (string, required) (one of: "national_monthly", "national_quarterly", "national_annual", "province_monthly", "province_quarterly", "province_annual", "city_monthly", "city_annual", "major_economies_monthly", "commodity_prices_monthly", "countries_annual", "hong_kong_annual", "macao_annual", "taiwan_annual")
- `region_code` (string, required)
- `region_name` (string, nullable)
- `period` (string, required)
- `period_name` (string, nullable)
- `period_start` (integer, nullable)
- `value` (number, nullable)
- `value_text` (string, nullable)
- `unit` (string, nullable)
- `base` (string, nullable)
- `category` (string, nullable)
- `measure` (string, nullable)
- `decimals` (integer, nullable)

## Errors

### 422 — Validation Error

The request body did not validate

What to do: Check the fields against this schema. A URN with the wrong prefix is the most common cause.

- `detail` (array)
  - `loc` (array, required)
  - `msg` (string, required)
  - `type` (string, required)
  - `input` (any)
  - `ctx` (object)

### 408

The request ran past its time limit

What to do: Raise `timeout` in the request body, up to the maximum this endpoint documents. Lowering `count` or turning off the `with_*` flags also helps, because less work finishes sooner.

### 412

The entity was not found, or a precondition failed

What to do: Retrying will not help: either the entity does not exist, or the input points at a different one.

### 429

Too many requests: a rate limit or a usage window is exhausted

What to do: When the response carries an X-Retry-After header, wait that many seconds and retry: the same number is in the body as `detail.retry_after`, and the limit clears once that window passes. The message in the body names the limit that was hit.

### 500

Something broke on our side

What to do: Retrying will not help. If it keeps happening, send us the X-Request-ID from the response headers.

### 529

Rate limit reached, or the endpoint is overloaded

What to do: Wait at least 30 seconds, then retry.

## Response envelope

Success: Array of objects (may be empty if no results)

Error: Error may coexist with partial results if it occurs mid-execution. Check X-Error header and status code.

Every response carries these headers:

- `X-Error` — Error message text (present only on error)
- `X-Request-ID` — Unique request identifier
- `X-Execution-Time` — Execution time in seconds
- `X-Result-Count` — How many records the body carries. 0 means an empty result, which is a normal answer and not by itself an error. A non-zero count can come back together with X-Error when the failure happened partway through — read this header and X-Error independently.
- `X-Total-Available-Results` — How many records exist for this query, when the endpoint can say. On a `dry_run` request this is the answer and the body is empty. It saturates: the endpoint's documented maximum means 'at least that many', any smaller number is exact.
- `X-Warning` — Present when the request body carried keys this endpoint does not document. They were ignored, so any filter you meant to apply through them did not apply. Check the spelling against this schema and retry.
- `X-Retry-After` — Seconds to wait before retrying. Present only on 429.

