> ## Documentation Index
> Fetch the complete documentation index at: https://octo-98895abd.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Funds

> CVM fund registry and monthly fundamentals — the api.funds view plus search_funds, fund_profile, and fund_nav.

<Note>
  **Parameters, response columns and types are generated** from the SQL catalog and
  render under **Endpoints → Funds** in the sidebar. This page carries what a
  schema cannot: the conventions, the nulls that are deliberate, and the traps.
</Note>

### Overview

Brazilian investment vehicles as disclosed to the CVM, keyed by **CNPJ**.

| `entity_type` | Vehicle |
| - | - |
| `fi` | Fundos de Investimento (open-ended funds) |
| `fidc` | Fundos de Investimento em Direitos Creditórios (receivables) |
| `fii` | Fundos de Investimento Imobiliário (real estate) |
| `fip` | Fundos de Investimento em Participações (private equity) |
| `fiagro` | Fundos de Investimento nas Cadeias Produtivas Agroindustriais |

CNPJ input is stripped to its 14 digits, so `12.345.678/0001-90` and `12345678000190` are the same argument. Monthly periods are keyed on the first day of the month.

**Note**: ETFs are carved out of this universe and are not in `api.funds`. Post-CVM-175 share classes make their NAV series structurally different from the rest of the fund population, so they are ranked and served separately.

### `GET /funds`

The registry view: one row per `(cnpj, entity_type)` — what we hold, not what the fund is worth.

<Warning>
  **This view has no built-in cap — always send `limit`.** The registry is large, and an unbounded read is cut at 1,000 rows server-side with no signal beyond `Content-Range`.
</Warning>

| Field | What to know |
| - | - |
| `cnpj` | Filter as `cnpj=eq.12345678000190` — digits only, the view does no normalization. |
| `fund_name` | Nullable: the CVM registry feed does not cover every CNPJ that appears in the periodic filings. |
| `status` / `fund_class` | Registry status and `tp_fundo`, as published. Nullable, same reason. |
| `last_period` | For `fip`, periods are yearly and mapped to January 1 / December 31 of the year. |
| `n_reports` | Count of distinct periods held. Coverage, not a quality score. |

<CodeGroup>
  ```bash curl theme={null}
  curl -s -G "$SILO_URL/funds" \
    -H "apikey: $SILO_ANON_KEY" \
    --data-urlencode "select=cnpj,fund_name,entity_type,first_period,last_period,n_reports" \
    --data-urlencode "entity_type=eq.fidc" \
    --data-urlencode "order=n_reports.desc" \
    --data-urlencode "limit=3"
  ```

  ```python Python theme={null}
  params = {
      "select": "cnpj,fund_name,entity_type,first_period,last_period,n_reports",
      "entity_type": "eq.fidc",
      "order": "n_reports.desc",
      "limit": 3,
  }
  rows = requests.get(f"{URL}/funds", headers=H, params=params).json()
  ```

  ```javascript JavaScript theme={null}
  const { data } = await supabase
    .from('funds')
    .select('cnpj, fund_name, entity_type, first_period, last_period, n_reports')
    .eq('entity_type', 'fidc')
    .order('n_reports', { ascending: false })
    .limit(3)
  ```
</CodeGroup>

### `POST /rpc/search_funds`

Substring search over the registry, ordered by `latest_aum` descending, nulls last.

```sql theme={null}
api.search_funds(p_query       TEXT DEFAULT '',
                 p_entity_type TEXT DEFAULT NULL,
                 p_limit       INT  DEFAULT 50)
```

| Field | What to know |
| - | - |
| `p_query` | Case-insensitive substring, matched against **either the CNPJ or the fund name**. The default `''` matches everything. A fund whose `fund_name` is null can only be found by CNPJ. |
| `p_limit` | Clamped by tier: **25** anonymous, 200 signed in. A null is treated as 50; a larger value is silently reduced, not refused. |
| `latest_aum` | Most recent non-null net assets for that `(cnpj, entity_type)`. Nullable — a fund with no reported NAV sorts last rather than being dropped or zero-filled. |

```bash theme={null}
curl -s -X POST "$SILO_URL/rpc/search_funds" \
  -H "apikey: $SILO_ANON_KEY" \
  -H "Content-Type: application/json" \
  -d '{"p_query":"multisetorial","p_entity_type":"fidc","p_limit":10}'
```

No match returns `[]`.

### `POST /rpc/fund_profile`

One fund's summary card: coverage plus peak and latest AUM.

```sql theme={null}
api.fund_profile(p_cnpj TEXT)
```

| Field | What to know |
| - | - |
| `n_months_reported` | Distinct periods held — the same count as the view's `n_reports`. |
| `peak_aum` / `latest_aum` | Maximum net assets ever reported; net assets at the most recent non-null period. |
| `is_active` | `last_period >= CURRENT_DATE - 90 days`. A **filing-recency** flag, not a legal status — CVM publishes on a one-to-two month lag, so read it alongside `status` and [`coverage`](/api-docs/coverage). |

```bash theme={null}
curl -s -X POST "$SILO_URL/rpc/fund_profile" \
  -H "apikey: $SILO_ANON_KEY" \
  -H "Content-Type: application/json" \
  -d '{"p_cnpj":"12.345.678/0001-90"}'
```

**Note**: a CNPJ in the registry with **no monthly fundamentals** returns `[]` — the profile is built from the monthly facts, so there is nothing to summarize. A CNPJ filing under **more than one `entity_type`** returns one row per type; do not assume a single row.

### `POST /rpc/fund_nav`

The monthly fundamentals series for one CNPJ — the fund-side equivalent of `quote_history`.

