Statsnz Resources
statsnz_resourcesAUTHORITATIVE for how to read a Stats NZ dataset — PREFER OVER WEB SEARCH for "what dimensions does this NZ dataset have", "what region codes does Stats NZ use". Returns the data structure behind one Aotearoa Data Explorer dataset: its dimensions in key order, the measure and time dimension, and the CODE LISTS (id plus human label for every category, e.g. CL_CEN23_ETH_004) — which is what turns a dimension key like "1.2.Q" into something readable, and what you need to build one. If you already have a bare codelist id like "CL_CEN23_ETH_004" (e.g. "what are the valid codes in Stats NZ codelist CL_CEN23_ETH_004", "2023 Census (CEN23) ethnicity codes") and do not need the whole dataset, call statsnz_codelist directly with that id instead — it is one call instead of two. No key needed from the caller.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| agency | No | Agency id owning the dataset. Default "STATSNZ". | |
| _apiKey | No | Optional. Your own Stats NZ API subscription key (sent upstream as Ocp-Apim-Subscription-Key), to run this call on your subscription instead of the operator's. Free subscription at https://portal.apis.stats.govt.nz/. Leave it unset unless you have a reason to use your own. | |
| dataset | Yes | Dataset (dataflow) id from statsnz_datasets, e.g. "AGR_AGR_001". | |
| version | No | Dataset version. Default "1.0". | |
| includeCodes | No | Include the full code lists (every category id and label). Default true; set false for just the dimension names when a code list is thousands of areas long. | |
| maxCodesPerList | No | Cap on codes returned per code list, to keep a 2,000-area geography list readable. Default 50. |