GnistAI GnistAI
Log in

SSB (Statistics Norway)

Norwegian official statistics — population, employment, income, housing, trade, and economic data.

Overview   |   MCP   |   REST API   |   OpenAPI   |   CLI   |   Tutorial   |   Toolkits   |   Home
status: healthy status status healthy healthy tools: 6 tools tools 6 6 type: api wrapper type type api wrapper api wrapper lifecycle: flagship lifecycle lifecycle flagship flagship Economics

Data source: Statistics Norway (SSB)

REST Bridge Endpoint https://context.gnist.ai/rest/ssb/
Authentication

All requests require a Gnist-API-Key header (or api_key query parameter).

Free tier: 100 calls/day. Get your API key.

Tools (6)

search_tables

Search SSB's statistical table catalog by keyword.

SSB (Statistics Norway) publishes thousands of tables covering population,
employment, income, housing, trade, prices, health, education, and more.
This tool searches the full catalog.

Common queries: 'population', 'GDP', 'consumer price index', 'unemployment',
'housing prices', 'immigration', 'wages', 'births', 'exports'.

Args:
query: Search keywords (e.g. 'population by municipality').
lang: Language — 'en' for English, 'no' for Norwegian (default 'en').

Returns:
List of matching tables with table_id, title, path, and relevance score.
Use the table_id with get_table_metadata or get_data to explore further.

ParameterTypeRequiredDescription
querystringrequiredSearch keywords (e.g. 'population by municipality').
langstringoptionalLanguage — 'en' for English, 'no' for Norwegian (default 'en'). (default: "en")
Request Body
{
  "query": "example"
}
get_table_metadata

Get the structure of an SSB table — its dimensions, variables, and valid values.

Use this before querying data to understand what filters are available.
Each variable lists its valid codes and labels. Variables marked 'elimination: true'
can be omitted from queries to get aggregated totals.

Time variables are flagged with 'time: true'. Time codes follow patterns:
'2024' (annual), '2024K3' (quarterly), '2024M06' (monthly).

Args:
table_id: SSB table ID (e.g. '07459' for population, '03013' for CPI).
lang: Language — 'en' or 'no'.

Returns:
Table title and list of variables with codes, labels, and valid values.

ParameterTypeRequiredDescription
table_idstringrequiredSSB table ID (e.g. '07459' for population, '03013' for CPI).
langstringoptionalLanguage — 'en' or 'no'. (default: "en")
Request Body
{
  "table_id": "example"
}
get_data

Query data from an SSB statistical table.

Without filters, returns the latest top_n time periods for all dimensions.
With filters, you can select specific dimension values.

Each filter dict needs: 'code' (variable code from metadata), 'filter' type,
and 'values' list. Filter types:
- 'item': select specific codes, e.g. {"code": "Region", "filter": "item", "values": ["0"]}
- 'top': last N periods, e.g. {"code": "Tid", "filter": "top", "values": ["5"]}
- 'all': all values, e.g. {"code": "Boligtype", "filter": "all", "values": ["*"]}

Example — Norway total population, last 5 years (table 07459):
filters=[
{"code": "Region", "filter": "item", "values": ["0"]},
{"code": "ContentsCode", "filter": "item", "values": ["Personer1"]},
{"code": "Tid", "filter": "top", "values": ["5"]}
]

Args:
table_id: SSB table ID.
filters: List of dimension filters. See get_table_metadata for valid codes.
top_n: If no filters given, fetch this many latest time periods (default 5).
lang: Language — 'en' or 'no'.

Returns:
Parsed data with metadata (label, source, updated) and a list of records.
Each record has labeled dimension values and a 'value' field.

ParameterTypeRequiredDescription
table_idstringrequiredSSB table ID.
filtersanyoptionalList of dimension filters. See get_table_metadata for valid codes.
top_nintegeroptionalIf no filters given, fetch this many latest time periods (default 5). (default: 5)
langstringoptionalLanguage — 'en' or 'no'. (default: "en")
Request Body
{
  "table_id": "example"
}
list_subjects

List SSB's top-level subject categories.

Returns the 23 main statistical subject areas (e.g. Population, Labour market,
National accounts, Health, Education). Use the returned IDs with browse_subject
to navigate deeper into the hierarchy.

Args:
lang: Language — 'en' or 'no'.

Returns:
List of subject categories with id, text, and type (folder or table).

ParameterTypeRequiredDescription
langstringoptionalLanguage — 'en' or 'no'. (default: "en")
Request Body
{
  "query": "example"
}
browse_subject

Browse a subject path to find sub-categories and tables.

Navigate the SSB table hierarchy by providing a path from list_subjects
or a previous browse_subject call. Returns child folders and tables.

Example paths: 'bb' (Construction/housing), 'bb/bb01' (Building activity),
'al' (National accounts/public finances).

Args:
path: Subject path (e.g. 'bb', 'bb/bb01').
lang: Language — 'en' or 'no'.

Returns:
List of items at this path — folders to navigate deeper, or tables to query.

ParameterTypeRequiredDescription
pathstringrequiredSubject path (e.g. 'bb', 'bb/bb01').
langstringoptionalLanguage — 'en' or 'no'. (default: "en")
Request Body
{
  "path": "example"
}
report_feedback

Report a bug, feature request, or general feedback for this data source.

Use this when something doesn't work as expected, when you'd like
a new feature, or when you have suggestions for improvement.

Args:
feedback: Describe the issue or suggestion.
feedback_type: One of 'bug', 'feature_request', or 'general'.

ParameterTypeRequiredDescription
feedbackstringrequired
feedback_typestringoptional (default: "general")
Request Body
{
  "feedback": "example"
}

Quick Start

Shell
curl -X POST "https://context.gnist.ai/rest/ssb/search_tables" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"query": "example"}'
Python
import httpx

resp = httpx.post(
    "https://context.gnist.ai/rest/ssb/search_tables",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={
  "query": "example"
},
)
print(resp.json())

Related Toolkits (Economics)

Resources