# Brazil Transferegov & Obrasgov Pre-Tender Funding & Works (`francescopacifico1905/brazil-transferegov-obras`) Actor

Pre-tender Brazilian B2G intelligence across Transferegov.br (Especiais, Parcerias, Fundo a Fundo, TED, Discricionarias) and Obrasgov.br federal public works, commitments, bank orders, stalled works & CNPJ cross-joins.

- **URL**: https://apify.com/francescopacifico1905/brazil-transferegov-obras.md
- **Developed by:** [Francesco Pacifico](https://apify.com/francescopacifico1905) (community)
- **Categories:** AI, Lead generation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.40 / 1,000 transfer or public work records

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

Pre-tender Brazilian B2G intelligence across **Transferegov.br** (`especiais`, `parcerias`, `fundoafundo`, `ted`, `discricionarias`) and **Obrasgov.br** (`projeto-investimento`, physical execution, contracts, commitments, geometry, and stalled/cancelled infrastructure works).

Turn federal budget liquidity and stalled public works into structured pre-tender pipeline signals for engineering contractors, concessionaires, *seguro garantia* underwriters, public-sector B2B suppliers, and AI agents on Apify MCP.

### Why Use This Actor?

- **Pre-Tender Cash Flow Visibility**: Identify municipalities and public entities receiving accredited federal transfers (*Transferências Especiais / Emendas Pix*, *Parcerias*, *Fundo a Fundo*, *TED*, and *Discricionárias*) weeks or months before the municipal procurement notice (*edital*) hits PNCP.
- **Stalled & Cancelled Work Takeover Intelligence**: Filter **Obrasgov.br** projects with `stalledOnly: true` (`Paralisada`, `Inacabada`, `Cancelada`) along with handling proceedings (`possui_tratativas_situacao_investimento`), execution progress %, contracts, and coordinates to surface takeover tenders and surety bond (*seguro garantia*) replacement opportunities.
- **Beneficiary Liquidity × Works Cross-Join**: Correlate federal money landing in a municipality or CNPJ's bank account with active or stalled federal construction sites on the ground in a single `< 4 KB` dossier.
- **Schema-Enforced Upstream Guardrails**: Validates every query parameter against live OpenAPI 3.1 whitelists (`target-map.json`), preserves 64-bit integer IDs as safe strings, clamps page sizes per module (`200` vs `1,000`), maps discretionary proposal fiscal years via `ano_prop`, and executes direct polite HTTP requests (`useApifyProxy: false` default).
- **Zero-Waste Delta Monitoring**: Checks `/data-atualizacao` timestamps across queried portals and persists record digests in an Apify Key-Value Store (`stateStoreName`). Scheduled `onlyNew: true` runs with no upstream updates short-circuit immediately with **zero record charges**.

### Execution Modes

1. `funded_transfers`: Federal transfer proposals, action plans, *empenhos*, *documentos hábeis*, credit notes (*notas de crédito*), and bank payment orders (*ordens bancárias*) filterable by `modules`, `uf`, `municipality`, `ibgeCode`, `cnpj`/`cnpjs`, `year`, date window, `keyword`, and `minAmount`.
2. `public_works`: Federal infrastructure projects from Obrasgov.br with optional `stalledOnly: true` (`Paralisada` / `Inacabada` / `Cancelada`), physical progress range (`minPhysicalProgressPct` / `maxPhysicalProgressPct`), contracts, commitments, and Geo coordinates.
3. `beneficiary_crossjoin`: Linked CNPJ dossier combining Transferegov federal liquidity and Obrasgov project status (auto-discovering beneficiaries from regional filters when `cnpj`/`cnpjs` are omitted).

### Input Example

```json
{
    "mode": "beneficiary_crossjoin",
    "modules": ["especiais", "parcerias", "fundoafundo"],
    "cnpj": "52942380000187",
    "enrichTransferFinancials": true,
    "enrichWorksDetails": true,
    "onlyNew": false,
    "maxItems": 10
}
```

### Output Sample (Truncated for Brevity)

```json
{
    "recordId": "cj:52942380000187",
    "recordType": "BENEFICIARY_CROSSJOIN",
    "mode": "beneficiary_crossjoin",
    "status": "OK",
    "billed": true,
    "billedEvent": "transfer-or-work-record",
    "billedEvents": ["transfer-or-work-record", "cnpj-beneficiary-crossjoin"],
    "crossJoinAddonBilled": true,
    "sourcePortal": "TRANSFEREGOV_OBRASGOV",
    "module": "crossjoin",
    "externalId": "52942380000187",
    "instrumentCode": "52.942.380/0001-87",
    "title": "Cross-Join Dossier: MUNICIPIO DE MONTE AZUL PAULISTA",
    "uf": "SP",
    "transferAmountBrl": 898000,
    "crossJoinSummary": {
        "transfersCount": 4,
        "worksCount": 5,
        "stalledWorksCount": 0,
        "modulesMatched": ["especiais", "fundoafundo"],
        "totalTransferredBrl": 898000
    },
    "deltaStatus": "NEW",
    "payloadBytes": 1642,
    "sourceUrl": "https://api-publica.transferegov.gestao.gov.br/especiais/planos-acao-especiais?id_plano_acao=..."
}
```

### Pay-Per-Event (PPE) Pricing

| Event                        | Bronze Price | Silver (`-10%`) | Gold (`-20%`) | Trigger Condition                                                                                      |
| ---------------------------- | ------------ | --------------- | ------------- | ------------------------------------------------------------------------------------------------------ |
| `apify-actor-start`          | `$0.00005`   | Tiered          | Tiered        | Charged once per Actor run start                                                                       |
| `transfer-or-work-record`    | `$0.003`     | `$0.0027`       | `$0.0024`     | Per validated `< 4 KB` `OK` record emitted                                                             |
| `cnpj-beneficiary-crossjoin` | `+$0.002`    | `+$0.0018`      | `+$0.0016`    | Optional add-on only when a full cross-join has both Transferegov (`> 0`) and Obrasgov (`> 0`) matches |

Diagnostic rows (`INVALID_INPUT`, `NOT_FOUND`, `UPSTREAM_RATE_LIMITED`, `UPSTREAM_ERROR`) and unchanged records skipped by `onlyNew: true` trigger **zero record charges**. Set `maxTotalChargeUsd` to cap spend cleanly on every API or MCP invocation.

### Integrations: Apify MCP, n8n & Scheduled Pipelines

- **Apify MCP (`https://mcp.apify.com`)**: Default inputs (`maxItems: 20`) and `< 4 KB` records complete well inside synchronous LLM tool-call limits (`< 25s`).
- **n8n / Make / REST API**: Invoke synchronously via `POST https://api.apify.com/v2/acts/francescopacifico1905~brazil-transferegov-obras/run-sync-get-dataset-items`.
- **Scheduled Delta Watchers**: Enable `onlyNew: true` with a persistent `stateStoreName` to pay only when new funding or stalled works appear.

### Composable Brazil GovTech & B2G Pipeline (MCP + n8n)

Combine this Actor with its two sister Actors to automate end-to-end Brazilian public-sector origination and counterparty due diligence:

1. **Stage 1 — [Pre-Tender Funding & Works (`francescopacifico1905/brazil-transferegov-obras`)](https://apify.com/francescopacifico1905/brazil-transferegov-obras)**: Spot municipalities and executing agencies receiving fresh Transferegov transfers or managing `Paralisada`/`Inacabada` Obrasgov sites before formal bid notices drop.
2. **Stage 2 — [Open Tenders & Piggyback Atas (`francescopacifico1905/ibero-procurement-atas`)](https://apify.com/francescopacifico1905/ibero-procurement-atas)**: Pull live PNCP public tenders (*editais*) and reusable *Atas de Registro de Preços* (*carona*) plus market benchmark pricing for those target regions or objects.
3. **Stage 3 — [Counterparty CNPJ & Sanctions KYB (`francescopacifico1905/brazil-kyb-dossier`)](https://apify.com/francescopacifico1905/brazil-kyb-dossier)**: Run instant Receita Federal CNPJ health, UBO/QSA partner checks, CGU sanctions (CEIS/CNEP/CEAF/CEPIM), and SICAF qualification on shortlisted contractors, joint-venture partners, or award winners before contracting.

### FAQ, Compliance & Support

#### Where does the data come from?

All data is retrieved strictly via direct HTTP JSON calls to official Brazilian Federal Government open-data APIs (`api-publica.transferegov.gestao.gov.br`, `api.transferegov.gestao.gov.br`, and `api-publica.obrasgov.gestao.gov.br`) governed by Brazil's Access to Information Law (LAI, Law 12.527/2011).

#### Legal & Ethical Notice

> Our Actors are ethical and strictly access publicly disclosed government open-data registries under Brazil's transparency statutes (LAI). Do not use parliamentary amendment, officer, or supplier names without a lawful compliance, procurement, or research basis under LGPD / GDPR.

For feature requests or integration questions, please open an issue in the **Issues** tab or consult the **API** tab for endpoint code snippets.

# Actor input Schema

## `mode` (type: `string`):

Choose intelligence workflow: funded_transfers (Transferegov approved proposals, action plans, empenhos & bank orders, $0.003/record Bronze), public_works (Obrasgov federal infrastructure projects, physical execution & stalled/cancelled works, $0.003/record Bronze), or beneficiary_crossjoin (unified CNPJ/municipality dossier linking Transferegov liquidity with Obrasgov works, $0.003 + optional $0.002 cross-join add-on).

## `modules` (type: `array`):

Transferegov.br modules to query in funded_transfers and beneficiary_crossjoin modes: especiais (parliamentary Pix transfers), parcerias (covenants & partnerships), fundoafundo (fund-to-fund), ted (decentralized federal execution), discricionarias (discretionary & PAC proposals).

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

2-letter Brazilian state code (e.g. "SP", "MG", "BA", "RS", "PR", "DF").

## `municipality` (type: `string`):

Case- and accent-insensitive Brazilian municipality filter (e.g. "Campinas", "Monte Azul Paulista", "Salvador").

## `ibgeCode` (type: `string`):

7-digit IBGE municipality code (e.g. "3509502" for Campinas/SP, "3531506" for Monte Azul Paulista/SP).

## `cnpj` (type: `string`):

14-digit Brazilian CNPJ (formatted or digits) to inspect transfers, works, or cross-join dossiers. Invalid Modulo-11 CNPJs emit free unbilled INVALID_INPUT diagnostics.

## `cnpjs` (type: `array`):

List of 14-digit Brazilian CNPJs for batch lookup across funded_transfers, public_works, or beneficiary_crossjoin.

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

Filter transfers or public works registration year (e.g. 2025 or 2026).

## `startDate` (type: `string`):

Inclusive lower date bound (ISO YYYY-MM-DD) matched against transfer acceptance/proposal or work registration dates.

## `endDate` (type: `string`):

Inclusive upper date bound (ISO YYYY-MM-DD).

## `keyword` (type: `string`):

Case- and accent-insensitive keyword matched against project objects, goals, bank descriptions, and beneficiary names (e.g. "saude", "pavimentacao", "escola", "equipamentos").

## `minAmount` (type: `number`):

Filter out records below this BRL planned or transfer amount.

## `stalledOnly` (type: `boolean`):

When true in public_works mode, query only Paralisada, Inacabada, and Cancelada federal works primed for contractor takeover or seguro garantia claims.

## `minPhysicalProgressPct` (type: `number`):

Keep Obrasgov projects whose latest physical execution percentage is >= this threshold (0-100).

## `maxPhysicalProgressPct` (type: `number`):

Keep Obrasgov projects whose latest physical execution percentage is <= this threshold (0-100).

## `enrichTransferFinancials` (type: `boolean`):

Fetch downstream empenhos, documentos habeis, and ordens bancarias for matched Transferegov plans/proposals.

## `enrichWorksDetails` (type: `boolean`):

Selectively query /execucao-fisica, /historico-situacao-cancelada-paralisada, /empenho, /contrato, and /geometria per matched work.

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

Checks upstream /data-atualizacao freshness and Key-Value Store digests so scheduled runs with no changes emit zero billed records.

## `enableDeltaMonitoring` (type: `boolean`):

Persist record digests in stateStoreName to tag each row NEW, UPDATED, or UNCHANGED (enabled automatically when onlyNew=true).

## `stateStoreName` (type: `string`):

Named Apify Key-Value Store persisting /data-atualizacao watermarks and record digests across scheduled runs.

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

Maximum number of validated OK records to emit and bill (default 20 completes well inside Apify MCP's synchronous window).

## `proxyConfiguration` (type: `object`):

Direct HTTP is used by default (useApifyProxy: false). Configure Apify Proxy only if needed.

## Actor input object example

```json
{
  "mode": "funded_transfers",
  "modules": [
    "especiais",
    "parcerias",
    "fundoafundo"
  ],
  "uf": "SP",
  "year": 2025,
  "stalledOnly": false,
  "enrichTransferFinancials": true,
  "enrichWorksDetails": true,
  "onlyNew": false,
  "enableDeltaMonitoring": false,
  "stateStoreName": "brazil-transferegov-obras-state",
  "maxItems": 20,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `dataset` (type: `string`):

Dataset containing validated Transferegov transfers, Obrasgov public works, and beneficiary cross-joins

## `keyValueStore` (type: `string`):

Default Key-Value Store containing RUN_SUMMARY diagnostics and freshness timestamps

# 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 = {
    "modules": [
        "especiais",
        "parcerias",
        "fundoafundo"
    ],
    "uf": "SP",
    "year": 2025
};

// Run the Actor and wait for it to finish
const run = await client.actor("francescopacifico1905/brazil-transferegov-obras").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 = {
    "modules": [
        "especiais",
        "parcerias",
        "fundoafundo",
    ],
    "uf": "SP",
    "year": 2025,
}

# Run the Actor and wait for it to finish
run = client.actor("francescopacifico1905/brazil-transferegov-obras").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 '{
  "modules": [
    "especiais",
    "parcerias",
    "fundoafundo"
  ],
  "uf": "SP",
  "year": 2025
}' |
apify call francescopacifico1905/brazil-transferegov-obras --silent --output-dataset

```

## MCP server setup

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

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/PYBrn3UTlKP4FwUPP/builds/NuT6cOBPF0PQRcY5B/openapi.json
