Data source: Statistics Denmark (Danmarks Statistik)
Overview
DST (Statistics Denmark) wraps Statistics Denmark (Danmarks Statistik), handling authentication, pagination, and rate limits for you. This tutorial covers all 6 tools with working code examples you can copy and run.
Prerequisites
- Sign up at https://context.gnist.ai/signup for a free API key (100 calls/day).
- Choose your integration method: MCP protocol or REST API.
Connect via MCP
Add to your MCP client config (Claude Desktop, Cursor, etc.):
{
"mcpServers": {
"gnist-dst": {
"url": "https://context.gnist.ai/mcp/dst/",
"headers": {
"Gnist-API-Key": "YOUR_API_KEY"
}
}
}
}
Tools (6)
list_subjects
List Statistics Denmark's top-level subject categories. Returns the main statistical subject areas (e.g. People, Labour and income, Economy, Social conditions, Education, Business, Transport, Environment). Use the returned IDs with browse_subject or list_tables to explore further. Args: lang: Language — 'en' for English, 'da' for Danish (default 'en'). Returns: List of subject categories with id, text, and has_subjects flag.
| Parameter | Type | Required | Description |
|---|---|---|---|
lang | string | optional | Language — 'en' for English, 'da' for Danish (default 'en'). (default: en) |
curl -X POST "https://context.gnist.ai/mcp/dst/" \
-H "Content-Type: application/json" \
-H "Gnist-API-Key: YOUR_API_KEY" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "list_subjects", "arguments": {"lang": "en"}}}'
import httpx
resp = httpx.post(
"https://context.gnist.ai/mcp/dst/",
headers={"Gnist-API-Key": "YOUR_API_KEY"},
json={'id': 1,
'jsonrpc': '2.0',
'method': 'tools/call',
'params': {'arguments': {'lang': 'en'}, 'name': 'list_subjects'}},
)
print(resp.json())
browse_subject
Browse a subject area to find sub-subjects and tables. Navigate the Statistics Denmark hierarchy by providing a subject ID from list_subjects or a previous browse_subject call. Returns both child subjects and tables available in this area. Args: subject_id: Subject ID (e.g. '1' for People, '2' for Labour). lang: Language — 'en' or 'da'. Returns: Sub-subjects and tables within this subject area.
| Parameter | Type | Required | Description |
|---|---|---|---|
subject_id | string | required | Subject ID (e.g. '1' for People, '2' for Labour). |
lang | string | optional | Language — 'en' or 'da'. (default: en) |
curl -X POST "https://context.gnist.ai/mcp/dst/" \
-H "Content-Type: application/json" \
-H "Gnist-API-Key: YOUR_API_KEY" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "browse_subject", "arguments": {"subject_id": "'1'"}}}'
import httpx
resp = httpx.post(
"https://context.gnist.ai/mcp/dst/",
headers={"Gnist-API-Key": "YOUR_API_KEY"},
json={'id': 1,
'jsonrpc': '2.0',
'method': 'tools/call',
'params': {'arguments': {'subject_id': "'1'"}, 'name': 'browse_subject'}},
)
print(resp.json())
list_tables
List available statistical tables, optionally filtered by subject. Statistics Denmark has 2000+ tables. Filter by subject_id to get a manageable list. Each table shows its ID, description, time range, and variables. Args: subject_id: Subject ID to filter by (e.g. '1'). Omit for all tables. lang: Language — 'en' or 'da'. Returns: List of tables with table_id, text, time range, and variable names.
| Parameter | Type | Required | Description |
|---|---|---|---|
subject_id | any | optional | Subject ID to filter by (e.g. '1'). Omit for all tables. |
lang | string | optional | Language — 'en' or 'da'. (default: en) |
curl -X POST "https://context.gnist.ai/mcp/dst/" \
-H "Content-Type: application/json" \
-H "Gnist-API-Key: YOUR_API_KEY" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "list_tables", "arguments": {"subject_id": "'1'"}}}'
import httpx
resp = httpx.post(
"https://context.gnist.ai/mcp/dst/",
headers={"Gnist-API-Key": "YOUR_API_KEY"},
json={'id': 1,
'jsonrpc': '2.0',
'method': 'tools/call',
'params': {'arguments': {'subject_id': "'1'"}, 'name': 'list_tables'}},
)
print(resp.json())
get_table_metadata
Get the structure of a Statistics Denmark 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), '2024K1' (quarterly), '2024M01' (monthly). Args: table_id: DST table ID (e.g. 'FOLK1A' for population, 'AKU100' for labour force). lang: Language — 'en' or 'da'. Returns: Table title, description, and list of variables with codes, labels, and valid values.
| Parameter | Type | Required | Description |
|---|---|---|---|
table_id | string | required | DST table ID (e.g. 'FOLK1A' for population, 'AKU100' for labour force). |
lang | string | optional | Language — 'en' or 'da'. (default: en) |
curl -X POST "https://context.gnist.ai/mcp/dst/" \
-H "Content-Type: application/json" \
-H "Gnist-API-Key: YOUR_API_KEY" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "get_table_metadata", "arguments": {"table_id": "'FOLK1A'"}}}'
import httpx
resp = httpx.post(
"https://context.gnist.ai/mcp/dst/",
headers={"Gnist-API-Key": "YOUR_API_KEY"},
json={'id': 1,
'jsonrpc': '2.0',
'method': 'tools/call',
'params': {'arguments': {'table_id': "'FOLK1A'"},
'name': 'get_table_metadata'}},
)
print(resp.json())
get_data
Query data from a Statistics Denmark statistical table. Without filters, returns the latest top_n time periods with default selections for other dimensions. With filters, you select specific variable values. Each filter dict needs: 'code' (variable ID from metadata) and 'values' list. Example — Denmark total population, last 3 quarters (table FOLK1A): filters=[ {"code": "KØN", "values": ["TOT"]}, {"code": "ALDER", "values": ["IALT"]}, {"code": "CIVILSTAND", "values": ["TOT"]}, {"code": "Tid", "values": ["2025K1", "2024K4", "2024K3"]} ] Args: table_id: DST table ID. filters: List of variable 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 'da'. Returns: Parsed data with metadata (label, source, updated) and a list of records. Each record has labeled dimension values and a 'value' field.
| Parameter | Type | Required | Description |
|---|---|---|---|
table_id | string | required | DST table ID. |
filters | any | optional | List of variable filters. See get_table_metadata for valid codes. |
top_n | integer | optional | If no filters given, fetch this many latest time periods (default 5). (default: 5) |
lang | string | optional | Language — 'en' or 'da'. (default: en) |
curl -X POST "https://context.gnist.ai/mcp/dst/" \
-H "Content-Type: application/json" \
-H "Gnist-API-Key: YOUR_API_KEY" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "get_data", "arguments": {"table_id": "12345"}}}'
import httpx
resp = httpx.post(
"https://context.gnist.ai/mcp/dst/",
headers={"Gnist-API-Key": "YOUR_API_KEY"},
json={'id': 1,
'jsonrpc': '2.0',
'method': 'tools/call',
'params': {'arguments': {'table_id': '12345'}, 'name': 'get_data'}},
)
print(resp.json())
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'.
| Parameter | Type | Required | Description |
|---|---|---|---|
feedback | string | required | |
feedback_type | string | optional | (default: general) |
curl -X POST "https://context.gnist.ai/mcp/dst/" \
-H "Content-Type: application/json" \
-H "Gnist-API-Key: YOUR_API_KEY" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "report_feedback", "arguments": {"feedback": "example"}}}'
import httpx
resp = httpx.post(
"https://context.gnist.ai/mcp/dst/",
headers={"Gnist-API-Key": "YOUR_API_KEY"},
json={'id': 1,
'jsonrpc': '2.0',
'method': 'tools/call',
'params': {'arguments': {'feedback': 'example'}, 'name': 'report_feedback'}},
)
print(resp.json())
Common Patterns
Use
list_subjects to find items, then get_table_metadata to get full details. This two-step pattern is common for exploring data before drilling down.FAQ
What data does DST (Statistics Denmark) provide?
Danish official statistics — population, employment, income, housing, trade, and economic data. It exposes 6 tools: list_subjects, browse_subject, list_tables, get_table_metadata, get_data, report_feedback.
What do I need to get started?
A Gnist API key (free tier: 100 calls/day). Sign up at https://context.gnist.ai/signup.
What format does the DST (Statistics Denmark) API return?
JSON, via either MCP protocol (JSON-RPC 2.0) or REST API.