> ## 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.

# Función Pública

> Search the Gestor Normativo, the Colombian state's curated register of the norms that govern public administration, and read any of them in full.

The Departamento Administrativo de la Función Pública keeps the Gestor
Normativo: 40,000 norms that govern Colombian public administration, from a 1620
ordinance to this week's circular. It is not a gazette and not a court reporter.
It is where a norm is published with its editorial apparatus: the subjects it is
filed under, the later norms recorded as having added to, modified or repealed
it, and the consolidated text.

Laws, decrees, acts of Congress, rulings of the Consejo de Estado and the
thousands of conceptos in which Función Pública answers how the rules apply are
all in the same register, and both endpoints reach across all of them at once.

## Search the register

`POST /co/funcion-publica/norms-search/v1` One search over the full text of every norm in the register, which the Gestor Normativo's own site does not offer: it pages ten at a time and stops at ten thousand results.

| Field           | Type    | Notes                                                                                                                                                                                                                     |
| --------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `query`         | string  | Optional words matched against the norm's citation, the register's one-line description and the full text of the norm.                                                                                                    |
| `document_type` | string  | Optional kind of instrument: `ley`, `decreto`, `concepto`, `sentencia`, `acuerdo`, `resolucion`, `circular-externa`, `decreto-ley`, `acto-legislativo`, `constitucion-politica` and others. Case and accents are ignored. |
| `year`          | integer | Optional year in the norm's own designation (the 2008 of `Ley 1266 de 2008`). This is how the register files a norm, and it is not always the year it was issued. 0 searches every year. Default `0`.                     |
| `number`        | string  | Optional exact number. Leading zeros are optional: `7` and `007` find the same norm.                                                                                                                                      |
| `entity`        | string  | Optional issuing entity, matched from the start of the name: `congreso` finds the Congreso de la República. `nivel-nacional` is how the register labels norms of the national executive.                                  |
| `subject`       | string  | Optional subject heading the register files the norm under, exactly as it publishes it, e.g. `HABEAS DATA`, `CARRERA ADMINISTRATIVA`. The `subjects[]` of any result are valid values.                                    |
| `issued_from`   | string  | Optional: only norms issued on or after this date, `yyyy-mm-dd`.                                                                                                                                                          |
| `issued_to`     | string  | Optional: only norms issued on or before this date, `yyyy-mm-dd`.                                                                                                                                                         |
| `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/co/funcion-publica/norms-search/v1 \
  -H "Authorization: Bearer $CROMA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "query": "habeas data", "document_type": "ley" }'
```

<Note>
  The whole source, organized and ready to query: this endpoint answers in milliseconds, at any hour, the same way every time. Every response carries `as_of`: how current the data is.
</Note>

Returns `as_of` (how current the data is), the applied filters, `total`
(matches across every page), `page`, `per_page`, `total_pages`, `count` and
`results[]`, most recent first. Every result carries `id`, `title` (how the norm is cited), `document_type` and
`document_type_key`, `number` and `number_key` (the same number with leading zeros
dropped), `year` (the year in the norm's own designation), `entity` and
`entity_key` (who issued it), `summary` (the register's one-line description of
what it does), `issued_at`, `effective_at`, `published_in`, `subjects[]` and
`topics[]` (what it is about, as the register classifies it), `amendments[]`
(later norms it records as having added to, modified or repealed this one, each
with the `norm_id` to look up in turn), `official_url` and `document_url`.

<Note>
  Search results leave out the norm's body: a single norm can run to hundreds of
  thousands of characters. `query` still matches against it, so a search for a
  phrase buried in an article finds the norm; read the text itself with the
  Función Pública Norm endpoint.
</Note>

## One norm, in full

`POST /co/funcion-publica/norm/v1`

| Field     | Type    | Notes                                                                                                                                                         |
| --------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `norm_id` | string  | **Required.** The `id` from the search results, e.g. `34488` for Ley 1266 de 2008. The `norm_id` inside another norm's `amendments[]` is the same identifier. |
| `offset`  | integer | First character of the text to return. Pass the previous response's `next_offset` to read on. Default `0`.                                                    |
| `limit`   | integer | How many characters of the text to return. Most norms fit in one response; the longest run past a million characters. Default `200000`.                       |

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

<Note>
  The whole source, organized and ready to query: this endpoint answers in milliseconds, at any hour, the same way every time. Every response carries `as_of`: how current the data is.
</Note>

Returns `as_of`, `found`, `norm_id` and `norm`, which carries everything the
search returns plus `content`: a window onto the norm's text, with `text`,
`offset`, `total_length`, `has_more` and `next_offset`. Every result carries `id`, `title` (how the norm is cited), `document_type` and
`document_type_key`, `number` and `number_key` (the same number with leading zeros
dropped), `year` (the year in the norm's own designation), `entity` and
`entity_key` (who issued it), `summary` (the register's one-line description of
what it does), `issued_at`, `effective_at`, `published_in`, `subjects[]` and
`topics[]` (what it is about, as the register classifies it), `amendments[]`
(later norms it records as having added to, modified or repealed this one, each
with the `norm_id` to look up in turn), `official_url` and `document_url`.

<Note>
  The register's longest norms run past a million characters, so the body is read
  a range at a time: send `offset` and `limit`, then pass the response's
  `next_offset` back as `offset` until `has_more` is false. `content` is null on
  the few norms the register publishes without a body, and on the roughly one in
  seven whose text it does not serve.
</Note>

<Note>
  An id the register does not carry returns `found: false` with HTTP 200, not an
  error. That includes an id another norm's `amendments[]` points at: the
  register occasionally cites a norm it no longer serves.
</Note>

<Card title="Full reference" icon="code" href="/api-reference/overview">
  Schemas, all response fields, and an interactive playground.
</Card>
