# 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

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js/docs.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/integrations/mcp.md).

If your project is in a different language, use 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

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "B2B Leads Brazil — Find, Enrich & Score in One Run",
        "description": "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.",
        "version": "0.1",
        "x-build-id": "HQ43aOH1BBI19sbAI"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/gangary~b2b-leads-brazil/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-gangary-b2b-leads-brazil",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/gangary~b2b-leads-brazil/runs": {
            "post": {
                "operationId": "runs-sync-gangary-b2b-leads-brazil",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/gangary~b2b-leads-brazil/run-sync": {
            "post": {
                "operationId": "run-sync-gangary-b2b-leads-brazil",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "ufs"
                ],
                "properties": {
                    "cnae": {
                        "title": "CNAE (economic activity)",
                        "type": "string",
                        "description": "Codigo completo (8630-5/04), so digitos (8630504) ou prefixo (8630 = todas as clinicas, 86 = saude inteira)."
                    },
                    "ufs": {
                        "title": "States (UF)",
                        "type": "array",
                        "description": "Siglas de 2 letras (ex: SP, MG). Pelo menos 1 obrigatoria.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxLeads": {
                        "title": "Max companies to process",
                        "minimum": 1,
                        "maximum": 500,
                        "type": "integer",
                        "description": "Quantas empresas processar (cada uma = 1 consulta oficial). Voce recebe as que passam no minScore, ordenadas. Teto 500.",
                        "default": 100
                    },
                    "minScore": {
                        "title": "Minimum ICP score (0-100)",
                        "minimum": 0,
                        "maximum": 100,
                        "type": "integer",
                        "description": "So entrega (e cobra) leads com score >= este valor. 0 = todos os processados. Ex: 60 entrega so os bons.",
                        "default": 0
                    },
                    "municipio": {
                        "title": "City (optional)",
                        "type": "string",
                        "description": "Nome do municipio (com ou sem acento). Filtra dentro das UFs."
                    },
                    "porte": {
                        "title": "Company size (optional)",
                        "enum": [
                            "micro",
                            "pequena",
                            "demais"
                        ],
                        "type": "string",
                        "description": "Restringe pelo porte: micro, pequena ou demais."
                    },
                    "weights": {
                        "title": "ICP score weights (optional)",
                        "type": "object",
                        "description": "Calibra o peso de cada sinal no score. Chaves: corp_email, live_site, valid_phone, size. Default 35/30/20/15."
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
