GnistAI GnistAI
Log in

Getting Started with Finlex (Finnish Legislation)

Finnish legislation — statutes, consolidated laws, and government proposals from Finlex open data.

All Tutorials   |   Overview   |   Playground   |   MCP   |   REST API   |   Home
Legal

Data source: Finlex (opendata.finlex.fi)

Overview

Finlex (Finnish Legislation) wraps Finlex (opendata.finlex.fi), handling authentication, pagination, and rate limits for you. This tutorial covers all 7 tools with working code examples you can copy and run.

Prerequisites

  1. Sign up at https://context.gnist.ai/signup for a free API key (100 calls/day).
  2. Choose your integration method: MCP protocol or REST API.

Connect via MCP

Add to your MCP client config (Claude Desktop, Cursor, etc.):

MCP Config
{
  "mcpServers": {
    "gnist-finlex": {
      "url": "https://context.gnist.ai/mcp/finlex/",
      "headers": {
        "Gnist-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Tools (7)

list_statutes

List Finnish statutes from the Statute Book of Finland (Suomen Saadoskokoelma). Browse recently published statutes or filter by year. Each statute is identified by year and number (e.g. 2026/1). Use get_statute to retrieve full text. Returns: Dict with 'count', 'page', and 'statutes' list.

ParameterTypeRequiredDescription
yearanyoptionalFilter by year (e.g. 2025)
languagestringoptionalLanguage: 'fin' (Finnish, default), 'swe' (Swedish) (default: fin)
pageintegeroptionalPage number (default 1) (default: 1)
limitintegeroptionalResults per page (default 20, max 50) (default: 20)
curl -X POST "https://context.gnist.ai/mcp/finlex/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "list_statutes", "arguments": {"year": "2025"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/finlex/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'year': '2025'}, 'name': 'list_statutes'}},
)
print(resp.json())

get_statute

Retrieve a specific Finnish statute with full text and article structure. Returns the statute's metadata (title, dates, ELI identifier) and its articles with section numbers, headings, and content parsed from Akoma Ntoso XML. Returns: Statute detail dict, or error if not found.

ParameterTypeRequiredDescription
yearintegerrequiredYear of the statute (e.g. 2025)
numberstringrequiredStatute number within the year (e.g. '1', '118')
languagestringoptionalLanguage: 'fin' (Finnish, default), 'swe' (Swedish) (default: fin)
curl -X POST "https://context.gnist.ai/mcp/finlex/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "get_statute", "arguments": {"year": 2025, "number": "'1'"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/finlex/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'number': "'1'", 'year': 2025},
            'name': 'get_statute'}},
)
print(resp.json())

list_government_proposals

List Finnish government proposals (hallituksen esitykset / HE). Government proposals are bills submitted by the Finnish government to Parliament. They contain the reasoning and draft legislation for proposed changes. Returns: Dict with 'count', 'page', and 'proposals' list.

ParameterTypeRequiredDescription
yearanyoptionalFilter by year (e.g. 2025)
languagestringoptionalLanguage: 'fin' (Finnish, default), 'swe' (Swedish) (default: fin)
pageintegeroptionalPage number (default 1) (default: 1)
limitintegeroptionalResults per page (default 20, max 50) (default: 20)
curl -X POST "https://context.gnist.ai/mcp/finlex/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "list_government_proposals", "arguments": {"year": "2025"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/finlex/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'year': '2025'}, 'name': 'list_government_proposals'}},
)
print(resp.json())

get_government_proposal

Retrieve a specific Finnish government proposal with metadata and content preview. Returns the proposal's metadata (title, dates, ELI identifier) and a preview of the content (first 10 paragraphs). Returns: Proposal detail dict, or error if not found.

ParameterTypeRequiredDescription
yearintegerrequiredYear of the proposal (e.g. 2025)
numberstringrequiredProposal number within the year (e.g. '8')
languagestringoptionalLanguage: 'fin' (Finnish, default), 'swe' (Swedish) (default: fin)
curl -X POST "https://context.gnist.ai/mcp/finlex/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "get_government_proposal", "arguments": {"year": 2025, "number": "'8'"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/finlex/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'number': "'8'", 'year': 2025},
            'name': 'get_government_proposal'}},
)
print(resp.json())

list_consolidated_statutes

List consolidated (updated/amended) Finnish statutes. Consolidated statutes reflect the current version of the law with all amendments applied. Use this instead of list_statutes when you need the up-to-date text. Returns: Dict with 'count', 'page', and 'statutes' list.

ParameterTypeRequiredDescription
yearanyoptionalFilter by year (e.g. 2025)
languagestringoptionalLanguage: 'fin' (Finnish, default), 'swe' (Swedish) (default: fin)
pageintegeroptionalPage number (default 1) (default: 1)
limitintegeroptionalResults per page (default 20, max 50) (default: 20)
curl -X POST "https://context.gnist.ai/mcp/finlex/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "list_consolidated_statutes", "arguments": {"year": "2025"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/finlex/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'year': '2025'},
            'name': 'list_consolidated_statutes'}},
)
print(resp.json())

get_consolidated_statute

Retrieve a specific consolidated Finnish statute with full amended text. Returns the current version of the statute with all amendments applied, including metadata and article structure. Returns: Statute detail dict, or error if not found.

ParameterTypeRequiredDescription
yearintegerrequiredYear of the statute (e.g. 2024)
numberstringrequiredStatute number within the year (e.g. '2')
languagestringoptionalLanguage: 'fin' (Finnish, default), 'swe' (Swedish) (default: fin)
curl -X POST "https://context.gnist.ai/mcp/finlex/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "get_consolidated_statute", "arguments": {"year": 2024, "number": "'2'"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/finlex/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'number': "'2'", 'year': 2024},
            'name': 'get_consolidated_statute'}},
)
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'.

ParameterTypeRequiredDescription
feedbackstringrequired
feedback_typestringoptional (default: general)
curl -X POST "https://context.gnist.ai/mcp/finlex/" \
  -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/finlex/",
    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

Search then retrieve
Use list_statutes to find items, then get_statute to get full details. This two-step pattern is common for exploring data before drilling down.
Pagination
Several tools support limit, offset, or page parameters. Start with small limits during development, then increase for production queries.

FAQ

What data does Finlex (Finnish Legislation) provide?

Finnish legislation — statutes, consolidated laws, and government proposals from Finlex open data. It exposes 7 tools: list_statutes, get_statute, list_government_proposals, get_government_proposal, list_consolidated_statutes, get_consolidated_statute, 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 Finlex (Finnish Legislation) API return?

JSON, via either MCP protocol (JSON-RPC 2.0) or REST API.

Next Steps

Related Tutorials