> ## Documentation Index
> Fetch the complete documentation index at: https://docs.usecroma.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Ley Chile

> Chile's laws, codes, decree-laws, decrees with force of law, autos acordados, treaties and supreme decrees from Ley Chile: search them, read any one article by article with its version history, and search inside the text of every article.

Ley Chile is the Biblioteca del Congreso Nacional de Chile's database of Chilean legislation, with the consolidated text of each norm kept up to date as later norms modify it. Croma keeps Chile's laws and codes, decrees with force of law (DFL), decree-laws (DL), the courts' autos acordados, treaties and supreme decrees: each one with its identity, publication and promulgation dates, status (in force or repealed), issuing bodies, subjects and BCN's summary, every version of its text with the norms that produced each, its current text part by part, and BCN's PDF and XML of each version, kept by Croma.

Search norms by kind, number, year, date, status or the norm that modified them, or with free text over their names, titles and summaries; read one norm in full, article by article; or search inside the text of every article.

> [!NOTE]
>
> The whole source, organized and ready to query: every endpoint on this page answers in milliseconds. Every response carries `as_of`: how current the data is. [How datasets work](https://docs.usecroma.com/datasets.md).

## Search the norms

`POST /cl/leychile/norms-search/v1` [Dataset](https://docs.usecroma.com/datasets.md)

One search over every law, code, DFL, DL, auto acordado, treaty and supreme decree Croma keeps from Ley Chile.

| Field | Type | Notes |
| - | - | - |
| `query` | string | Optional words in Spanish matched against the name, number, title, common names, subjects and summary, e.g. `protección de datos personales` or `código del trabajo`. Every word must appear. |
| `type` | enum | Optional kind: `ley`, `codigo`, `dfl`, `dl`, `auto_acordado`, `tratado` or `decreto` (supreme decrees). |
| `number` | string | Optional number, e.g. `21450` for Ley 21.450. Dots are ignored. Add `type` to name one norm. |
| `year` | integer | Optional year of publication. 0 searches every year. Default `0`. |
| `from_date` | string | Optional: only norms published on or after this date, `yyyy-mm-dd`. |
| `to_date` | string | Optional: only norms published on or before this date, `yyyy-mm-dd`. |
| `status` | enum | Optional: `in_force` or `repealed`. |
| `modified_by` | string | Optional `norm_id` of a modifying norm, e.g. `1219906`: only the norms it modified. |
| `page` | integer | 1-based page number. Default `1`. |
| `per_page` | integer | Results per page (1-50). Default `20`. |

```bash theme={"dark"}
curl https://api.croma.run/cl/leychile/norms-search/v1 \
  -H "Authorization: Bearer $CROMA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "query": "protección de datos personales", "type": "ley" }'
```

Returns `as_of` (how current the data is), the applied filters, `total` and `total_is_exact`, `page`, `per_page`, `total_pages`, `count` and `results[]`: best matches first when there is a `query`, otherwise the most recently published first. Every result carries `norm_id` (BCN's permanent id, e.g. `1176603`), `name` (e.g. `Ley 21450`), `type`, `number`, `title`, `common_names`, `issuing_bodies`, `publication_date`, `promulgation_date`, `year`, `current_version_date` (when the text in force today took effect) and `version_kind`, `repealed` and `repeal_date`, `treaty`, `subjects`, `summary`, `categories`, `gazette`, `gazette_number` and `cve` (the Diario Oficial's verification code), `version_count`, `article_count`, `official_url` (the norm's page at Ley Chile), `source_document_url`, and `document_url` and `xml_url` (Croma's copies of BCN's PDF and XML of the current version). Fields BCN does not state are null.

> [!NOTE]
>
> Search results leave out the text, the versions and the document history; the Ley Chile Norm endpoint returns them.

> [!NOTE]
>
> Croma reads new norms every day and the norms they modify until BCN publishes their new consolidated text, and checks the whole collection again once a month.

## One norm, in full

`POST /cl/leychile/norm/v1` [Dataset](https://docs.usecroma.com/datasets.md)

| Field | Type | Notes |
| - | - | - |
| `norm_id` | string | **Required.** The norm's `norm_id` from a search result, e.g. `1176603`, its `official_url`, or its kind and number, e.g. `Ley 21450`, `DFL 1`, `Decreto 100`. A kind and number several norms share answers the most recent. |
| `offset` | integer | Position of the first part of the text to return (0 is the heading). Pass the previous response's `next_offset` to read on. Default `0`. |
| `limit` | integer | How many parts to return (1-500). Most laws fit in one response; a code takes several. Default `100`. |

```bash theme={"dark"}
curl https://api.croma.run/cl/leychile/norm/v1 \
  -H "Authorization: Bearer $CROMA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "norm_id": "Ley 21450" }'
```

Returns `as_of`, `found`, `norm_id` and `norm`, which carries everything the search returns plus `versions` (every version of the text, newest first, each with its `kind`, `from_date`, `to_date`, `url` and `modified_by`: the norms whose changes produced the next version, with their `norm_id`, `type`, `number`, `title`, `change`, `publication_date` and `effective_date`), `modified_by_ids`, `document_versions` (every PDF and XML Croma has kept, with `version_date`, `document_url`, `xml_url` and `bytes`), `modifies` (the norms whose version history lists it as modifying them), and `articles`, a run of the parts of the current text with `offset`, `has_more` and `next_offset`. Every result carries `norm_id` (BCN's permanent id, e.g. `1176603`), `name` (e.g. `Ley 21450`), `type`, `number`, `title`, `common_names`, `issuing_bodies`, `publication_date`, `promulgation_date`, `year`, `current_version_date` (when the text in force today took effect) and `version_kind`, `repealed` and `repeal_date`, `treaty`, `subjects`, `summary`, `categories`, `gazette`, `gazette_number` and `cve` (the Diario Oficial's verification code), `version_count`, `article_count`, `official_url` (the norm's page at Ley Chile), `source_document_url`, and `document_url` and `xml_url` (Croma's copies of BCN's PDF and XML of the current version). Fields BCN does not state are null. Each part carries `norm_id`, `norm_name`, `norm_type`, `part_id` (BCN's id for the part, stable across versions), `position` (its place in the text, 0 for the heading), `level` and `parent_part_id` (the chapter or title it sits in), `kind` (`Artículo`, `Capítulo`, `Título`, `Disposición Transitoria`, `Anexo`, `Encabezado`, `Promulgación`...), `name` (e.g. `1` for Artículo 1), `heading`, `text`, `transitory`, `repealed` and `version_date` (the version its text comes from).

> [!NOTE]
>
> Long norms are read a run of parts at a time: send `offset` and `limit`, then pass `next_offset` back as `offset` until `has_more` is false.

> [!NOTE]
>
> A norm Croma does not hold returns `found: false` with HTTP 200, not an error.

## Search inside the articles

`POST /cl/leychile/articles-search/v1` [Dataset](https://docs.usecroma.com/datasets.md)

Find the article that says something, across every norm or within one.

| Field | Type | Notes |
| - | - | - |
| `query` | string | Optional words in Spanish matched against the text and heading of every part, e.g. `indemnización por años de servicio`. Every word must appear. |
| `norm_id` | string | Optional `norm_id`, e.g. `207436`: only the parts of that norm, in the order of its text when there is no `query`. |
| `page` | integer | 1-based page number. Default `1`. |
| `per_page` | integer | Results per page (1-50). Default `20`. |

```bash theme={"dark"}
curl https://api.croma.run/cl/leychile/articles-search/v1 \
  -H "Authorization: Bearer $CROMA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "query": "indemnización por años de servicio" }'
```

Returns `as_of`, `query`, `norm_id`, `total` and `total_is_exact`, `page`, `per_page`, `total_pages`, `count` and `results[]`: best matches first when there is a `query`, otherwise in the order of the text. Each part carries `norm_id`, `norm_name`, `norm_type`, `part_id` (BCN's id for the part, stable across versions), `position` (its place in the text, 0 for the heading), `level` and `parent_part_id` (the chapter or title it sits in), `kind` (`Artículo`, `Capítulo`, `Título`, `Disposición Transitoria`, `Anexo`, `Encabezado`, `Promulgación`...), `name` (e.g. `1` for Artículo 1), `heading`, `text`, `transitory`, `repealed` and `version_date` (the version its text comes from).

> **[Full reference](https://docs.usecroma.com/api-reference/overview.md)**
>
> Schemas, all response fields, and an interactive playground.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.