# INS TEMPO Explorer > Romanian National Institute of Statistics (INS) data API. 3,000+ statistical datasets from TEMPO Online covering demographics, economy, agriculture, education, health, and more. Bilingual (Romanian/English). Data spans 1990-2024+. ## Base URL https://api-ins.gov2.ro (free, no key, read-only; a per-IP rate limit answers 429: wait and retry). Human documentation: https://ins.gov2.ro/api.html. Interactive reference: https://api-ins.gov2.ro/docs. The website https://ins.gov2.ro is static and has no /api routes. ## Concepts - **matrix_code**: Unique dataset identifier (e.g., `POP101A`, `ACC102B`). Some datasets are split into sub-datasets with suffixes (e.g., `POP301A_judete`). - **Dimensions**: Each dataset has 2-6 dimensions of types: `time`, `geo`, `gender`, `age`, `unit`, `residence`, `indicator`. - **Archetypes**: Datasets are classified by structure: `geo_time`, `demographic`, `time_residence`, `time_series`. - **Language**: All endpoints accept `lang=ro` (default) or `lang=en` for bilingual labels. - **OBS_VALUE**: The numeric observation value column in all data responses. ## REST API (JSON) ### Search datasets ``` GET /api/datasets?q={text}&context={code}&archetype={type}&has_geo={bool}&lang={ro|en}&sort={updated|name|rows}&limit={n}&offset={n} ``` Returns `{total, datasets[]}`. Each dataset card includes `matrix_code`, `matrix_name`, `archetype`, `time_range`, `row_count`, `has_geo`. ### Dataset metadata ``` GET /api/datasets/{matrix_code}?lang={ro|en} ``` Full metadata: name, definition, methodology, dimensions with all options, chart configuration, context path, split variants. This is the primary endpoint for understanding a dataset's structure before querying its data. ### Query data ``` GET /api/datasets/{matrix_code}/data?filters={json}&limit={n}&group_by={json} ``` - `filters`: JSON object mapping column names to value arrays, e.g., `{"REF_AREA":["Bucuresti"],"TIME_PERIOD":["2023"]}` - `group_by`: JSON array of columns to aggregate by, e.g., `["TIME_PERIOD","SEX"]` - `limit`: Max 50,000 rows. Datasets over 50k rows require at least one filter. - `approximate=1`: allow a labelled unweighted mean for rates/averages without weights (off by default). - Returns `{columns, rows[][], column_labels, total_rows, returned_rows, truncated, aggregation, contract, generation, quality}`. - Unknown columns or malformed filters are a 400, never ignored. A grouped total that cannot be computed safely (overlapping levels, missing weights, repeated observation keys, a sum INS contradicts) returns `unavailable: true`, `rows: []` and `aggregation.reason`. Do not compute it yourself from raw rows. - `truncated: true` or `time_windowed: true` means the result is incomplete: do not rank, total or correlate it. An empty selection reports `selection.missing_values`. - `generation.id` identifies the data version; `quality.grain` says whether the file's observations are unique. ### Concept search (ordinary questions) ``` GET /api/search?q={question}&lang={ro|en} ``` Reviewed concepts (resident population, net/gross earnings, registered/ILO unemployment, overnight stays, tourism intensity) with definition, actual coverage, parsed places/year, the dataset link carrying that selection, and alternatives when the wording is ambiguous. Then full-text results grouped by indicator family. ### Dimension values ``` GET /api/datasets/{matrix_code}/options?column={COLUMN}&q={text}&limit={n}&offset={n} ``` Actual values with accent-insensitive search and `next_offset`/`truncated`. Time columns are newest first, with `period_bounds` (first/last period with data). ### Tourism intensity recipe ``` GET /api/recipes/tourism_intensity?year={YYYY}&areas={json array of counties}&lang={ro|en} GET /api/recipes/tourism_intensity/evidence?... ``` Overnight stays (TUR105D) / resident population on 1 January of the same year (POP105A), by county, for the latest year both have (or `year`). Exclusions are listed with reasons. `/evidence` is a ZIP with the result, input series, method, attribution, hashes and an offline `recompute.py`. ### Evidence for any selection ``` GET /api/datasets/{matrix_code}/evidence?filters={json}&group_by={json}&lang={ro|en} ``` ZIP with the unrounded result, the raw observations behind an aggregation, the decision, definition and source. Returns 413 if the selection is too large; it never cuts the file. ### Human-readable pages `/dataset/{matrix_code}` is the canonical dataset page (definition, unit, coverage and source in the HTML). `/sitemap.xml` lists them. ### Download data ``` GET /api/datasets/{matrix_code}/download?format={csv|xlsx}&filters={json}&lang={ro|en} ``` ### Category tree ``` GET /api/categories?lang={ro|en} ``` Hierarchical category tree with dataset counts per node. ### Category trends ``` GET /api/categories/trends ``` Trend aggregates (up/down/flat/volatile counts, avg YoY growth) per category. ### Category summary ``` GET /api/categories/{code}/summary?lang={ro|en} ``` ### Corpus summary ``` GET /api/corpus/summary?lang={ro|en} ``` Corpus-level statistics, headline indicators with sparklines and YoY growth, recently updated datasets. ## SDMX 2.1 API (XML) Standard SDMX REST 2.1 endpoints returning SDMX-ML XML. Compatible with sdmxthon and SDMX Dashboard Generator. ### Data query ``` GET /sdmx/2.1/data/INS,{flow_id}/{key}?startPeriod={year}&endPeriod={year}&lastNObservations={n} ``` - `key`: Dot-separated dimension values. Empty segments = wildcard. Use `+` for OR (e.g., `Total+Urban.Bucuresti.`). - Returns GenericData XML with observations (max 50,000). ### Data Structure Definition ``` GET /sdmx/2.1/datastructure/INS/{flow_id}/1.0 ``` DSD with dimension definitions and codelists (up to 500 values per codelist). ### Dataflow ``` GET /sdmx/2.1/dataflow/INS/{flow_id}/1.0 ``` ## Examples Search for population datasets: ``` GET /api/datasets?q=populatie&lang=ro ``` Get GDP dataset metadata: ``` GET /api/datasets/ACC102B?lang=en ``` Query Bucharest population by year: ``` GET /api/datasets/POP101A/data?filters={"REF_AREA":["Municipiul Bucuresti"]}&group_by=["TIME_PERIOD"] ``` SDMX query — all 2023 observations for a dataset: ``` GET /sdmx/2.1/data/INS,ACC102B?startPeriod=2023&endPeriod=2023 ``` ## Public MCP (optional) - Endpoint: `https://api-ins.gov2.ro/mcp` (`/mcp` on the API origin). Streamable HTTP. Read-only, no key. - Disabled by default in a self-hosted copy. A 404 means the endpoint is off. - It never calls a model. It never runs SQL or code. - Tools: - `discover_indicators`: find indicators for a question. Concept first. - `describe_dataset`: schema, scope, period bounds and quality of one dataset. - `find_dimension_values`: search and page the actual values of one column. - `query_data`: one validated, bounded data selection. - `compare_periods`: change per entity between explicit annual endpoints, ranked. - `rank_entities`: rank a complete entity set by value in one year. - `run_recipe`: run a reviewed recipe, such as tourism intensity. - `get_evidence_links`: exact dataset, selection, CSV and evidence links. ## Source GitHub: https://github.com/gov2-ro/tempo-ins-dump