--- name: riigiteataja-draft-acts description: One named draft's Riigi Teataja proceeding record and its EIS file id. Not Riigikogu bill counts or votes. module: eelnoud.mjs execution: post --- # Riigi Teataja Draft Proceedings ## Access - Search UI: `https://www.riigiteataja.ee/et/otsing/eelnoud` - Search API: `POST https://www.riigiteataja.ee/public-api/api/v1/otsing/eelnoud` - Detail API: `POST https://www.riigiteataja.ee/public-api/api/v1/avalik/eelnou` - Public JSON; no login is required. ## Retrieve Use this minimal search payload: ```json { "general": { "searchInText": false, "searchInTitle": false, "searchText": "", "searchText2": "", "logicalOperator": "AND", "morphSearch": false, "sort": "esimeseEtapiAeg", "sortAscending": false }, "precise": {} } ``` Precise fields are `aktiAndja`, `eelnouLiik`, `menetluseAlgus`, `menetluseLopp`, `menetluseEtapp`, and `menetluseNr`. The response contains `kokku` and up to 30 `tulemused`; each result includes `id`, `pealkiri`, `eelnouLiik`, `aktiAndja`, `menetluseAlgus`, `menetlusKaik`, and stage records in `etapid`. To resolve one proceeding, POST `{"menetluseId":"REM/26-0818"}` to `/avalik/eelnou`. The `menetluseId` IS the EIS number (`menetlusKaik` in results), so this endpoint turns an EIS number into the proceeding's whole cross-system trail. Each stage's `menetlusTeave` is a URL into the system that ran the stage: ministry stages link `https://eelnoud.valitsus.ee/main/mount/docList/` — a **direct-GET toimik page**; follow `legislation-workflow-eis` for parsing it and downloading its files (kooskõlastuskirjad, märkuste tabel). Riigikogu stages link the bill page, `Väljakuulutamine` the President's register, `Avaldamine` the act on riigiteataja.ee. Verified 2026-07-27: `SOM/24-0227` and the 2017 `RAM/17-0515` both resolve with working docList links, and `REM/26-0847`, in coordination since 23.07.2026, was already indexed — coverage runs from in-flight drafts back to at least 2017. ## Return - `draftProceedings()` rows are `{id, title, kind, issuer, number, started, stages:[{stage, date, authority, status, url}]}`; `draftProceeding()` returns `found` plus the same `stages`. - Keep draft proceedings separate from enacted acts. Use `legal-acts-data` to resolve final law text. ## Limits - The search returns 30 rows and exposes no documented bulk pagination contract (`leht=2` returns the same first page). `kokku` — `totals.total` — is the only count. - The search can return the SAME proceeding twice, as two records with one `id`. Deduplicate before counting. - `menetluseAlgus`/`menetluseLopp` require a zoned timestamp (`2026-07-01T00:00:00+03:00`); a bare `2026-07-01` answers HTTP 500. The module converts plain dates itself. ```probe-limit claim a bare `2026-07-01` answers HTTP 500 POST https://www.riigiteataja.ee/public-api/api/v1/otsing/eelnoud body {"general":{"searchInText":false,"searchInTitle":false,"searchText":"","searchText2":"","logicalOperator":"AND","morphSearch":false,"sort":"esimeseEtapiAeg","sortAscending":false},"precise":{"menetluseAlgus":"2026-07-01"}} expect-status 500 # The 500 arrives with an empty body, so the status is the whole signal. (The # runner labels every body form-urlencoded; this API reads the JSON either way # — checked 2026-08-02, same 500 here and same 200 below under both.) # The control is the SAME search with the zoned timestamp this guide tells the # agent to send. Without it, an API that had gone down entirely would answer # 500 to everything and "confirm" that plain dates are the problem. control POST https://www.riigiteataja.ee/public-api/api/v1/otsing/eelnoud body {"general":{"searchInText":false,"searchInTitle":false,"searchText":"","searchText2":"","logicalOperator":"AND","morphSearch":false,"sort":"esimeseEtapiAeg","sortAscending":false},"precise":{"menetluseAlgus":"2026-07-01T00:00:00+03:00"}} ``` - Issuer and type values are classifier codes with no published list, and a wrong one is not an error: `aktiAndja: "JUM"` and `eelnouLiik: "SE"` both answer 200 with `kokku: 0`, where `"MAAELMIN"` and `"MAAR"` return thousands. `draftCodes()` reads the codes in use out of a live sample. - The detail endpoint answers HTTP 200 with `{pealkiri: null, menetlusKaik: null, etapid: []}` for a number it does not hold, never a 404. - Riigi Teataja indexes the lifecycle, while EIS holds the underlying draft documents. ## Verify - Require HTTP 200 JSON with positive `kokku` and nonempty `tulemused` for the minimal search payload. - Require result rows to contain `id`, `pealkiri`, `menetlusKaik`, and nonempty `etapid`; require stage records to contain `etapp`, `aeg`, `staatus`, and `menetlusTeave`. ## Module API draftProceedings({title, text, number, issuer, kind, from, to}) -> {source, page, query, totals, rows, note} draftProceeding(eisNumber) -> {source, page, found, number, title, totals, stages, note}