# Brazil Municipal Finance - SICONFI Fiscal Data (RREO & RGF) (`formative_cobia/brazil-municipal-finance`) Actor

Official fiscal indicators of Brazilian municipalities and states from SICONFI (Tesouro Nacional): revenue, expenses, health and education spending, primary result, payroll and debt versus Fiscal Responsibility Law limits, in one clean row per entity. Filter by state, city, IBGE code or population.

- **URL**: https://apify.com/formative_cobia/brazil-municipal-finance.md
- **Developed by:** [BR Open Data Tools](https://apify.com/formative_cobia) (community)
- **Categories:** Business, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 entities

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Brazil Municipal Finance – SICONFI Fiscal Data (RREO & RGF)

Get the official **fiscal indicators of Brazilian municipalities and states** from SICONFI, the public finance reporting system of the Tesouro Nacional, in **one clean row per entity**:

- **Budget**: forecast and collected revenue, appropriations, committed / liquidated / paid expenses and the budget result.
- **Net current revenue (RCL)**, **primary and nominal results** (with the primary result target) and **carried-over payables** (restos a pagar).
- **Health and education**: share of tax revenue applied to health (ASPS) and to education (MDE), FUNDEB payroll share and the legal minimums.
- **Fiscal Responsibility Law (LRF) limits**: payroll as a share of RCL against the maximum, prudential and alert limits, and net consolidated debt against the Senate limit, with a ready-made status for each.
- **Credit operations** and **net cash** after carried-over payables.

Filter by state, city, IBGE code, population or capitals, for any year since 2015 and any two-month period. Monitoring mode returns only the entities whose reports appeared since your last run.

### Who uses it

- Credit and risk analysts who follow municipalities and states.
- Government suppliers and banks that check a public client's fiscal health.
- Public management consultancies, auditors and watchdogs.
- Data journalists, researchers and civic-tech projects that compare cities.

### Why use it

SICONFI publishes the LRF reports as long tables: hundreds of lines per annex, labels that change between years, full and simplified versions, and four-monthly or semiannual periods. This Actor does the work for you:

- It reads the two **official summary annexes** (RREO Annex 14 and RGF Annex 6). That means about **2 requests per entity** instead of dozens.
- It **detects simplified reports** on its own. Municipalities under 50,000 inhabitants may file a simplified RREO and a semiannual RGF.
- Numbers come as numbers and statuses are computed for you: `within_limits`, `above_alert_limit`, `above_prudential_limit`, `above_max_limit`.
- Entities that have not filed yet are listed in the run summary and are **not charged**.
- Filters ignore accents. Add the state to tell homonyms apart, e.g. `Bom Jesus - PI`.

### Input

| Field | Description | Default |
|---|---|---|
| **Fiscal year** | 2015 or later. | last year |
| **Bimester** | 1 (Jan–Feb) to 6 (Nov–Dec, the full year). The fiscal-limits report uses the last period closed by the end of this bimester. | 6 |
| **Entities** | `municipalities`, `states` (with the Federal District) or `all`. | municipalities |
| **States (UF)** | State codes, e.g. `SP`, `RJ`. Empty = all. | – |
| **Cities** | Municipality names, optionally with the state (`Bom Jesus - PI`). | – |
| **IBGE codes** | 7 digits for a municipality (`3550308`), 2 for a state (`35`). | – |
| **Minimum / Maximum population** | Population filters. | – |
| **State capitals only** | The 27 capitals. | off |
| **Budget, health and education (RREO)** | RREO Annex 14. | on |
| **Payroll and debt limits (RGF)** | RGF Annex 6, executive branch. | on |
| **Include entities without reports** | Output (and charge) a row for entities that have not filed. | off |
| **Only new reports (monitoring)** | Skip entities already delivered with the same filters. | off |
| **Max entities / Max requests / Max run time** | Hard limits that control cost. | 100 / 400 / 600 s |

#### Example input

```json
{
  "year": 2025,
  "states": ["MG"],
  "minPopulation": 100000,
  "maxItems": 50
}
```

### Output

One row per entity, year and bimester. Example (municipality of São Paulo, 2025; some fields left out):

```json
{
  "ibgeCode": "3550308",
  "name": "São Paulo",
  "entityType": "municipality",
  "state": "SP",
  "region": "Southeast",
  "isCapital": true,
  "population": 12200180,
  "cnpjFormatted": "46.395.000/0001-39",
  "reportingInstitution": "Prefeitura Municipal de São Paulo - SP",
  "year": 2025,
  "bimester": 6,
  "budgetReportType": "full",
  "fiscalLimitsReportType": "full",
  "fiscalLimitsPeriodicity": "four_monthly",
  "fiscalLimitsPeriod": 3,
  "revenueForecastUpdated": 130073653592.35,
  "revenueRealized": 123451799491.36,
  "revenueExecutionPercent": 94.91,
  "expensesCommitted": 123571806691.25,
  "expensesPaid": 116798206872.08,
  "budgetResult": -120007199.89,
  "netCurrentRevenue": 100652954891.44,
  "primaryResult": -3285642516.09,
  "primaryResultTarget": -14707140391.0,
  "educationSpendingPercent": 25.17,
  "healthSpendingPercent": 23.85,
  "personnelExpense": 26857642928.68,
  "personnelExpensePercent": 26.82,
  "personnelLimitMaxPercent": 54.0,
  "personnelStatus": "within_limits",
  "netConsolidatedDebtPercent": 19.64,
  "debtLimitPercent": 120.0,
  "debtStatus": "within_limit",
  "netCashAfterPayables": 14105972288.52,
  "observationKey": "3550308:2025:B6:RG",
  "fetchedAt": "2026-11-15T09:42:59+00:00",
  "attribution": "Fonte: Tesouro Nacional - SICONFI (dados abertos, RREO e RGF declarados pelos entes)"
}
```

Amounts are in Brazilian reais (BRL). Percentages are numbers such as `26.82` for 26.82%. Fields from a report that is turned off are not included. Fields the entity did not fill in are `null`.

A run summary is saved as **SUMMARY** in the run's key-value store. It holds the entities matched and processed, how many had each report and of which kind, the IBGE codes of entities without reports, errors, warnings, requests used, duration and the stop reason.

### Cost control

- **Max entities** caps the number of billable rows.
- **Max requests** and **Max run time** cap the work done. The run stops cleanly and keeps what was already delivered.
- The maximum charge you set for a run is respected: the Actor stops before exceeding it.
- Entities without reports are free unless you ask for them as rows.

### Speed

The SICONFI API asks for at most one request per second, and the Actor respects that. Expect about 2 seconds per entity: around 4 minutes for 100 municipalities, or about 30 minutes for a large state such as Minas Gerais (853 municipalities, with **Max run time** set to 3600).

### Pricing

Pay per event: a small fee when a run starts and a fee per entity delivered. See the pricing tab for current values.

### Tips

- **Annual comparison**: use bimester 6 of the previous year. Most entities file it by the end of January and the full-year RGF by the end of January or February.
- **Monitoring**: during the year, schedule the Actor with **Only new reports** on. An entity is delivered when its report appears, and again when a missing report is filed later. The memory is kept in a named key-value store in your account (`brazil-municipal-finance-state`), separately for each combination of filters.
- **States**: set **Entities** to `states`. The debt limit for states is 200% of RCL; for municipalities it is 120%.

### Limitations

- Values are exactly as **declared by each entity** to SICONFI. Filing mistakes are not corrected: for example, a percentage typed in an amount field, or a missing "% applied".
- Many municipalities leave the health and education lines of the summary annex blank. In a test with all municipalities of Rio de Janeiro for 2025, about 4 in 10 did. These fields are then `null`. Budget, payroll and debt figures are much more complete.
- The fiscal-limits figures are those of the **executive branch** (city hall or state government). The legislative branch files its own RGF.
- `budgetResult` is collected revenue minus committed expenses, computed by the Actor. The other figures come from the reports.
- Some entities file late or not at all. They are listed in the run summary.
- If the SICONFI API is temporarily unavailable, the Actor retries 3 times with increasing waits. After 3 entities in a row fail, it stops with a clear error.

### Data source and license

- Source: SICONFI open data API of the Secretaria do Tesouro Nacional, specifically the RREO (Relatório Resumido da Execução Orçamentária), the RGF (Relatório de Gestão Fiscal) and the registry of federation entities. No login or API key is required.
- These are public open data under the Brazilian access-to-information and open data policy, and the API documentation declares the Apache 2.0 license. Keep the attribution "Fonte: Tesouro Nacional - SICONFI" when you share data from this Actor.
- No personal data is collected. Only government entities and their published accounts.
- This Actor is an independent tool and is not affiliated with or endorsed by the Tesouro Nacional.

# Changelog

This Actor's version history is a separate document: https://apify.com/formative_cobia/brazil-municipal-finance/changelog.md

# Actor input Schema

## `year` (type: `integer`):

Year of the reports (2015 or later). Empty = last year, the most recent full year.

## `bimester` (type: `integer`):

Two-month period of the budget report (1 = Jan-Feb ... 6 = Nov-Dec, the full year). The fiscal-limits report uses the last period closed by the end of this bimester.

## `entityType` (type: `string`):

Municipalities, states (including the Federal District) or both.

## `states` (type: `array`):

Two-letter state codes, e.g. SP, RJ, MG. Empty = all states.

## `cities` (type: `array`):

Municipality names. Accents and capitals are ignored. Add the state to avoid homonyms, e.g. "Bom Jesus - PI".

## `ibgeCodes` (type: `array`):

Only these entities: 7 digits for a municipality (e.g. 3550308) or 2 digits for a state (e.g. 35). Overrides the entity type.

## `minPopulation` (type: `integer`):

Only entities with at least this population.

## `maxPopulation` (type: `integer`):

Only entities with at most this population.

## `capitalsOnly` (type: `boolean`):

Only the 27 capital cities.

## `includeBudget` (type: `boolean`):

Revenue, expenses, net current revenue, primary result, carried-over payables, health and education spending (RREO Annex 14). One request per entity.

## `includeFiscalLimits` (type: `boolean`):

Payroll and net debt as a share of net current revenue, with the legal limits and a status (RGF Annex 6, executive branch). One request per entity.

## `includeEntitiesWithoutReports` (type: `boolean`):

Also output a row (charged) for entities that have not filed the reports. When off, they are only listed in the run summary, free of charge.

## `onlyNew` (type: `boolean`):

Skip entities already delivered by a previous run with the same filters. An entity is delivered again when a missing report is filed later.

## `maxItems` (type: `integer`):

Maximum number of rows to deliver.

## `maxRequests` (type: `integer`):

Hard limit of requests to the SICONFI API (about 2 per entity; the API allows 1 request per second).

## `maxRunSeconds` (type: `integer`):

The run stops cleanly after this time and keeps what was already delivered.

## Actor input object example

```json
{
  "year": 2025,
  "bimester": 6,
  "entityType": "municipalities",
  "states": [
    "AC"
  ],
  "capitalsOnly": false,
  "includeBudget": true,
  "includeFiscalLimits": true,
  "includeEntitiesWithoutReports": false,
  "onlyNew": false,
  "maxItems": 5,
  "maxRequests": 400,
  "maxRunSeconds": 60
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `summary` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "year": 2025,
    "states": [
        "AC"
    ],
    "maxItems": 5,
    "maxRunSeconds": 60
};

// Run the Actor and wait for it to finish
const run = await client.actor("formative_cobia/brazil-municipal-finance").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "year": 2025,
    "states": ["AC"],
    "maxItems": 5,
    "maxRunSeconds": 60,
}

# Run the Actor and wait for it to finish
run = client.actor("formative_cobia/brazil-municipal-finance").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "year": 2025,
  "states": [
    "AC"
  ],
  "maxItems": 5,
  "maxRunSeconds": 60
}' |
apify call formative_cobia/brazil-municipal-finance --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,formative_cobia/brazil-municipal-finance"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/g8Ai2sNW6cbt8vEvc/builds/TFm1XhcKMctxH7jn7/openapi.json
