# Brazil Transferegov Discretionary Transfers (`kman-br/transferegov-discricionarias`) Actor

Query Brazil's official Transferegov Discricionarias e Legais open-data API in bulk: transfer programs and proposals filtered by year, state (UF), agency and status. Public API, no key, no proxy. Contact details, CPF and person names are dropped. Preparatory acts scope.

- **URL**: https://apify.com/kman-br/transferegov-discricionarias.md
- **Developed by:** [Kman](https://apify.com/kman-br) (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 $3.00 / 1,000 record returneds

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 Transferegov Discretionary Transfers — bulk official API (Radar em lote Transferegov Discricionárias e Legais)

Query Brazil's official **Transferegov Discricionárias e Legais** open-data API in bulk and get **transfer programs** or **proposals**, filtered by year, state (UF), agency and status. **Public API, no key, no proxy.** Contact details, CPF and person names are dropped.

> Independent tool. Not affiliated with Transferegov.br, the Ministry of Management and Innovation, or the Brazilian federal government.
>
> Source: **API de Dados Abertos do módulo de Transferências Discricionárias e Legais do Transferegov.br** (`https://api-publica.transferegov.gestao.gov.br/discricionarias`). First official delivery (28 Oct 2026): preparatory acts (Atos Preparatórios). Three further deliveries are planned.

**Keywords:** Transferegov, transferências discricionárias e legais, convênios, atos preparatórios, programas federais, propostas, API dados abertos, bulk, lote, Brazil, Brasil.

### How it works

- Official HTTP JSON only. No browser, no residential proxy, no login.
- `recurso=programas` calls `GET /todos-programas`. `recurso=propostas` calls `GET /propostas`.
- At least one filter is required. An unfiltered call is rejected: the API reports more than 1.2 million program rows.
- Page size 50, 200 ms pause between pages, sliding window 30 requests / 60 s, backoff on 429/5xx.
- Internal deadline: 150 s from `ACTOR_STARTED_AT`, or `ACTOR_TIMEOUT_AT` minus 20 s, whichever comes first. Default run `timeoutSecs`: 180. Memory: 256 MB.
- Allow-listed output fields only. Email, phone, fax, CPF, person names, street address and bank account fields are removed.
- The official /todos-programas API repeats the same id_programa across states (uf_programa), legal natures and, in observed cases, four exact copies of each combination. The Actor **groups by id_programa** (or id_proposta), merges those dimensions into lists, and **charges one item per unique program**. linhas_agrupadas shows how many source rows were folded.
- Up to **500** items per Apify run; **100** when `TG_ORIGEM=api.market`. `TG_ORIGEM` must be set (`apify` or `api.market`); an empty value fails, so an api.market build cannot silently inherit the Apify cap. Default `maxItems`: 100.

### Input

| Field | Type | Notes |
|---|---|---|
| `recurso` | `"programas"` | `"propostas"` | Prefill: `programas`. |
| `ano` | string | YYYY. Prefill: `2026`. Maps to `ano_programa` or `ano_proposta`. |
| `uf` | string | Two-letter state. Prefill: `SP`. |
| `situacao` | string | Official status (e.g. `DISPONIBILIZADO`). Do not send `ATIVO` for programs (HTTP 422). |
| `orgaoSuperior`, `orgao`, `codigoPrograma`, `idPrograma`, `nomePrograma`, `modalidade` | string | Optional filters. |
| `idProposta`, `numeroProposta`, `cnpjProponente` | string | Proposal filters. CNPJ must have 14 digits. Do not send CPF. |
| `maxItems` | integer | Prefill 20, default 100, max 500. |

### Output (`status: ok`)

Programs: `id_programa`, `cod_programa`, `nome_programa`, `sit_programa`, `uf_programa`, agency fields, dates for proposal intake, modality, plus `fonte`, `source_url`, `retrieved_at`, `warnings`, `tipo`, `status`.

Proposals: identifiers, entity name, **CNPJ** (`cd_identif_proponente`), municipality, UF, object, amounts, status. No email, phone, fax, street address, CPF or person names.

`RUN_SUMMARY` includes `data_ultima_atualizacao` from `GET /data-atualizacao`.

### Pricing (proposed PPE — pending owner approval to publish)

| Event | When | Price |
|---|---|---|
| `inicio-run` | Once after valid input | **US$0.01** |
| `item-retornado` | Each `ok` record | **US$0.003** |

Invalid input is not charged. Error items are free.

**Cost rationale:** 256 MB, HTTP-only, no proxy. 100 items ≈ 2 pages of 50 plus one timestamp call, typically 5–15 s, worst case ~60 s → about **US$0.00083** compute (0.25 GB × 60/3600 CU × US$0.20). Revenue for 100 ok items: US$0.01 + US$0.30 = **US$0.31**; after Apify's 20% cut ≈ **US$0.248**. Start covers boot; per-item fee keeps margin. Official CSV already covers unfiltered dumps.

### Privacy / LGPD

This Actor uses **public, non-personal data** from an official open-data API. It is built to return **institutional** records (federal programs, legal-entity proponents). It **drops** CPF, person names, parliamentary personal identifiers, email, phone, fax, street address and bank-account fields. If `cd_identif_proponente` has 11 digits, the proponent is treated as a natural person: the ID is masked (`***.***.***-**`) and `nm_proponente` and `cep_proponente` are removed. CPF, email and phone found in free text (`descricao`, `observacao`, `criterios_de_selecao`, `objeto_proposta`) are also masked. Do not use this Actor to build personal dossiers. If a future API delivery adds person-level fields, they stay out of the allow-list.

The official `/apoiadores-emendas-programas` endpoint includes CPF and person names and is **out of scope**.

### FAQ

**Do I need a key?** No. The official API is public and unauthenticated.

**Is this a website clone?** No. The portal and official CSV already exist. This Actor is a filtered, schedulable bulk JSON feed for other systems, with a hard cap and no personal data.

**Why can `propostas` for 2026 return zero rows?** The first official delivery focuses on preparatory acts. Program records for 2026 exist; proposals may appear as later deliveries land. Filter by year and check `RUN_SUMMARY.total_items_fonte`.

**Live API in CI?** `npm test` uses **fixtures** only (no network). `npm run test:live` makes three short public calls (including one proposals page to check natural-person proponents) and does not save personal data.

### Tests

```bash
npm test
npm run test:live
```

***

## Radar em lote Transferegov Discricionárias e Legais — API oficial (português)

Consulta em lote a **API pública** de Dados Abertos do módulo de Transferências Discricionárias e Legais do Transferegov.br e devolve **programas** ou **propostas**, com filtro por ano, UF, órgão e situação. **Sem chave, sem proxy.** E-mail, telefone, fax, CPF e nomes de pessoa são removidos.

Ferramenta independente, sem vínculo com o Transferegov.br ou com o governo federal. Fonte oficial: `https://api-publica.transferegov.gestao.gov.br/discricionarias`. Primeira entrega em 28/10/2026 (Atos Preparatórios).

### Entrada

- `recurso` (`programas` ou `propostas`, prefill `programas`)
- Pelo menos um filtro: `ano` (prefill `2026`), `uf` (prefill `SP`), `situacao`, órgão, código ou id. CNPJ do proponente só com 14 dígitos. Não envie CPF.
- `maxItems` (prefill 20, padrão 100, máximo 500)

Sem filtro a execução é recusada: a API declara mais de 1,2 milhão de programas. Não use `ATIVO` como situação de programa (HTTP 422); o valor visto na API é, por exemplo, `DISPONIBILIZADO`.

A API oficial repete o mesmo id_programa por UF, natureza jurídica e, no que foi observado, quatro cópias idênticas de cada combinação. O Actor **agrupa por programa** (ou por id_proposta), junta essas dimensões em listas e **cobra um item por programa único**. O campo linhas_agrupadas mostra quantas linhas da fonte foram unidas.

### Custo proposto

`inicio-run` US$0,01 + `item-retornado` US$0,003. Input inválido e itens com erro não são cobrados.

100 itens: compute no pior caso ≈ US$0,00083; receita US$0,31; após 20% da Apify ≈ US$0,248.

### Privacidade / LGPD

Só dados públicos e institucionais. CPF, nomes de pessoa, contato e conta bancária saem da resposta. Se `cd_identif_proponente` tiver 11 dígitos, o proponente é tratado como pessoa física: o ID é mascarado e `nm_proponente` e `cep_proponente` são removidos. CPF, e-mail e telefone em `descricao`, `observacao`, `criterios_de_selecao` e `objeto_proposta` também são mascarados. O endpoint de apoiadores de emendas, que traz CPF e nome, fica fora do escopo. Não use este Actor para montar dossiê de pessoa física. `TG_ORIGEM` é obrigatória (`apify` ou `api.market`); vazia faz o run falhar.

### Testes

```bash
npm test
npm run test:live
```

Ainda não publicado. Publicar na Store depende de OK explícito do dono, da configuração do PPE no Console (eventos automáticos em zero) e da review de código.

# Actor input Schema

## `recurso` (type: `string`):

programas = transfer programs (Atos Preparatórios). propostas = proposals. The first official API delivery focuses on preparatory acts.

## `ano` (type: `string`):

Maps to ano_programa or ano_proposta (YYYY).

## `uf` (type: `string`):

Two-letter Brazilian state. Maps to uf_programa or uf_proponente.

## `situacao` (type: `string`):

Program or proposal status as returned by the API (e.g. DISPONIBILIZADO). Do not send ATIVO for programs: the API returns HTTP 422.

## `orgaoSuperior` (type: `string`):

Maps to cod_orgao_sup_programa or cod_orgao_sup.

## `orgao` (type: `string`):

Maps to orgao_executor (programas, name or code as accepted by the API) or cod_orgao (propostas).

## `codigoPrograma` (type: `string`):

Maps to cod_programa. Ignored for propostas.

## `idPrograma` (type: `string`):

Maps to id_programa. Ignored for propostas.

## `nomePrograma` (type: `string`):

Maps to nome_programa. Ignored for propostas.

## `modalidade` (type: `string`):

Maps to modalidade_programa or modalidade (e.g. CONVENIO).

## `idProposta` (type: `string`):

Maps to id_proposta. Ignored for programas.

## `numeroProposta` (type: `string`):

Maps to nr_proposta. Ignored for programas.

## `cnpjProponente` (type: `string`):

Digits only or formatted CNPJ of the legal entity. Maps to cd_identif_proponente. Ignored for programas. Do not send CPF.

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

Hard cap per run. Default 100, absolute maximum 500 on Apify (100 when TG_ORIGEM=api.market).

## Actor input object example

```json
{
  "recurso": "programas",
  "ano": "2026",
  "uf": "SP",
  "maxItems": 20
}
```

# Actor output Schema

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

No description

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

RUN_SUMMARY: status, counts, charged events, source timestamp.

# 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 = {
    "recurso": "programas",
    "ano": "2026",
    "uf": "SP",
    "maxItems": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("kman-br/transferegov-discricionarias").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 = {
    "recurso": "programas",
    "ano": "2026",
    "uf": "SP",
    "maxItems": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("kman-br/transferegov-discricionarias").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 '{
  "recurso": "programas",
  "ano": "2026",
  "uf": "SP",
  "maxItems": 20
}' |
apify call kman-br/transferegov-discricionarias --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,kman-br/transferegov-discricionarias"
        }
    }
}
```

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/1P9EkgfbjwY4M3tPv/builds/PD4guT3hhk1gof7t6/openapi.json
