--- name: ministry-document-registries description: Search the RIK ADR document registers of ministries, agencies, courts, prosecution and prisons. module: adr.mjs execution: post --- # Public Document Registers (ADR) Every Estonian public body must keep a public register of the documents it sends and receives, so citizen letters (selgitustaotlus, teabenõue, vaie, märgukiri) and a ministry's own coordination correspondence on a draft law are both findable here. The RIK-hosted ADR platform is **uniform across agencies on one host**: one form contract works for every `adr.rik.ee` register, only the agency path changes. The second host, `adr.novian.ee`, runs the same software but accepts only the quick search — see Access. ## Access - Agency index: `GET https://adr.rik.ee/` — 54 links of the form `//`, one per register. - **A second host runs the same software: `https://adr.novian.ee//`**, which is where most municipal registers live (21 of them). It has **no index** — get the slug from `authority(name).register.url` in `asutused.mjs`, never by guessing. - **The two hosts are not interchangeable.** On `adr.novian.ee` the fielded search `POST //otsing` answers **HTTP 500** — every instance, every field combination, verified 2026-07-28 across `saku_vald`, `kohila_vald` and `torva_linn`. Use `POST //kiirotsing` with `input=` there. `adr.rik.ee` serves both. ```probe-limit claim On `adr.novian.ee` the fielded search `POST //otsing` answers **HTTP 500** # Saku vald, one of the three instances the claim was verified across. The 500 # is the platform's own "Süsteemi viga!" page, not a rejected field: it is the # same for every field combination, which is why the route is unusable here # rather than merely fussy. POST https://adr.novian.ee/saku_vald/otsing body title=leping expect-status 500 expect /Süsteemi viga!/ # The control is the quick search this guide sends instead, on the same # instance. It must answer 200 — otherwise a novian outage would confirm the # limitation and quietly send 21 municipal registers to a dead end. control POST https://adr.novian.ee/saku_vald/kiirotsing body input=leping&pageNumber=1 ``` - Each agency serves the same two search forms at `//kiirotsing` and `//otsing`. - Server-rendered HTML, no login, no JavaScript. Trailing slash on the landing page (`/som/` — `/som` answers 301). Common prefixes: `som`, `ram`, `jm`, `kum`, `mkm`, `kaitseministeerium`, `ska`, `transpordiamet`, `ta`, `tja`, `pa`, `riigikohus`, `riigiprokuratuur`, `tallinnav`, `tartuv`. Take the exact prefix from the index rather than guessing. ## Retrieve **Both searches are HTML form POSTs and accept nothing else.** Send `Content-Type: application/x-www-form-urlencoded` with a URL-encoded body. A GET with the same names in the query string, or a POST with a JSON body, returns the *blank form* — HTTP 200, no error, no rows. So does a misspelled field name. This is the single most common way to conclude "the register has nothing" when the request was simply never accepted as a search. 1. Fetch the index and pick the exact agency prefix. 2. Quick search across all document fields — `POST //kiirotsing`: ```text input=magustatud&pageNumber=1 ``` 3. Fielded search — `POST //otsing`. Fields: `title` (title only), `regDateBegin` / `regDateEnd` (`dd.mm.yyyy`), repeated `documentTypes`, `party` (counterparty), `senderRegNr`, `accessRestriction` (`Avalik` or `AK`), `accessRestrictionReason` (substring of the legal basis, e.g. `AvTS`), `pageNumber`. `accessRestrictionReason` is how you get a signal out of sealed material: the content is withheld but the basis is not, so counting `AvTS` versus `MKS` seals in a date window is a coarse category tally even where every title is generic. `input` is broader than `title`: on Sotsiaalministeerium `title=Karastusjookide` returns 1 row, `input=Karastusjookide` returns 4, `party=Karastusjookide` returns 3. Use `title` to pin a known document, `input` to find one you only know the actors of. At least one field must be filled. `documentTypes` values are numeric and **differ per agency** (Sotsiaalministeerium `4945102`, Justiitsministeerium `13074`) — read them from that agency's own form HTML, never copy across agencies. Paging: 20 rows per page. Re-POST every original field plus `pageNumber=N`; the query is not held in server state, so a bare `pageNumber` POST silently re-runs nothing. Detail record: `GET //dokument/`. Attachments hang off it as `//fail//` — a `.asice` is a ZIP with the signed document inside. This needs a form-urlencoded POST. If you cannot send one, this recipe is past your reach — say so rather than improvising a GET around it. ## Return Result rows give **Viit** (reference), **Reg. kpv**, **Pealkiri**, **Dokumendi liik**, **Teised osapooled**, plus the `//dokument/` link. The detail record adds **Funktsioon**, **Sari**, **Toimik**, **Juurdepääsupiirang** (+ **alus**), **Adressaat**, **Saabumis/saatmisviis**, **Vastutaja** and **Lahendamise tähtaeg**. - When titles are generic, `Sari` and `Vastutaja` name the topic. A Sotsiaalkindlustusamet row titled only "Vaie" resolves to `Sari: 5.2-3 Vaidetoimikud` and `Vastutaja: … Ekspertiisitalitus …`, i.e. a disability-assessment appeal. - `Lahendamise tähtaeg` is the body's own answering deadline — worth reporting to a citizen who is waiting. - Preserve agency, the query fields you sent, page, access status, source URL and retrieval time. ## When the body's own register has nothing A body's own register can be complete, empty or thin — and **the ministry that governs it registers the same correspondence**. Asked what documents existed about Eesti Loodusmuuseumi direktori konkurss, a run searched the museum's own 6,414-row register, found nothing about it, and drafted a teabenõue; the five documents were public in Kliimaministeerium's register the whole time. - `parentRegister(name)` in `asutused.mjs` gives that ministry whenever ITS register is searchable, with the exact call for its platform — which is often NOT ADR. 24 of the 42 bodies with such a ministry are on this platform. - **`Kokku: 0` raises this as a printed warning by itself. A thin result does not** — whether the rows you got actually answer the question is your judgement, and the rule is the same. - Only once both registers have been searched may you say the documents are not in the public register, or draft a teabenõue for them. ## Limits - **Results are capped at 100.** Above that the page says "Leiti rohkem tulemusi, kuvatakse esimesed 100. Palun täpsustage otsingut." — so `Kokku: 100` means *at least* 100, not exactly 100. Never report it as a count; narrow with `regDateBegin`/`regDateEnd` instead. - **A term the platform considers too short is answered with the blank form**, not with zero rows: `input=a` on `/som/kiirotsing` comes back HTTP 200 with no `Kokku:` line at all (2026-08-01). Same signal, same rule — that search never ran. - Unreachable or empty as of 2026-07-27, despite being listed on the index: `/ria/` and `/kl/` answer **403**; `/hmv/` and `/riigikantselei/` answer `Kokku: 0` for every term and their document-type list is empty. For Government Office documents use `riigikantselei-register`. - The index carries historical names and duplicate aliases for the same body (Kaitseliit as both `kaitseliit` and the dead `kl`). Report the register label actually shown. - `AK` records expose registration metadata without content; an `AvTS § 35 lg 1 p 11, p 12` seal runs 75 years. Counterparties who are private persons appear as initials. - Register quality varies: Transpordiamet titles are genuinely descriptive; Sotsiaalkindlustusamet and Justiitsministeerium are title-opaque and need `Sari`/`Vastutaja`. - Not on this platform: **Tallinn** — `dhs.tallinn.ee/atp` has its own guide, `tallinn-document-register`, and its own module; do not improvise from the URL here, because a search on it that is not scoped to a body returns all 273 registrars at once; **TTJA** (`https://jvis.ttja.ee/modules/dokumendiregister/?_wbbdl=1&limit=50&offset=0` with `X-Requested-With: XMLHttpRequest` returns clean JSON, but there is **no keyword search** — 579,250 rows, newest first, only `limit`/`offset`); **EMTA** (`dokumendiregister.rahandusministeerium.ee?a=mta` — results are not reachable by URL, and titles have been a bare "Kiri" under 75-year seals since ~2016; treat as unavailable). ## Verify A search only succeeded if the response body contains a line `Kokku: `. - No `Kokku:` line → the request was **not** run as a search. The blank form and the "Otsingu tulemused" heading can both appear without it. Re-send as a form-urlencoded POST with a field name copied from the form HTML. - `Kokku: 0` (with `Näitan: 0-0`) → the search ran and genuinely matched nothing. Say that; do not retry the same query. - `Kokku: N` with N ≥ 1 → require at least one `//dokument/` link before naming any document. Known-good acceptance check, run weekly against the live register by `scripts/check-sources.mjs` (issue #82): ```probe POST https://adr.rik.ee/som/otsing body title=magustatud expect /Kokku: [1-9]/ expect /\/som\/dokument\/\d+/ # Kokku: 7 on 2026-07-27, including "Arvamus magustatud joogi maksu seaduse # eelnõu kohta" (1.2-3/1805-4, 02.05.2017, Eesti Karastusjookide Tootjate Liit). # The same field sent as a GET is the blank form: HTTP 200, no Kokku: line, no # rows. If it ever satisfies the two expects above, the Kokku: rule has stopped # telling a search that ran from one that was never accepted. counter GET https://adr.rik.ee/som/otsing?title=magustatud ``` ## Module API adrSearch(body, {input, title, party, from, to, accessRestriction, reason, types, page}) -> {source, page, agency, host, ran, capped, totals, rows, note} adrDocument(body, id) -> {source, page, agency, ref, title, fields, files, related, deadline, note}