# Brazil B2B Leads from Open CNPJ Data

> Turns Brazil's open CNPJ company data (Receita Federal) into a ranked B2B prospect list: filter by CNAE, state, city and name keywords, then lead-score every company. Runs locally with DuckDB + Python, no API keys.

Brazil B2B Leads from Open CNPJ Data is a free AI agent skill on Agensi by Kaike Souza, in APIs & Backend. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [Kaike Souza](https://www.agensi.io/creators/kaike-souza)
- Category: [APIs & Backend](https://www.agensi.io/skills/apis-backend)
- Version: 1.0
- Last updated: 2026-11-22
- Security: scan passed (2026-11-22); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/brazil-b2b-leads-from-open-cnpj-data
- Tags: api, python, duckdb, b2b-sales, data-mining

## About this skill

### What it does

This skill turns the public CNPJ files from Brazil's Receita Federal into a **prioritized outbound prospect list**. It filters companies that match your ideal customer profile (ICP), drops the ones that don't look like customers, and scores the rest so your sales team knows who to call first.

Built for markets with low digital presence (small clinics, local service providers), where inbound doesn't work and the real question is **who to approach first**.

### The funnel

| Step | Filter |
|---|---|
| 1 | Active companies in the target state and cities, with an ICP CNAE (main or secondary) |
| 2 | Multidisciplinary (2+ ICP CNAEs) and with registered partners |
| 3 | Name looks like a real customer (clinic, center, institute...) |
| 4 | Lead score, then top N in the main city + top N in the others |

Score = CNAEs in the ICP + number of partners + niche and multidisciplinary keywords + capital social. Every weight, CNAE, city and keyword lives in one config file, so switching markets means editing the config, not the SQL.

### Why it works

- **Free data**: the official Receita Federal base, no paid lookups.
- **Runs on a laptop**: DuckDB reads the raw files from disk and filters by state at read time.
- **Tested in production**: the same logic built a weekly call list for a healthtech selling to therapy clinics in Greater Rio (3,121 companies down to 470 prioritized leads).
- **LGPD-aware**: partner names never leave the load step (only the count is used); phone and e-mail are off by default.

### What's inside

- SQL pipeline (DuckDB) + Python orchestrator
- Example config (therapy clinics in Greater Rio) and a guide with CNAEs for other markets
- Fictitious data generator to try it in seconds before downloading the real base

## Requires

- Python

You download the CNPJ files yourself from dados.gov.br (several GB). The pipeline makes no network calls.

## Known limitations

Requires manual download of large official files. City names must be uppercase and match the Receita database exactly. Processing speed depends on local disk I/O for large CSV files.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Brazil B2B Leads from Open CNPJ Data skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### How does this skill differ from using a standard B2B lead platform?

This skill eliminates the need for expensive monthly B2B platform subscriptions by allowing you to process Brazil's massive, multi-gigabyte open CNPJ database locally on your own machine. It automates the complex SQL joins and filtering required to turn raw government files into a prioritized, scored lead list.

### What are the technical requirements to run this lead scoring pipeline?

The pipeline requires Python 3.10 or higher and uses DuckDB for high-speed local processing. You will also need sufficient disk space to store and unzip the official Receita Federal CSV files, which can total several gigabytes.

### What exactly is included in the purchase?

You receive the complete Python processing scripts, the DuckDB SQL integration logic, and a customizable TOML configuration file to define your Ideal Customer Profile (ICP) and scoring weights. The package also includes a guide on where to source the latest official government data files.

### How does this skill handle data privacy and PII?

By processing data locally via DuckDB, your lead lists and ICP criteria never leave your machine or enter the cloud. The skill is also designed to exclude sensitive PII by default, focusing on corporate data like Capital Social and CNAE codes for scoring.

### Can I customize the scoring logic for my specific niche?

Yes, the included TOML configuration file allows you to define specific CNAE codes, geographic locations (UF and City), and keywords. You can also adjust the scoring weights for attributes like 'Capital Social' to ensure the output aligns with your specific sales goals.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
