# B2B Leads Brazil — Find, Enrich & Score in One Run (`gangary/b2b-leads-brazil`) Actor

Give a CNAE activity + state, get a ready-to-call B2B lead list: discovers matching Brazilian companies, pulls each one's public contact data, and scores every lead 0-100 against your ICP — sorted best-first. One run, no scraping. Gerador de leads B2B do Brasil.

- **URL**: https://apify.com/gangary/b2b-leads-brazil.md
- **Developed by:** [Gangary](https://apify.com/gangary) (community)
- **Categories:** Lead generation, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $40.00 / 1,000 per lead delivereds

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## B2B Leads Brazil — Find, Enrich & Score in One Run

Give an economic activity (CNAE) and a state — get back a **ready-to-call B2B lead list**. This Actor runs the whole funnel in one shot: it **discovers** matching Brazilian companies from the official Receita Federal registry, pulls each one's **public contact data**, and **scores** every lead 0–100 against your ideal customer profile — sorted best-first. No scraping, no login, no API key.

![Cover](https://empresas-por-cnae.vercel.app/covers/b2b-leads-brazil.png)

Em português: *gerador de leads B2B do Brasil, lista de leads qualificados por CNAE e estado, prospecção B2B com score*.

### The pipeline in one Actor

1. **Discover** — every active company matching your CNAE + state, from a 27.8M-company index.
2. **Enrich** — official registry record per company: legal name, status, phone, email, address.
3. **Score** — verifies the email domain (real MX lookup), normalizes the phone, and computes an ICP score with **your** weights.
4. **Deliver** — deduplicated and sorted by score, highest first. You're charged only for delivered leads.

### Input example

Accounting firms (CNAE 6920) in São Paulo, only leads scoring 60+:

```json
{
  "cnae": "6920",
  "ufs": ["SP"],
  "maxLeads": 100,
  "minScore": 60
}
```

- `maxLeads` = how many companies to process (each is one official lookup). You receive those meeting `minScore`, sorted.
- `minScore` = only deliver (and charge) leads scoring at or above this. `0` returns every processed company scored.
- `municipio`, `porte` narrow the discovery step. `weights` (optional) tunes the score — `{ "corp_email": 40, "live_site": 0, "valid_phone": 40, "size": 20 }`.

### Output example

```json
{
  "cnpj": "12345678000195",
  "cnpj_formatado": "12.345.678/0001-95",
  "razao_social": "CONTABILIDADE EXEMPLO LTDA",
  "nome_fantasia": "Exemplo Contabil",
  "municipio": "SAO PAULO",
  "uf": "SP",
  "telefone": "1130001000",
  "email": "contato@exemplocontabil.com.br",
  "situacao": "ATIVA",
  "porte": "MICRO",
  "cnae": { "codigo": "6920601", "descricao": "Atividades de contabilidade" },
  "score_icp": 85,
  "signals": { "has_corp_email": true, "has_live_site": false, "has_valid_phone": true, "size_signal": 0 },
  "fonte": "brasilapi"
}
```

Rows come **sorted by `score_icp` descending** — your SDRs start at the top.

### How the score works

| Signal | What it means |
|---|---|
| `has_corp_email` | Email domain verified (real MX) and **not** a free provider (gmail/hotmail…). |
| `has_valid_phone` | Phone normalizes to a valid Brazilian number. |
| `has_live_site` | Reserved — the registry has no website field, so this is `false` here; it's populated when you run the standalone [Lead Enricher](https://apify.com/gangary/lead-enricher-icp) with your own site data. |
| `size_signal` | Reserved for a future company-size cross-reference. |

Weights are yours: an accounting firm might weight `valid_phone` high; a SaaS might weight `corp_email` high.

### Pricing (Pay per event)

| Event | When | Price |
|---|---|---|
| `actor-start` | once per run | $0.01 |
| `lead-delivered` | per qualified lead delivered (meets minScore, deduped) | $0.04 |

100 delivered leads = $0.01 + 100 × $0.04 = **$4.01**. Companies that fail `minScore`, duplicates, and failed lookups are **not charged**. New Apify accounts get free monthly credit.

### Is this compliant?

Yes — every source is **public**: the CNPJ registry is open data published by Receita Federal, and the contact lookup uses the same public registry APIs. No scraping behind logins, no private data. The email check is a public DNS MX query; nothing is sent to the address.

### Limitations

- Contact coverage depends on what companies filed with the registry — some rows have no email or an outdated phone (the score reflects that honestly).
- `maxLeads` bounds how many companies are processed per run (hard cap 500) to stay polite to the public sources; for a bigger segment, paginate across runs by CNAE/city.
- A **CNAE is required** (discovery is partitioned by activity + state).
- Registry data is a monthly snapshot; the contact lookup is live.

### Prefer the steps à la carte?

- **[CNPJ Discovery](https://apify.com/gangary/cnpj-discovery)** — just the company list by CNAE + state.
- **[CNPJ Lookup](https://apify.com/gangary/cnpj-lookup)** — just the official record for CNPJs you already have.
- **[Lead Enricher & ICP Scorer](https://apify.com/gangary/lead-enricher-icp)** — just the scoring, on any list you bring (including your own websites for the live-site signal).
- **[CNPJ Validator (free)](https://apify.com/gangary/cnpj-validator)** — clean a CNPJ list for free.

This Actor is those four steps fused into one call.

# Actor input Schema

## `cnae` (type: `string`):

Codigo completo (8630-5/04), so digitos (8630504) ou prefixo (8630 = todas as clinicas, 86 = saude inteira).

## `ufs` (type: `array`):

Siglas de 2 letras (ex: SP, MG). Pelo menos 1 obrigatoria.

## `maxLeads` (type: `integer`):

Quantas empresas processar (cada uma = 1 consulta oficial). Voce recebe as que passam no minScore, ordenadas. Teto 500.

## `minScore` (type: `integer`):

So entrega (e cobra) leads com score >= este valor. 0 = todos os processados. Ex: 60 entrega so os bons.

## `municipio` (type: `string`):

Nome do municipio (com ou sem acento). Filtra dentro das UFs.

## `porte` (type: `string`):

Restringe pelo porte: micro, pequena ou demais.

## `weights` (type: `object`):

Calibra o peso de cada sinal no score. Chaves: corp\_email, live\_site, valid\_phone, size. Default 35/30/20/15.

## Actor input object example

```json
{
  "cnae": "6920",
  "ufs": [
    "SP"
  ],
  "maxLeads": 100,
  "minScore": 0
}
```

# 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 = {
    "cnae": "6920",
    "ufs": [
        "SP"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("gangary/b2b-leads-brazil").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 = {
    "cnae": "6920",
    "ufs": ["SP"],
}

# Run the Actor and wait for it to finish
run = client.actor("gangary/b2b-leads-brazil").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "cnae": "6920",
  "ufs": [
    "SP"
  ]
}' |
apify call gangary/b2b-leads-brazil --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=gangary/b2b-leads-brazil",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

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