{
  "openapi": "3.0.1",
  "info": {
    "title": "Finlex - Finnish Case Law Search",
    "description": "Search Finnish case law (KKO, KHO, courts of appeal, administrative and special courts) published in Finlex: keywords, ECLI, doctrinal summary, full text.",
    "version": "0.1",
    "x-build-id": "npKQhId55CAlFPOQt"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/legaltech~finlex/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-legaltech-finlex",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/legaltech~finlex/runs": {
      "post": {
        "operationId": "runs-sync-legaltech-finlex",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/legaltech~finlex/run-sync": {
      "post": {
        "operationId": "run-sync-legaltech-finlex",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "searchTerms": {
            "title": "Search terms",
            "type": "array",
            "description": "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.",
            "items": {
              "type": "string"
            }
          },
          "decisionIds": {
            "title": "Identifiers",
            "type": "array",
            "description": "Specific decisions: \"KKO:2024:1\", \"KHO:2023:12\".",
            "items": {
              "type": "string"
            }
          },
          "collections": {
            "title": "Collections",
            "type": "array",
            "description": "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.",
            "items": {
              "type": "string",
              "enum": [
                "kko",
                "kko-muut",
                "kho",
                "kho-muut",
                "hovioikeudet",
                "hallinto-oikeudet",
                "markkinaoikeus",
                "tyotuomioistuin",
                "vakuutusoikeus"
              ],
              "enumTitles": [
                "Korkein oikeus – ennakkopäätökset (KKO)",
                "Korkein oikeus – other decisions",
                "Korkein hallinto-oikeus – ennakkopäätökset (KHO)",
                "Korkein hallinto-oikeus – other published decisions",
                "Hovioikeudet (courts of appeal)",
                "Hallinto-oikeudet (administrative courts)",
                "Markkinaoikeus (Market Court)",
                "Työtuomioistuin (Labour Court)",
                "Vakuutusoikeus (Insurance Court)"
              ]
            },
            "default": [
              "kko",
              "kho"
            ]
          },
          "yearFrom": {
            "title": "From year",
            "minimum": 1926,
            "maximum": 2100,
            "type": "integer",
            "description": "First year (decision date). Empty = no limit in full-text mode; 1980 in keywords mode."
          },
          "yearTo": {
            "title": "To year",
            "minimum": 1926,
            "maximum": 2100,
            "type": "integer",
            "description": "Last year to search."
          },
          "searchIn": {
            "title": "Search in",
            "enum": [
              "fulltext",
              "keywords"
            ],
            "type": "string",
            "description": "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.",
            "default": "fulltext"
          },
          "maxResults": {
            "title": "Maximum results",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Maximum per search term.",
            "default": 20
          },
          "maxDocumentsToScan": {
            "title": "Maximum decisions to scan (fallback)",
            "minimum": 1,
            "maximum": 20000,
            "type": "integer",
            "description": "Only used if the finlex.fi search engine is unavailable: the actor then opens decisions from the yearly listings and stops after this many.",
            "default": 500
          },
          "passages": {
            "title": "Relevant passages",
            "minimum": 0,
            "maximum": 20,
            "type": "integer",
            "description": "Number of paragraphs containing the search terms returned in `passages` (0 = none). Ideal for LLM analysis.",
            "default": 3
          },
          "includeFullText": {
            "title": "Include full text",
            "type": "boolean",
            "description": "Adds the `text` field with the full decision. Greatly increases output size; enable only if needed.",
            "default": false
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "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.",
            "default": {
              "useApifyProxy": false
            }
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}