# Finlex - Finnish Case Law Search (`legaltech/finlex`) Actor

Search Finnish case law (KKO, KHO, courts of appeal, administrative and special courts) published in Finlex: keywords, ECLI, doctrinal summary, full text.

- **URL**: https://apify.com/legaltech/finlex.md
- **Developed by:** [Miguel González](https://apify.com/legaltech) (community)
- **Categories:** Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

### Finlex - Finnish Case Law Search

Searches decisions of the Finnish courts published in Finlex (Ministry of Justice of Finland): precedents and other decisions of the Supreme Court (KKO) and the Supreme Administrative Court (KHO), courts of appeal (hovioikeudet), administrative courts (hallinto-oikeudet), and the Market, Labour and Insurance Courts. Search in Finnish (or Swedish) with AND/OR/NOT (also JA/TAI/EI), phrases, parentheses, \* wildcard and -word exclusion, in two modes: full text with the official finlex.fi search engine over all published decisions (default; phrases and NOT are verified on the text) or index keywords only (asiasanat); direct identifiers (KKO:2024:1, KHO:2023:12); year range. Returns identifier, decision date, register number, ECLI, keywords, doctrinal summary with applied provisions, passages and optional full text. Limits: the Finlex open data API does not include court decisions, so the actor reads the public finlex.fi pages.

### Use cases

- Find KKO or KHO precedents on an issue (e.g. recovery to a bankruptcy estate).
- Retrieve a specific precedent by identifier (KKO:2024:1).
- Filter quickly by official keywords (asiasanat).
- Get the doctrinal summary and applied provisions of each precedent.

### How to use (guide for AI agents)

- `collections`: codes (kko, kho, hovioikeudet…) — pick by title.
- `searchIn: "fulltext"` (default) uses the finlex.fi search engine and returns `totalFound`; `"keywords"` matches only the official index keywords (asiasanat).
- Without `yearFrom`/`yearTo` the whole collection is searched. Results alternate between the selected collections (KKO, KHO…) in hierarchical order.
- Search terms in Finnish; use wildcards for inflected forms (`konkurssi*`).
- Some legal terms have several meanings. `takaisinsaanti` covers recovery to a bankruptcy estate (Konkurssi - Takaisinsaanti konkurssipesään), recovery in enforcement (Ulosottokaari - Takaisinsaanti ulosotossa), restructuring (Yrityssaneeraus) and also the reopening of a default judgment (Yksipuolinen tuomio - Takaisinsaanti yksipuoliseen tuomioon). Narrow the meaning with a phrase or a second term: `"takaisinsaanti konkurssipesään"`, `takaisinsaanti AND konkurssi*` or `takaisinsaanti NOT yksipuolinen`. Each result includes `matchedKeywords`, the index keywords that matched, so you can check the sense of every hit.
- Every result includes `searchTerm` and `rank`; `passages` holds the paragraphs where the search terms appear, ready for LLM analysis.

### Input example

```json
{
    "searchTerms": ["takaisinsaanti AND konkurssi*"],
    "collections": ["kko", "kho"],
    "yearFrom": 2020,
    "yearTo": 2026,
    "searchIn": "fulltext",
    "maxResults": 20
}
```

### Output example (abridged)

```json
{
    "collection": "kko",
    "id": "KKO:2024:1",
    "court": "Korkein oikeus",
    "decisionDate": "2024-01-03",
    "diaryNumber": "S2022/290",
    "ecli": "ECLI:FI:KKO:2024:1",
    "keywords": ["Konkurssi - Takaisinsaanti konkurssipesään - Määräpäivä"],
    "summary": "Verohallinto oli hakenut A Oy:tä konkurssiin... Korkein oikeus katsoi ... (Ään.)\nTakSL 2 § 3 mom",
    "passages": ["..."],
    "url": "https://www.finlex.fi/fi/oikeuskaytanto/korkein-oikeus/ennakkopaatokset/2024/1"
}
```

### Notes and limits

- The Finlex open data API (opendata.finlex.fi) does not include court decisions (only Chancellor of Justice and ombudsman decisions), so the actor uses the search engine and the public case-law pages of finlex.fi. If the search engine is unavailable, it falls back to scanning the yearly listings (capped by `maxDocumentsToScan`) and says so in the log. If Finlex changes its website, the actor may need adjustments.

### Source

Only official sources are used (courts, ministries or the open data published by the courts themselves). Results are returned as published by the source.

### Proxy

No proxy is needed: the source is an official open service. If it starts blocking, enable `proxyConfiguration` (Apify RESIDENTIAL (FI) recommended, or your own `proxyUrls`). Requests then go through a sticky session (same IP, own cookies) with a Chrome TLS fingerprint (impit), and the IP is rotated on 403/429 or network errors.

# Actor input Schema

## `searchTerms` (type: `array`):

One search per item, in Finnish (or Swedish). Syntax: AND / OR / NOT (also JA / TAI / EI), "exact phrase", parentheses, \* wildcard (konkurssi\*) and -word. Case- and accent-insensitive.

## `decisionIds` (type: `array`):

Specific decisions: "KKO:2024:1", "KHO:2023:12".

## `collections` (type: `array`):

Supreme Court (KKO), Supreme Administrative Court (KHO), courts of appeal, administrative courts, Market, Labour and Insurance Courts. Codes are opaque: do NOT guess them; choose by reading the title (enumTitle) of each option.

## `yearFrom` (type: `integer`):

First year (decision date). Empty = no limit in full-text mode; 1980 in keywords mode.

## `yearTo` (type: `integer`):

Last year to search.

## `searchIn` (type: `string`):

Full text uses the official finlex.fi search engine over all published decisions; keywords mode matches only the official index keywords (asiasanat) of the yearly listings. Codes are opaque: do NOT guess them; choose by reading the title (enumTitle) of each option.

## `maxResults` (type: `integer`):

Maximum per search term.

## `maxDocumentsToScan` (type: `integer`):

Only used if the finlex.fi search engine is unavailable: the actor then opens decisions from the yearly listings and stops after this many.

## `passages` (type: `integer`):

Number of paragraphs containing the search terms returned in `passages` (0 = none). Ideal for LLM analysis.

## `includeFullText` (type: `boolean`):

Adds the `text` field with the full decision. Greatly increases output size; enable only if needed.

## `proxyConfiguration` (type: `object`):

Optional. The source usually works without a proxy. If it blocks, use Apify RESIDENTIAL (FI) or your own proxyUrls; requests then use sticky sessions, IP rotation and a Chrome TLS fingerprint.

## Actor input object example

```json
{
  "searchTerms": [
    "konkurssi* AND takaisinsaanti"
  ],
  "decisionIds": [],
  "collections": [
    "kko",
    "kho"
  ],
  "searchIn": "fulltext",
  "maxResults": 20,
  "maxDocumentsToScan": 500,
  "passages": 3,
  "includeFullText": false,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `results` (type: `string`):

Dataset of decisions returned by the search, one item per result. Main fields: searchTerm, collection, id, decisionDate, ecli, keywords, summary, url. See the dataset schema for the full list of fields.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "searchTerms": [
        "konkurssi* AND takaisinsaanti"
    ],
    "decisionIds": [],
    "collections": [
        "kko",
        "kho"
    ],
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("legaltech/finlex").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "searchTerms": ["konkurssi* AND takaisinsaanti"],
    "decisionIds": [],
    "collections": [
        "kko",
        "kho",
    ],
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("legaltech/finlex").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "searchTerms": [
    "konkurssi* AND takaisinsaanti"
  ],
  "decisionIds": [],
  "collections": [
    "kko",
    "kho"
  ],
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call legaltech/finlex --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,legaltech/finlex"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/qyHlPuDqkopaUamAR/builds/npKQhId55CAlFPOQt/openapi.json
