# CNES Brazil Health Establishments Scraper (`parseforge/cnes-brazil-health-establishments-scraper`) Actor

Scrapes health establishment records from CNES, Brazil's national registry. Filter by state, city, or name and export to CSV, JSON, Excel, or XML.

- **URL**: https://apify.com/parseforge/cnes-brazil-health-establishments-scraper.md
- **Developed by:** [ParseForge](https://apify.com/parseforge) (community)
- **Categories:** Lead generation, Automation, Integrations
- **Stats:** 2 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $7.50 / 1,000 results

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

[![ParseForge](https://raw.githubusercontent.com/ParseForge/apify-assets/main/banner.jpg)](https://apify.com/parseforge?fpr=vmoqkp)

### CNES Brazil Health Establishments Scraper

**Scrape Brazilian health establishments from CNES, the national registry, by state, city, or name, up to a million per run.** Each record includes the establishment's CNES code, type, address, and contact details. No login or API key. Export to CSV, JSON, Excel, or XML.

CNES, the Cadastro Nacional de Estabelecimentos de Saúde, is Brazil's official registry of every public and private health facility, from hospitals to clinics. The official DATASUS portal is built for manual lookups, not bulk data collection. This Actor reads the public CNES search directly, filters by state, city, or establishment name, and returns each match in one fixed schema.

| Who uses it | What they scrape CNES Brazil for |
|---|---|
| Market researchers | Mapping the distribution of clinics and hospitals across Brazilian states |
| Healthcare analysts | Building a current list of facilities for service planning |
| Pharma sales teams | Identifying target establishments by specialty and location |
| Public health researchers | Studying healthcare access and facility density |

### What it does

This Actor collects health establishment records from CNES by state, city, or name, and returns each one as a flat row.

- 📍 **Geographic filters:** narrow by state (UF) or a specific city using its IBGE code.
- 🔍 **Name search:** filter establishments by name or search term.
- ⚙️ **Flexible limits:** set a maximum number of establishments per run, from 1 to 1,000,000.
- 📦 **Structured output:** each record is returned as a flat row with consistent fields.

Results export to CSV, JSON, Excel, or XML, or straight from the API.

### What you can do with CNES Brazil data

**📊 Market analysis.**

A market researcher runs the Actor for all states to map the density of private clinics and identify underserved regions.

**🏥 Healthcare planning.**

A public health analyst collects all hospitals in a state to assess bed capacity and service gaps.

**💊 Pharma targeting.**

A sales team filters by city and establishment type to build a list of potential prescribers.

**🔬 Academic research.**

A researcher gathers a nationwide dataset of health facilities to study access disparities.

### Why choose this scraper

| | What you get |
|---|---|
| **Official data** | Directly from CNES, the national health establishment registry |
| **No API key** | Uses the public search interface, no registration required |
| **Scalable** | Collect up to a million records per run |
| **Flexible filters** | Target by state, city, or name |

### How it compares

No other Store actor targets CNES Brazil the same way, so the honest comparison is with the alternatives teams actually weigh.

| | CNES Brazil Health Establishments Scraper | Build it in-house | By hand |
|---|---|---|---|
| Setup | Run it now, zero config | Days of engineering | None, but hours per pull |
| When CNES Brazil changes | Maintained for you | You fix it | You re-learn the page |
| Proxies, retries, anti-bot | Built in | Your problem | Browser only |
| Output | Fixed JSON schema, CSV/Excel export | Whatever you build | Copy-paste |
| Cost | Pay per result | Engineering time | Analyst hours |

### Configure the run

Drive the Actor from state, city, and establishment name, alone or together, and filters run as each record is read so only matches reach your dataset. The Input tab lists every parameter.

A first run with the defaults:

```json
{
 "maxItems": 10
}
```

A larger pull:

```json
{
 "maxItems": 200
}
```

### Pricing

Pay-per-result: **$0.0085 per result** collected. You pay only for the results written to your dataset.

| Results collected | Approximate cost |
|---|---|
| 100 results | $0.85 |
| 1,000 results | $8.50 |
| 10,000 results | $85.00 |

New Apify accounts start with $5 in free credit.

### Free users

Free-plan runs return up to 10 results as a preview. [Upgrade your Apify plan](https://console.apify.com/sign-up?fpr=vmoqkp) to collect up to 1,000,000 results per run.

### Run it

1. [Create a free Apify account with $5 in credit](https://console.apify.com/sign-up?fpr=vmoqkp).
2. Open the [CNES Brazil Health Establishments Scraper](https://apify.com/parseforge/cnes-brazil-health-establishments-scraper?fpr=vmoqkp).
3. Set your inputs and any filters, then click **Start**.
4. Export the results as CSV, Excel, JSON, or XML from the **Dataset** tab.

Run it programmatically through the [Apify API](https://docs.apify.com/api/v2) (`run-sync-get-dataset-items`) or the [ApifyClient](https://docs.apify.com/api/client/js) for JavaScript and Python.

### Use with AI agents (MCP)

Give an AI agent live access to CNES Brazil through the Model Context Protocol. Add the Actor to Claude, Cursor, or any MCP client:

```bash
claude mcp add --transport http apify "https://mcp.apify.com?tools=parseforge/cnes-brazil-health-establishments-scraper"
```

Then prompt it in plain language to run the scraper and read back the results.

### Troubleshooting

**Why am I getting no results?**

Check your filters. If you set a state or city, ensure the codes are correct. Also verify the search term if used. Try broadening your filters.

**The run is taking too long.**

Reduce the maximum establishments or narrow your filters to a specific state or city.

**Some records are missing fields.**

CNES may not have complete data for every establishment. Missing fields will be empty in the output.

**I get an error about the city code.**

The city input expects a 6-digit IBGE municipal code. You can find the code on the IBGE website or by searching for the city name plus 'IBGE code'.

### FAQ

| Question | Answer |
|---|---|
| What is CNES? | CNES is the Cadastro Nacional de Estabelecimentos de Saúde, Brazil's official registry of all health establishments, maintained by the Ministry of Health through DATASUS. |
| Do I need an API key or login? | No. This Actor uses the public CNES search interface, so no registration or credentials are required. |
| Can I filter by state? | Yes. Use the state input with the two-letter UF code, such as SP for São Paulo or RJ for Rio de Janeiro. |
| Can I filter by city? | Yes. Provide the 6-digit IBGE municipal code for the city, for example 355030 for São Paulo. |
| Can I search by establishment name? | Yes. Use the search input to filter establishments by name or a partial term. |
| How many records can I collect? | You can set the maximum establishments per run from 1 to 1,000,000. |
| What data fields are returned? | Each record includes the CNES code, establishment name, type, address, contact details, and other registry fields. The exact fields are shown in the sample output. |
| What export formats are supported? | You can export the results to CSV, JSON, Excel, or XML. |
| Is the data up to date? | The Actor reads directly from the live CNES database, so the data reflects the current registry at the time of the run. |
| Can I run this for the whole country? | Yes. Leave the state and city inputs empty to collect establishments nationwide, subject to the maximum items limit. |

### Related actors

Browse the full [ParseForge collection](https://apify.com/parseforge?fpr=vmoqkp) for more scrapers.

🆘 **Need help?** Email parseforge@protonmail.com with your run ID, your input, and what you expected.

⚠️ **Disclaimer.** This Actor is unofficial and is not affiliated with, endorsed by, or sponsored by Ministério da Saúde, DATASUS. It collects only publicly available data. You are responsible for using the collected data in compliance with the source's terms of service and applicable data-protection laws, including GDPR, CCPA, and PIPL. Do not use it to collect personal data unlawfully.

# Actor input Schema

## `state` (type: `string`):

Two-letter Brazilian state code (e.g. SP, RJ, MG). Leave empty for nationwide.

## `city` (type: `string`):

6-digit IBGE municipal code (e.g. 355030 for São Paulo). Optional.

## `search` (type: `string`):

Filter establishments by name (optional).

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

How many health establishments to collect per run.

## Actor input object example

```json
{
  "maxItems": 10
}
```

# Actor output Schema

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

No description

# 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 = {
    "maxItems": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("parseforge/cnes-brazil-health-establishments-scraper").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 = { "maxItems": 10 }

# Run the Actor and wait for it to finish
run = client.actor("parseforge/cnes-brazil-health-establishments-scraper").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 '{
  "maxItems": 10
}' |
apify call parseforge/cnes-brazil-health-establishments-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,parseforge/cnes-brazil-health-establishments-scraper"
        }
    }
}
```

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/bkECOA1kaYLjXDMsk/builds/WLRyaAwKmFD4dekgb/openapi.json
