# Vivanuncios Scraper: Mexico Casas, Departamentos y Terrenos (`automatic/vivanuncios-mx-scraper`) Actor

Vivanuncios scraper for Mexico real estate: casas, departamentos y terrenos en venta y renta from vivanuncios.com.mx with MXN/USD prices, m2, recamaras, banos, exact coordinates, developments and agency. Paste any Vivanuncios search URL; listings are saved page by page.

- **URL**: https://apify.com/automatic/vivanuncios-mx-scraper.md
- **Developed by:** [Philip Kirkbride](https://apify.com/automatic) (community)
- **Categories:** Real estate
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.05 / 1,000 listings

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

## Vivanuncios Scraper: casas, departamentos y terrenos en México

Convierte cualquier búsqueda de **Vivanuncios** en un dataset limpio de **bienes raíces en México**: *casas, departamentos y terrenos en venta y en renta*, desarrollos incluidos, en cualquier estado, ciudad o colonia. **Pega la URL de la búsqueda** que ya armaste en `vivanuncios.com.mx`, con sus filtros, o elige el tipo de inmueble y presiona Start para ver lo más reciente de todo el país. Sin cuenta de Vivanuncios y sin programar; los anuncios se guardan página por página.

Cada anuncio llega como una fila: precio en su moneda (**MXN** o **USD**), m², recámaras, baños, estacionamientos, dirección con latitud y longitud exactas, antigüedad, fotos, descripción, inmobiliaria y un ID estable para seguir el mercado en el tiempo. Úsalo desde el Apify Console, con una programación, o conectado a hojas de cálculo, BI, Zapier, Make o n8n.

Pensado para comparables de precio por colonia, prospección de inmobiliarias y desarrolladoras, estudios de renta y monitoreo de nuevos anuncios.

### Inicio rápido

El formulario abre listo: departamentos en venta en México, unos 20 anuncios. Una entrada vacía (`{}`) busca departamentos en venta en todo el país con un límite de 50 anuncios. Para más, sube `maxResults` (hasta 2,700): la corrida lee las páginas que hagan falta y el tiempo límite predeterminado alcanza para todos. Para un estado, ciudad, colonia o cualquier filtro, abre Vivanuncios, aplica la búsqueda y pega la URL en `startUrls`.

```json
{"portal":"vivanuncios","operation":"sale","propertyType":"departamentos","maxResults":10}
```

### Casos de uso

- **Comparables por colonia.** Precio pedido y precio por m² en Polanco, Condesa, Del Valle, Zapopan o San Pedro Garza García.
- **Prospección de inmobiliarias y desarrolladoras.** Quién publica en cada zona y con cuánto inventario.
- **Desarrollos y preventas.** `isDevelopment` e `isStartingPrice` separan los proyectos con precio "desde" de las unidades individuales.
- **Rentas.** Elige `rental` o pega una búsqueda de renta de tu zona para seguir precios y estimar rendimientos.
- **Monitoreo.** Programa la misma búsqueda y compara corridas por `listingKey` para ver altas, bajas y cambios de precio.
- **Datos para modelos.** Un dataset tipado, listo para Excel, Google Sheets, Python o Power BI.

### Qué obtienes

- **Identidad:** `id`, `listingKey`, `name` y `url`.
- **Precio:** `price` y `currency` tal como se publican (MXN o USD, nunca convertidos), `prices` y `pricePerM2` cuando precio y medida describen la misma oferta.
- **Inmueble:** `areaM2` con `totalAreaM2` cuando se publica, `bedrooms` (recámaras), `bathrooms` (baños), `parkings` (estacionamientos) y `antiquity` (antigüedad).
- **Ubicación:** `address`, `streetAddress`, `locationHierarchy`, `normalizedLocation`, y `latitude` / `longitude` cuando el anuncio muestra la dirección exacta.
- **Anunciante:** `publisherName`, `publisherUrl` y `logoUrl` cuando aparecen.
- **Medios:** `imageUrl`, `photos` y `description`.
- **Fechas y alcance:** `modifiedAt`, `collectedAt`, `operation`, `propertyType`, `location`, `portal`, `country`, `source` y `queryProvenance`.
- **Desarrollos:** `postingType`, `isDevelopment` e `isStartingPrice`.

### Entrada

**1. Pega URLs de búsqueda (`startUrls`).** Abre vivanuncios.com.mx, elige categoría (venta o renta), estado, ciudad o colonia y los filtros que quieras, y copia la barra de direcciones. Hasta 10 URLs como `{"url": "..."}`; `maxResults` se reparte por igual entre las búsquedas, un anuncio repetido sale una sola vez y una URL de una página posterior empieza en la página 1. Deja `operation` en `sale` y `propertyType` en `departamentos`; cada URL trae los suyos.

Puedes añadir `priceMin` o `priceMax` a una URL sin rango de precio. Si la URL ya tiene un rango, los límites que indiques en el formulario deben coincidir con los de la URL. El filtro de la URL usa MXN. Para filtrar en USD, usa una URL sin rango e indica `currency: "USD"` y al menos un límite.

**2. O usa el formulario** para búsquedas de todo México: `operation` `sale` (venta, predeterminado) o `rental` (renta), y `propertyType` `departamentos` (predeterminado), `casas`, `inmuebles` (todos) o `terrenos` (solo venta).

**Afina:** `priceMin` / `priceMax` con `currency` (en MXN filtra el propio Vivanuncios y además se revisa cada anuncio; en USD solo se guardan los anuncios dentro del rango), `bedroomsMin` / `bedroomsMax`, `bathroomsMin` / `bathroomsMax`, `areaMinM2` / `areaMaxM2` con `areaBasis`, e `includeDevelopments`.

**Tamaño:** `maxResults` de 1 a 2,700 (predeterminado 50); `maxPages` es opcional (déjalo vacío y la corrida lee las páginas que pida `maxResults`; úsalo solo para parar tras un número fijo de páginas, de 1 a 90); `requestDelaySecs` de 0.5 a 10 segundos.

### Ejemplos de búsqueda

Departamentos en venta, pegando la búsqueda del sitio:

```json
{"portal":"vivanuncios","startUrls":[{"url":"https://www.vivanuncios.com.mx/s-departamentos-en-venta/v1c1294p1"}],"maxResults":60}
```

Casas en venta en todo México con presupuesto en pesos:

```json
{"portal":"vivanuncios","operation":"sale","propertyType":"casas","priceMin":2000000,"priceMax":6000000,"currency":"MXN","maxResults":50}
```

Departamentos en renta en todo México:

```json
{"portal":"vivanuncios","operation":"rental","propertyType":"departamentos","maxResults":60}
```

Terrenos en venta:

```json
{"portal":"vivanuncios","operation":"sale","propertyType":"terrenos","maxResults":40}
```

### Ejemplo de salida

Una fila real (resumida) de una corrida de prueba:

```json
{
  "listingKey": "vivanuncios.com.mx:149075091",
  "name": "Departamentos en Venta Avivia Bosque Real",
  "url": "https://www.vivanuncios.com.mx/a-venta-departamento/bosque-real/departamentos-en-venta-avivia-bosque-real/149075091",
  "price": 7500000,
  "currency": "MXN",
  "areaM2": 185,
  "bedrooms": 3,
  "bathrooms": 3,
  "parkings": 2,
  "address": "BOULEVAR BOSQUE REAL L7 y 8",
  "latitude": 19.4205507,
  "longitude": -99.2827073,
  "publisherName": "TERRABROKERS.",
  "isDevelopment": false,
  "operation": "sale",
  "propertyType": "departamentos",
  "portal": "vivanuncios",
  "country": "MX"
}
```

### Precio

| Evento | Free | Bronze | Silver | Gold y superiores |
|---|---|---|---|---|
| Anuncio guardado | **$0.0015** | **$0.00135** | **$0.0012** | **$0.00105** |
| Inicio de corrida (por GB de memoria) | **$0.0025** | **$0.0025** | **$0.0025** | **$0.0025** |

Mil anuncios cuestan de $1.50 (Free) a $1.05 (Gold y superiores). La corrida predeterminada de 1024 MB es un evento de inicio.

### Preguntas frecuentes

**¿Qué URLs puedo pegar?** Páginas de resultados de búsqueda de Vivanuncios de inmuebles en venta o renta, con estado, ciudad, colonia y filtros, por ejemplo `/s-departamentos-en-venta/v1c1294p1`. Anuncios individuales, remates y otros sitios se rechazan.

**¿Los precios se convierten?** No. Cada precio queda en la moneda que publica el anuncio.

**¿También tienen Inmuebles24?** Sí: nuestro Inmuebles24 Scraper devuelve el mismo formato de fila, así que puedes juntar los dos datasets de México.

### In English

Vivanuncios Scraper exports vivanuncios.com.mx real estate listings for Mexico: houses, apartments and land for sale or rent, developments included, with MXN/USD prices, m², bedrooms (recámaras), bathrooms, parking, exact coordinates and agency. Paste up to 10 search URLs with their filters, or run a nationwide sale search by property type.

### Bueno saber

- La cantidad depende de lo que Vivanuncios muestra para tu búsqueda y de las páginas que ofrece; `maxResults` es un límite, no una cantidad garantizada. Para más anuncios, divide la búsqueda por estado, ciudad o rango de precio con varias URLs.
- Las búsquedas por estado, ciudad o colonia se hacen pegando la URL del sitio.
- En una lista de URLs, una búsqueda que el sitio no reconoce, o una dirección que no es una búsqueda de Vivanuncios, se omite (queda en `skippedSearches` del OUTPUT) y las demás siguen.
- Los anuncios se guardan página por página: una corrida que llega al tiempo o al límite de costo conserva lo recolectado.
- Una URL cuyos filtros el sitio ya no reconoce termina sin anuncios y con un mensaje, nunca con resultados de otra búsqueda.
- Direcciones ocultas y campos que Vivanuncios no publica quedan en null, nunca inventados.

# Actor input Schema

## `portal` (type: `string`):

This record searches only Vivanuncios (vivanuncios.com.mx, Mexico). Omit this input or use vivanuncios; a different portal is rejected.

## `operation` (type: `string`):

Listing operation to search: sale or rental. With startUrls, leave this at sale; each URL supplies its own operation.

## `propertyType` (type: `string`):

Property type to search on Vivanuncios in Mexico. Choose one of this record's supported property types.

## `priceMin` (type: `number`):

Optional positive price bound for Vivanuncios, in MXN or USD. Must not exceed priceMax. Listings outside the bounds are skipped before they are saved, so a page can yield fewer matches. Returned prices retain their source currencies.

## `priceMax` (type: `number`):

Optional positive price bound for Vivanuncios, in MXN or USD. Must be at least priceMin. Listings outside the bounds are skipped before they are saved, so a page can yield fewer matches. Returned prices retain their source currencies.

## `currency` (type: `string`):

Optional. Supply a price bound in the form or in a pasted search URL. MXN is used when a bound is set without a currency. Returned prices keep their source currency.

## `startUrls` (type: `array`):

Up to 10 HTTPS Vivanuncios listing-search URLs copied from your browser, as a URL string or {"url": "..."} object, for example https://www.vivanuncios.com.mx/s-departamentos-en-venta/v1c1294p1. Every filter in the address (area, rooms, amenities, price, sort order) is kept. Empty uses ordinary inputs. Leave operation=sale and propertyType=departamentos (the form defaults); other nondefault search fields that conflict with a URL are rejected. A later page number in the URL restarts at page 1. Unsupported or unrecognized searches appear in OUTPUT.skippedSearches. Valid URLs still run. If none are usable, the run succeeds with no results. Page/result caps are global across the batch; duplicates are returned once. You can add a price bound to a URL with no price filter. For a URL with a price filter, the supplied bounds must match the URL, which uses MXN.

## `bedroomsMin` (type: `integer`):

Optional minimum bedrooms, zero or greater. Applied after reading listings, before results are saved. Missing or ranged bedroom values are excluded. Must not exceed bedroomsMax.

## `bedroomsMax` (type: `integer`):

Optional maximum bedrooms, zero or greater. Applied after reading listings, before results are saved. Missing or ranged bedroom values are excluded. Must be at least bedroomsMin.

## `bathroomsMin` (type: `integer`):

Optional minimum bathrooms, zero or greater. Applied after reading listings, before results are saved. Missing or ambiguous bathroom values are excluded. Must not exceed bathroomsMax.

## `bathroomsMax` (type: `integer`):

Optional maximum bathrooms, zero or greater. Applied after reading listings, before results are saved. Missing or ambiguous bathroom values are excluded. Must be at least bathroomsMin.

## `areaMinM2` (type: `number`):

Optional finite positive minimum area in square metres (strictly greater than zero). Uses areaBasis. Applied after reading listings; missing, ambiguous or ranged measurements are excluded. Must not exceed areaMaxM2.

## `areaMaxM2` (type: `number`):

Optional finite positive maximum area in square metres (strictly greater than zero). Uses areaBasis. Applied after reading listings; missing, ambiguous or ranged measurements are excluded. Must be at least areaMinM2.

## `areaBasis` (type: `string`):

Select total, built or covered source-labelled area for areaMinM2/areaMaxM2. Measurements are not substituted for one another. This does not select the pricePerM2 calculation basis; read that output's companions.

## `includeDevelopments` (type: `boolean`):

Include development/project postings by default. Set false to exclude developments after reading listings, before results are saved. Projects are not individual-unit availability; their prices may be starting prices and their measurements may be ranges.

## `maxPages` (type: `integer`):

Optional cap on search pages, 1 to 90, shared across all search URLs. Leave it empty (recommended): the run reads as many pages as maxResults needs, about maxResults / 30 (Vivanuncios shows about 30 listings per page), and three times as many when bedrooms, bathrooms, area or developments are filtered. Set it only to stop a run after a fixed number of pages.

## `maxResults` (type: `integer`):

Global cap on unique matching listings, 1 to 2,700 (default 50). Listings are saved as they are found, page by page, so a run that stops early keeps everything collected so far. The default run timeout (1,200 seconds) fits about 2,700 listings; allow about 5 minutes per 1,000 listings. A target, not a guaranteed count: availability and post-read filters can reduce the result count.

## `requestDelaySecs` (type: `number`):

Delay between search-page requests, from 0.5 to 10 seconds (default 1).

## Actor input object example

```json
{
  "portal": "vivanuncios",
  "operation": "sale",
  "propertyType": "departamentos",
  "startUrls": [],
  "areaBasis": "total",
  "includeDevelopments": true,
  "maxResults": 20,
  "requestDelaySecs": 1
}
```

# 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 = {
    "portal": "vivanuncios",
    "operation": "sale",
    "propertyType": "departamentos",
    "startUrls": [],
    "areaBasis": "total",
    "includeDevelopments": true,
    "maxResults": 20,
    "requestDelaySecs": 1
};

// Run the Actor and wait for it to finish
const run = await client.actor("automatic/vivanuncios-mx-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 = {
    "portal": "vivanuncios",
    "operation": "sale",
    "propertyType": "departamentos",
    "startUrls": [],
    "areaBasis": "total",
    "includeDevelopments": True,
    "maxResults": 20,
    "requestDelaySecs": 1,
}

# Run the Actor and wait for it to finish
run = client.actor("automatic/vivanuncios-mx-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 '{
  "portal": "vivanuncios",
  "operation": "sale",
  "propertyType": "departamentos",
  "startUrls": [],
  "areaBasis": "total",
  "includeDevelopments": true,
  "maxResults": 20,
  "requestDelaySecs": 1
}' |
apify call automatic/vivanuncios-mx-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,automatic/vivanuncios-mx-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/RasZaiizKQ4zv6u2c/builds/zrlmsVFpeyxMlHa0s/openapi.json
