# DENUE Mexico Business Directory Scraper (INEGI) (`fabrikit/denue-mexico-scraper`) Actor

Extract Mexican businesses from INEGI's official DENUE directory (6.1M establishments): name, legal name, SCIAN activity, employee size, full address, GPS, phone, e-mail and website. Filter by keyword, state, municipality, SCIAN code, size or radius. No key needed. From US$3 per 1,000 businesses.

- **URL**: https://apify.com/fabrikit/denue-mexico-scraper.md
- **Developed by:** [Fabrikit](https://apify.com/fabrikit) (community)
- **Categories:** Lead generation, Automation, Other
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 business (establishment) results

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/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

## DENUE Mexico Business Directory Scraper (INEGI)

Extract Mexican businesses from **DENUE** — the *Directorio Estadístico Nacional de Unidades Económicas* published by **INEGI**, Mexico's national statistics institute — into clean, analysis-ready JSON, CSV or Excel. DENUE is the official register of **~6.1 million establishments** across all 32 states: shops, restaurants, clinics, factories, offices, schools, workshops and government units, each with its **SCIAN activity code**, **employee size bracket**, **full street address**, **GPS coordinates** and, when the business reported them, its **phone, e-mail and website**.

Filter by **keyword**, **state**, **municipality**, **SCIAN code**, **employee size**, **contact availability**, **registration date** or **radius around a point** (nearest first). It works **out of the box with no API key**: the Actor streams INEGI's official bulk files and filters them on the fly. If you have a free INEGI token, it uses INEGI's official DENUE API instead, which is faster for narrow searches in big states.

What you get from a single run:

- **Lead lists by industry and place**: every dentist in Cuauhtémoc, every hotel in Quintana Roo, every manufacturer with 251+ employees in Nuevo León — with address, coordinates, phone, e-mail and website when INEGI publishes them.
- **Market sizing and site selection**: count competitors by SCIAN class, municipality and size bracket, or pull everything within 1 km of a location, sorted by distance.
- **Clean, stable data**: one row per establishment, the official DENUE `id` and CLEE key for cross-run diffing, SCIAN 2018 codes, numeric employee ranges, AGEB/manzana keys to join with census data.

### Example output item (real record)

```json
{
    "id": "6795279",
    "clee": "06002722212003941011003286S0",
    "name": "11218 DOMINOS PIZZA COLIMA",
    "legalName": "OPERADORA Y PROCESADORA DE PRODUCTOS DE PANIFICACION",
    "scianCode": "722516",
    "activity": "Restaurantes de autoservicio",
    "employeeSize": "11 a 30 personas",
    "employeeSizeCode": 3,
    "employeesMin": 11,
    "employeesMax": 30,
    "establishmentType": "Fijo",
    "streetType": "AVENIDA",
    "street": "FELIPE SEVILLA DEL RÍO",
    "exteriorNumber": "52",
    "interiorNumber": null,
    "settlementType": "COLONIA",
    "colonia": "VISTA HERMOSA",
    "postalCode": "28016",
    "locality": "Colima",
    "municipality": "Colima",
    "municipalityCode": "002",
    "state": "Colima",
    "stateCode": "06",
    "ageb": "0322",
    "block": "049",
    "shoppingCenter": null,
    "shoppingCenterType": null,
    "unitNumber": null,
    "fullAddress": "AVENIDA FELIPE SEVILLA DEL RÍO 52, COLONIA VISTA HERMOSA, C.P. 28016, Colima, Colima",
    "latitude": 19.25573232,
    "longitude": -103.71640274,
    "phone": null,
    "email": "DOMINOSPIZZA@ALSEA.NET",
    "website": "WWW.DOMINOS.COM.MX",
    "registrationDate": "2017-03",
    "distanceMeters": null,
    "source": "inegi-bulk-csv",
    "scrapedAt": "2026-10-12T19:16:40.364Z"
}
```

### How to use it

1. Type a **keyword** (`hotel`, `dentista`, `farmacia`, `taller mecánico`) or leave it empty.
2. Pick a **state** and, optionally, **municipalities**, **SCIAN codes**, **employee sizes**, a **contact requirement** or a **registration date**.
3. Or search **around a point**: paste `latitude,longitude` from Google Maps and a radius in meters — results come back nearest first with `distanceMeters`.
4. Set **max establishments** and press **Start**. Export as JSON, CSV, Excel or HTML, or push the results to Google Sheets, webhooks, Zapier, Make, n8n or the Apify API.

#### Input examples

Dentists with a phone, e-mail or website in Cuauhtémoc (Mexico City):

```json
{
    "state": "09",
    "municipalities": ["Cuauhtémoc"],
    "scianCodes": ["621211"],
    "contactFilter": "any_contact",
    "maxItems": 500
}
```

Restaurants within 1 km of the Zócalo, nearest first:

```json
{
    "keyword": "restaurante",
    "coordinates": "19.4326,-99.1332",
    "radiusMeters": 1000,
    "maxItems": 200
}
```

Large manufacturers (251+ employees) anywhere in Mexico, via the API:

```json
{
    "scianCodes": ["31-33"],
    "employeeSizes": ["7"],
    "maxItems": 5000,
    "inegiToken": "your-free-inegi-token"
}
```

Businesses added to DENUE since 2025 in Monterrey:

```json
{
    "state": "19",
    "municipalities": ["Monterrey"],
    "registeredFrom": "2025",
    "maxItems": 1000
}
```

#### Input fields

| Field | What it does |
|---|---|
| `keyword` | Words to find in the business name, legal name, activity description or address (accents optional). All words of a phrase must appear; separate alternatives with commas: `motel,hostal`. |
| `state` | One of the 32 states (`01` Aguascalientes … `32` Zacatecas; `09` Ciudad de México, `14` Jalisco, `19` Nuevo León, `15` Estado de México). `00` = all of Mexico. |
| `municipalities` | Official municipality / alcaldía names (`Zapopan`, `Benito Juárez`) or 5-digit codes (`09015`). A name that exists in several states matches all of them unless you pick a state. |
| `scianCodes` | SCIAN 2018 prefixes of 2–6 digits: `72` accommodation & food, `7225` restaurants, `621211` dentists, `4611` groceries, `31-33` all manufacturing. |
| `employeeSizes` | INEGI size brackets: `1` 0–5, `2` 6–10, `3` 11–30, `4` 31–50, `5` 51–100, `6` 101–250, `7` 251+ employees. |
| `contactFilter` | `any`, `phone`, `email`, `website` or `any_contact` — keep only records where INEGI publishes that field. |
| `registeredFrom` | `YYYY` or `YYYY-MM`: keep establishments added to DENUE in or after that month. |
| `coordinates` + `radiusMeters` | Search around a point, nearest first. Up to 5,000 m via the API; any radius via the bulk files. |
| `maxItems` | Stop after this many establishments. |
| `inegiToken` | Optional free INEGI API token (see below). Stored as a secret input. |
| `source` | `auto` (default), `api` or `bulk`. |

### Data sources: no key needed, API optional

Both sources are **official INEGI open data** and return the same records and the same output fields.

- **Bulk files (default, no token)** — INEGI's *descarga masiva* zips, one per state (Estado de México comes in two parts) and one per SCIAN sector. The Actor reads the zip directory with HTTP range requests and streams only the CSV, filtering row by row, so memory stays flat and a run with enough results stops downloading early. When you filter by SCIAN code it automatically picks whichever is smaller to download: the state files or the national sector files.
- **INEGI DENUE API (with your token)** — server-side filtering by state, municipality, SCIAN level and size bracket, paginated 1,000 records at a time; radius searches use INEGI's own radius method. Ideal for narrow searches in very large states (CDMX, Estado de México, Jalisco).

#### How to get a free INEGI token (1 minute)

1. Open **https://www.inegi.org.mx/app/desarrolladores/generaToken/Usuarios/token_Verify** (also linked as *"Generar token"* on INEGI's [DENUE API page](https://www.inegi.org.mx/servicios/api_denue.html)).
2. Enter your e-mail address and submit.
3. INEGI e-mails you the token (a UUID like `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`). Paste it into **INEGI API token**. It is stored encrypted as a secret input and never written to the dataset or logs.

If the token is rejected or the API is down, the Actor logs a warning and falls back to the bulk files automatically (unless you forced `source: "api"`).

### Output fields

| Field | Type | Description |
|---|---|---|
| `id` | string | DENUE establishment ID (stable across releases) |
| `clee` | string | CLEE, INEGI's unique establishment key |
| `name` | string | Business / trade name (*nombre del establecimiento*) |
| `legalName` | string | Legal name (*razón social*) when published |
| `scianCode` | string | SCIAN 2018 class code (6 digits) |
| `activity` | string | SCIAN class description |
| `employeeSize` | string | Size bracket as published (`11 a 30 personas`) |
| `employeeSizeCode` / `employeesMin` / `employeesMax` | integer | Bracket code 1–7 and its numeric bounds (`employeesMax` is null for 251+) |
| `establishmentType` | string | `Fijo` (fixed premises) or `Semifijo` (semi-fixed stall) |
| `streetType`, `street`, `exteriorNumber`, `interiorNumber` | string | Street address as published |
| `settlementType`, `colonia`, `postalCode` | string | Colonia (neighbourhood) and 5-digit postal code |
| `locality`, `municipality`, `municipalityCode`, `state`, `stateCode` | string | Geography with INEGI codes |
| `ageb`, `block` | string | AGEB and manzana keys (join with census data) |
| `shoppingCenter`, `shoppingCenterType`, `unitNumber` | string | Shopping centre / industrial corridor and unit, when applicable |
| `fullAddress` | string | One-line address built from the fields above |
| `latitude`, `longitude` | number | WGS84 coordinates |
| `phone`, `email`, `website` | string | Exactly as INEGI publishes them (often empty for micro-businesses) |
| `registrationDate` | string | `YYYY-MM` the establishment was added to DENUE |
| `distanceMeters` | integer | Distance from your center point (radius searches only) |
| `source` | string | `inegi-bulk-csv` or `inegi-api` |
| `scrapedAt` | string | ISO timestamp of the run |

A `SUMMARY` record in the run's key-value store lists the source used, files or API requests, rows scanned, megabytes downloaded and whether the run stopped at `maxItems` or at your spending limit.

### Pricing

Pay per event — you pay only for establishments delivered:

| Event | Price |
|---|---|
| Actor start | US$0.00005 per run (per GB of memory) |
| `business-result` — one establishment saved to the dataset | **US$0.003** (US$3 per 1,000) |

Examples: 50 establishments ≈ US$0.15 · 1,000 ≈ US$3 · all ~42,000 in Colima ≈ US$126. The Actor respects your run's **maximum total charge**: it never saves more items than the limit allows and stops cleanly when it is reached.

### Use cases

- **B2B lead generation** — build prospect lists by SCIAN activity, municipality and company size, then enrich them in your CRM.
- **Market sizing** — count clinics, gyms, pharmacies or restaurants per municipality and size bracket.
- **Site selection and retail analytics** — map competitors around a candidate location, nearest first, with coordinates.
- **Sales territory planning** — split Mexico by municipality and employee size.
- **New-business monitoring** — `registeredFrom` finds establishments recently added to DENUE.
- **Research and journalism** — join DENUE with census data through state/municipality codes, AGEB and manzana.

### FAQ

**Do I need an INEGI token?** No. Without a token the Actor uses INEGI's bulk files. A token only makes narrow searches in big states faster.

**How fresh is the data?** DENUE is updated by INEGI periodically; the current bulk release is **05/2026** (files dated 20 May 2026), and the API serves INEGI's current version. Each run's `SUMMARY` shows the file dates.

**How fast is it?** A state-level search with a few hundred results takes seconds. A radius search without a token scans the whole state file (Mexico City: ~45 MB, about 30 seconds). Without filters, the run streams states one by one until `maxItems` is reached.

**Why are phone, e-mail or website empty?** INEGI only publishes contact data the establishment reported; most micro-businesses report none. Use `contactFilter` to keep only records that have them. The Actor never adds contact data from other sources.

**How does keyword search work?** Words are matched accent- and case-insensitively against the start of words in the name, legal name, activity, street, colonia and place names, so `hotel` also finds `HOTELES` but `bar` does not match `abarrotes`. With a token, keyword matching is done by INEGI's API.

**Can I get all of Mexico?** Yes — leave the filters empty and set a high `maxItems`. ~6.1 million establishments; budget accordingly.

### Responsible use (please read)

DENUE is **official open data** published by INEGI under its *Términos de Libre Uso de la Información del INEGI*. The Actor returns records **exactly as INEGI publishes them** and does not enrich them with data from any other source. Note that many micro-businesses are run by **sole traders (personas físicas)**, so a business name, legal name, phone or e-mail can identify a person. You are responsible for using the data lawfully: follow Mexico's **Ley Federal de Protección de Datos Personales en Posesión de los Particulares**, honour opt-outs, respect PROFECO's **REPEP** (do-not-call register) for telemarketing, and comply with anti-spam rules and the laws of your own jurisdiction. Do not use the data for unsolicited bulk messaging.

***

### En español

**Extrae negocios de México del DENUE del INEGI** (Directorio Estadístico Nacional de Unidades Económicas, ~6.1 millones de establecimientos) en JSON, CSV o Excel: nombre del establecimiento, razón social, **código y actividad SCIAN**, **estrato de personal ocupado**, domicilio completo (vialidad, número, colonia, código postal, localidad, municipio, entidad), **latitud y longitud**, y **teléfono, correo electrónico y sitio web** cuando el INEGI los publica, además de la fecha de alta en el DENUE.

**Filtros:** palabra clave (actividad o nombre; alternativas separadas por coma), entidad federativa, municipios o alcaldías (por nombre o clave de 5 dígitos), códigos SCIAN de 2 a 6 dígitos, estratos de personal ocupado (1 = 0 a 5 … 7 = 251 y más), solo registros con teléfono / correo / sitio web, fecha de alta mínima y **búsqueda por radio** alrededor de un punto (resultados del más cercano al más lejano, con `distanceMeters`).

**Sin token funciona igual:** el Actor lee en streaming los archivos de **descarga masiva** oficiales del INEGI (uno por entidad, o por sector SCIAN si así se descarga menos) y filtra fila por fila. **Con un token gratuito del INEGI** usa la **API oficial del DENUE**, más rápida para búsquedas acotadas en entidades grandes (CDMX, Estado de México, Jalisco). Para obtener el token: entra a https://www.inegi.org.mx/app/desarrolladores/generaToken/Usuarios/token_Verify, escribe tu correo y el INEGI te lo envía; pégalo en el campo *INEGI API token* (se guarda cifrado como entrada secreta).

**Precio:** US$3 por cada 1,000 establecimientos (evento `business-result`), más un cargo mínimo de inicio. El Actor respeta el límite de cargo máximo de tu corrida.

**Uso responsable:** son datos abiertos oficiales del INEGI y se entregan tal como el INEGI los publica, sin enriquecerlos con otras fuentes. Muchos micronegocios pertenecen a **personas físicas**: cumple la **LFPDPPP**, respeta el **REPEP** de PROFECO y las reglas contra el spam. No uses estos datos para envíos masivos no solicitados.

**Ejemplo:** consultorios dentales (SCIAN `621211`) con algún dato de contacto en la alcaldía Cuauhtémoc → `{"state": "09", "municipalities": ["Cuauhtémoc"], "scianCodes": ["621211"], "contactFilter": "any_contact"}`.

# Actor input Schema

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

Words to find in the business name, legal name (razón social), activity description or address, accents optional (e.g. `hotel`, `dentista`, `farmacia`, `taller mecánico`). All words of a phrase must appear; separate alternatives with commas (`motel,hostal`). Leave empty to list every establishment that matches the other filters.

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

Limit to one of Mexico's 32 states. `All of Mexico` scans the whole country (slower without a token unless you also set a SCIAN code, a municipality or a radius).

## `municipalities` (type: `array`):

Optional. Official INEGI municipality names (accents optional: `Manzanillo`, `Benito Juarez`, `Cuauhtémoc`) or 5-digit codes (state + municipality, e.g. `09015` = Cuauhtémoc, CDMX). Names that exist in several states match all of them unless you also pick a state.

## `scianCodes` (type: `array`):

Optional. SCIAN 2018 codes of 2 to 6 digits; each one matches every activity class starting with it. Examples: `72` accommodation & food services, `7225` restaurants, `621211` dentists, `4611` grocery stores, `31-33` all manufacturing. Several codes = any of them.

## `employeeSizes` (type: `array`):

Optional. Keep only establishments in these personal-ocupado brackets, as published by INEGI. Empty = all sizes.

## `contactFilter` (type: `string`):

Optional. Keep only establishments for which INEGI publishes this contact field. Many micro-businesses publish none.

## `registeredFrom` (type: `string`):

Optional. Keep only establishments whose DENUE registration date (`fecha_alta`, the month INEGI added the record) is this month or later, e.g. `2024` or `2025-11`. Useful to find recently registered businesses.

## `coordinates` (type: `string`):

Optional. Return establishments within `radiusMeters` of this point, nearest first, e.g. `19.4326,-99.1332` (Zócalo, Mexico City). Copy it from Google Maps (right-click on the map).

## `radiusMeters` (type: `integer`):

Search radius around the center point. The INEGI API allows up to 5,000 m; larger radii automatically use the bulk files.

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

Stop after this many establishments. DENUE lists ~6.1 million in total (Ciudad de México ~463k, Jalisco ~402k, Colima ~42k).

## `inegiToken` (type: `string`):

Optional. With a token the Actor queries INEGI's official DENUE API (fast for narrow searches, no big downloads). Get one free in 1 minute: open https://www.inegi.org.mx/app/desarrolladores/generaToken/Usuarios/token_Verify, enter your e-mail, and INEGI sends the token. Without a token the Actor streams INEGI's official bulk CSV files instead — same records, it just downloads more.

## `source` (type: `string`):

`auto` uses the API when a token is present (and the query fits the API: radius up to 5 km) and the bulk CSV files otherwise. `bulk` always uses the CSV files; `api` requires a token.

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

INEGI serves its open data to plain requests, so no proxy is needed. If INEGI ever refuses the connection, the Actor automatically retries once through Apify RESIDENTIAL proxies in Mexico.

## Actor input object example

```json
{
  "keyword": "hotel",
  "state": "06",
  "municipalities": [],
  "scianCodes": [],
  "employeeSizes": [],
  "contactFilter": "any",
  "radiusMeters": 1000,
  "maxItems": 50,
  "source": "auto",
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `businesses` (type: `string`):

All establishments collected during the run

## `summary` (type: `string`):

Source used, files/requests, rows scanned and counts

# 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 = {
    "keyword": "hotel",
    "state": "06",
    "municipalities": [],
    "maxItems": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("fabrikit/denue-mexico-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 = {
    "keyword": "hotel",
    "state": "06",
    "municipalities": [],
    "maxItems": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("fabrikit/denue-mexico-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 '{
  "keyword": "hotel",
  "state": "06",
  "municipalities": [],
  "maxItems": 50
}' |
apify call fabrikit/denue-mexico-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,fabrikit/denue-mexico-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/Ff9n3N6WdB9bThcJg/builds/gv4Omtt7CqmJcGFIq/openapi.json
