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

# PGFN

> What Brazilian companies owe the Union: search every active federal tax, social security and FGTS debt in the dívida ativa by CNPJ, name, state, status and amount, and total one company's debts.

The Procuradoria-Geral da Fazenda Nacional inscribes in the dívida ativa
every federal debt a company has not paid: taxes such as IRPJ, COFINS, PIS and
the Simples Nacional, social security contributions, and the FGTS. Each debt
comes with its status (in collection, negotiated, guaranteed, suspended by a
court), whether it is being enforced in court, and its consolidated amount.
These inscriptions are public by law (CTN art. 198 §3 II).

Companies only: about 33 million debts, refreshed each time PGFN publishes a
quarterly release. Search across them, or look one company up by CNPJ, or by
its 8-character root for every establishment, and get what it owes in total.

<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](/datasets).
</Note>

## Search debts

`POST /br/pgfn/debts-search/v1` <a className="dataset-pill" href="/datasets">Dataset</a>

Searches every company debt by any combination of name, CNPJ or root, regime,
state, status, role, court and amount.

| Field             | Type    | Notes                                                                                             |
| ----------------- | ------- | ------------------------------------------------------------------------------------------------- |
| `query`           | string  | Optional. Words in the company's name; no stemming.                                               |
| `document_number` | string  | Optional. A CNPJ, with or without punctuation, or its 8-character root for every establishment.   |
| `regime`          | enum    | Optional. `nao_previdenciario`, `previdenciario` or `fgts`.                                       |
| `state`           | string  | Optional. The company's state, e.g. `SP`.                                                         |
| `status_type`     | enum    | Optional. `in_collection`, `tax_benefit`, `guaranteed`, `suspended_by_court` or `in_negotiation`. |
| `debtor_type`     | enum    | Optional. `principal`, `co_responsible` or `joint`.                                               |
| `in_court`        | enum    | Optional. `yes`, `no` or `any`. Default `any`.                                                    |
| `amount_min`      | number  | Optional. Minimum amount in reais. Default `0`.                                                   |
| `amount_max`      | number  | Optional. Maximum amount in reais; `0` for none. Default `0`.                                     |
| `page`            | integer | Optional. 1-based page. Default `1`.                                                              |
| `per_page`        | integer | Optional. Results per page, 1-50. Default `20`.                                                   |

```bash theme={"dark"}
curl https://api.croma.run/br/pgfn/debts-search/v1 \
  -H "Authorization: Bearer $CROMA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "query": "construtora", "in_court": "yes", "per_page": 10 }'
```

Returns `as_of` (how current the data is), the applied filters, `total`, `page`, `per_page`, `total_pages`, `count` and `debts[]`, largest amount first.

Every debt carries `regime` (`nao_previdenciario`, `previdenciario` or `fgts`), `inscription_number`, `document_number` (the CNPJ, 14 characters), `document` (`12.345.678/0001-90`), `cnpj_root`, `debtor_name`, `debtor_type` (`principal`, `co_responsible` or `joint`), `state`, `responsible_unit`, `registering_unit` (FGTS), `collecting_entity` (`pgfn` or `caixa`), `status_type` (`in_collection`, `tax_benefit`, `guaranteed`, `suspended_by_court` or `in_negotiation`), `status` (PGFN's detailed wording), `revenue_type`, `registered_on` (`yyyy-mm-dd`), `in_court`, `amount` (reais, consolidated with legal charges) and `reference_month` (`yyyy-mm` of the release).

<Note>
  An inscription with several debtors has a row for each, and every row carries
  the whole inscription's `amount`. Add up `principal` rows only; the debtor
  lookup below does that for you.
</Note>

## One company's debts

`POST /br/pgfn/debtor/v1` <a className="dataset-pill" href="/datasets">Dataset</a>

Totals what one company owes the Union, by CNPJ or by root.

| Field             | Type   | Notes                                                                                                                     |
| ----------------- | ------ | ------------------------------------------------------------------------------------------------------------------------- |
| `document_number` | string | **Required.** A CNPJ, e.g. `33.000.167/0001-01`, or its 8-character root, e.g. `33000167`, to add up every establishment. |

```bash theme={"dark"}
curl https://api.croma.run/br/pgfn/debtor/v1 \
  -H "Authorization: Bearer $CROMA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "document_number": "33.000.167/0001-01" }'
```

Returns `found`, `document_number`, `as_of`, `reference_month`, `debtor_name`, `totals` and `debts[]` (the 50 largest).

`totals` carries `debts` (every debt the company appears on), `principal_debts`, `principal_amount` (what the company owes as principal debtor, in reais), `in_court_amount`, `by_regime` (`{ debts, amount }` for each regime) and `complete` (false when the company has more than 10,000 debts and only the largest were summed). Co-responsible and joint debts count in `debts` but not in the amounts, since they repeat another debtor's amount.

<Note>
  A company that owes the Union nothing PGFN has inscribed returns
  `found: false` with HTTP 200, not an error.
</Note>

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