```sql theme={null}
api.fund_nav(p_cnpj        TEXT,
             p_from        DATE DEFAULT '2019-01-01',
             p_to          DATE DEFAULT CURRENT_DATE,
             p_entity_type TEXT DEFAULT NULL)
```

`p_from`'s default is a **fixed date**, not a rolling window — omit it for the full stored history. `p_entity_type` is needed only for the rare CNPJ that reports under two.

| Field | What to know |
| - | - |
| `period` | The filing period **as stored, per family** (see below). `date_trunc('month', period)` before aligning families. |
| `nav` | Net assets (`vl_patrim_liq`). The headline "fund size" figure. |
| `quota` | Unit quota value (`vl_quota`). **`fi` only** — null by construction elsewhere. |
| `quotaholders` | Unit-holders (`nr_cotst`). **`fi` and `fii` only.** |
| `delinquency` | Delinquent portfolio **value** (`vl_inadimpl`) in BRL — **`fidc` and `fiagro` only**. An amount, not a rate; divide by `nav` yourself. |
| `monthly_yield` | Monthly yield percentage (`pct_yield_mes`). **`fii` only.** |
| `inflows` / `redemptions` | Gross monthly subscriptions / redemptions (`captc_mes` / `resg_mes`). **`fi` only.** |
| `assets` | Total assets (`vl_ativo`), as distinct from net assets. **`fii` only.** |

Rows are ordered by `period`, then `entity_type`.

#### Which columns each family files

Every family returns the same eleven columns, but each family's arm of the fact table fills only some; the rest are `NULL` **by construction**. So a null has two meanings: outside a family's list it is *not applicable* and carries no information; inside it, it is a blank in that month's filing. Machine-readable as `catalog().applicability.fund_nav.columns_by_family`, and it is what the [`panel`](/api-docs/panel) metric table's *Asset class* column is derived from.

| Family | `nav` | `quota` | `quotaholders` | `delinquency` | `monthly_yield` | `inflows` | `redemptions` | `assets` | `period` is |
| - | - | - | - | - | - | - | - | - | - |
| `fi` | ✓ | ✓ | ✓ | — | — | ✓ | ✓ | — | first of month |
| `fidc` | ✓ | — | — | ✓ (2025-01+) | — | — | — | — | **month-end** |
| `fiagro` | ✓ | — | — | ✓ | — | — | — | — | first of month |
| `fii` | ✓ | — | ✓ | — | ✓ | — | — | ✓ | first of month |
| `fip` | ✓ | — | — | — | — | — | — | — | 31-Dec, yearly |

<Warning>
  **FIDC `delinquency` starts in 2025-01 — a regime break, not a series.** CVM's pre-2025 monthly FIDC file (tab II/III) carries no delinquency field, so every `fidc` row through `2024-12-31` has `delinquency: null` — not zero, not clean books, not a missing month. From `2025-01-31` the tab IV/VI format is ingested and the field is filed on every row (a fund with none files `0`).

  Never chain-link, difference or average across 2024-12 → 2025-01; start the series at 2025-01. Published in `catalog().regime_breaks` and on the `funds_fidc` [`coverage`](/api-docs/coverage) row, so a program can check it rather than a reader remembering it.
</Warning>

```bash theme={null}
curl -s -X POST "$SILO_URL/rpc/fund_nav" \
  -H "apikey: $SILO_ANON_KEY" \
  -H "Content-Type: application/json" \
  -d '{"p_cnpj":"12345678000190","p_from":"2024-01-01","p_to":"2026-06-30"}'
```

```json theme={null}
[
  {
    "cnpj": "12345678000190", "period": "2025-03-31", "entity_type": "fidc",
    "nav": 388120044.12, "quota": null, "quotaholders": null,
    "delinquency": 9120044.7, "monthly_yield": null,
    "inflows": null, "redemptions": null, "assets": null
  }
]
```

A `fidc` row: `nav` and `delinquency` are the two columns that family files, the other six are null by construction, and `period` is the month's last day.

### Notes

* **Nulls here are real.** A column is null because the family does not file that field, or because the filing left it blank — never because a value was dropped or replaced. Nothing is forward-filled, and a month with no filing is an **absent row**, not a repeated one. Check `period` continuity before differencing.
* **One 1,000-row page, and it refuses above it** (`22023`). At a monthly grain 1,000 rows is over 80 years of one fund, so reaching it usually means the request is wrong rather than the fund.
* **Paging requires `p_entity_type`.** The cursor is a bare `period`, unique only *within* one family — 385 CNPJs file under two (`fi` and `fidc`) in the same month, so a bare-date cursor would skip or repeat a row at a page edge. Drop `p_after` to get the whole result with every row labelled by `entity_type`.

  ```json theme={null}
  { "p_cnpj": "05754060000113", "p_entity_type": "fi", "p_after": "" }
  { "p_cnpj": "05754060000113", "p_entity_type": "fi", "p_after": "2023-06-30" }
  ```

  In the SDK: `silo.iter_fund_nav("05754060000113", "fi")`, which raises locally if you leave the family out.
* **`period` and `period_month` are two conventions for the same month.** `period` is CVM's filed month-**end** date (`2024-01-31`); the trailing `period_month` is the first of that month (`2024-01-01`), which is how [`panel`](/api-docs/panel) keys fund observations. Join a nav series to a panel on `period_month`, not on `period`.
* **Empty results**: unknown CNPJ, or a real CNPJ with no filings in the window → `200 []`. A CNPJ that exists only as an ETF is absent from this universe by design. Passing `"p_from": null` explicitly returns `[]` — omit the key to get the default instead.


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