# Spain Tourist Dwellings Scraper (Valencian Community Registry) (`steadfetch/gva-viviendas-turisticas-extractor`) Actor

Spanish tourist dwellings (viviendas de uso turistico) of the Valencian Community registry as JSON, one row per dwelling with its INE municipality code, bed places, bedrooms, surface and registration date. Official open data, no address or owner data.

- **URL**: https://apify.com/steadfetch/gva-viviendas-turisticas-extractor.md
- **Developed by:** [Steadfetch](https://apify.com/steadfetch) (community)
- **Categories:** Travel
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 tourist dwelling 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/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

## Spain Tourist Dwellings Scraper (Valencian Community Registry)

Every tourist dwelling (vivienda de uso turistico) registered in the Valencian Community, one JSON row per dwelling, with the INE municipality code so it joins other Spanish municipal data. The data comes from the **official open-data registry of the Generalitat Valenciana** (provinces of Alicante, Castellon and Valencia).

- **Source:** [Generalitat Valenciana open data, tourist dwellings list](https://dadesobertes.gva.es/dataset/tur-gestur-vt) (public, CSV, licence CC BY).
- **One row per dwelling**, filtered by municipality.
- **No personal data:** no address, no cadastral reference, no trade or owner name, no web.

### What it does

A run downloads the registry CSV (about 15 MB and 90,000 dwellings) as a stream, keeps the municipalities you ask for and emits one validated row per dwelling:

- `municipalityCode`: five-digit INE code (province plus municipality, for example `03047` for Calp).
- `registrationNumber`, `postalCode`, `bedPlaces`, `bedrooms`, `surfaceM2`, `registeredAt`, `isRural`, `isStudio`.
- Blank values in the source are `null`, never `0`.

It first asks the open-data catalogue for the current CSV address and falls back to a fixed one if the lookup fails. Rows with the wrong number of columns are skipped and counted in the run log. If the source answers with an HTML page, a block (HTTP 401, 403, 429, 451) or a file that is not the registry, the run fails with a clear error and delivers nothing.

### Input

```json
{ "municipalityCodes": ["03047"], "maxItems": 50 }
```

| Field | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `municipalityCodes` | array of strings | no | all | 5-digit INE codes. Only provinces `03` (Alicante), `12` (Castellon) and `46` (Valencia). Empty means every municipality. A wrong code (`"3047"`, `"28079"`, `"03047 "`) fails the run before anything is downloaded. |
| `maxItems` | integer | no | 10,000 | 1 to 100,000 dwellings. Calp alone has about 5,500. |

### Example output

```json
{
  "url": "https://dadesobertes.gva.es/dataset/758f8f8e-c5af-4622-b268-a6c591710a51/resource/b1bdc28e-9813-422a-ab7a-63c21290493d/download/lista-de-viviendas-turisticas.csv",
  "title": "Tourist dwelling CV-VUT0504720-A (CALP)",
  "scrapedAt": "2026-11-16T13:46:23.492Z",
  "municipalityCode": "03047",
  "municipalityName": "CALP",
  "source": "Generalitat Valenciana - Registro de Turismo",
  "registrationNumber": "CV-VUT0504720-A",
  "postalCode": "03710",
  "bedPlaces": 8,
  "bedrooms": 4,
  "surfaceM2": 116,
  "registeredAt": "2024-01-24",
  "isRural": false,
  "isStudio": false
}
```

### Pricing

Pay-per-event with the two synthetic platform events: `apify-actor-start` at 0.00005 USD per run and `apify-default-dataset-item` at 0.002 USD per dwelling, which is **2.00 USD per 1,000 results**. There is no custom per-item event and no `Actor.charge()` call, so users are never billed twice. A failed run delivers nothing and only incurs the start event.

Measured locally on 16-11-2026 with Calp (`03047`):

| Measurement | Value |
| --- | --- |
| Rows delivered | 5,546 (of 89,998 in the file) |
| Run time | about 23 s of Actor time (about 38 s through `apify run`, including the CLI start) |
| Peak memory | 167 MB resident (Actor minimum memory is 256 MB) |
| Network | 1 catalogue request plus 1 CSV download of 15 MB |

At 256 MB and 23 s a run uses about 0.0016 GB-hours, so about 0.0005 USD of compute at 0.30 USD per GB-hour, against 11 USD of results: the price keeps a wide margin over the measured cost. The platform figure has not been billed yet. **Works on the Apify free plan:** the 5 USD monthly credit covers about 2,499 results.

### Development

```bash
npm install
npm test                 # lint + typecheck + offline tests, no credit
npm run schemas:validate
npm run publish:check
```

The tests run on `test/fixtures/viviendas-muestra.csv`, a cut of the real file (see `docs/data-map.md`).

### FAQ

**How fresh is the data?** Each run downloads the official CSV published by the Generalitat Valenciana. No third-party copy is used.

**Why are there no addresses?** The registry file includes the street address, the cadastral reference, a trade or owner name and a web address of each dwelling. They identify the property or its owner, so they are never part of the output.

**Why is a field `null`?** The source left it blank (or `.00` for the surface). Values are never guessed or replaced by 0.

**Does it cover the whole of Spain?** No. This registry covers the Valencian Community only (province codes 03, 12 and 46). Other regions publish their own registries.

**Does it need a proxy or a browser?** No. Plain HTTPS requests.

**What happens on a block or a bad answer?** The run fails with a clear error and delivers nothing. The Actor never solves CAPTCHAs or tries to get around access controls.

### Maintenance

This Actor is **tested daily**: automated runs keep the source reachable and the output schema valid, and failures open an issue in this repository. Schema changes are announced through repository releases.

### Legal and attribution

Data source: Generalitat Valenciana, open data (dadesobertes.gva.es), licence Creative Commons Attribution (CC BY). The Actor sends an honest User-Agent with contact information and makes two HTTP requests per run. See `docs/legal-gate.md`. Steadfetch is not affiliated with the Generalitat Valenciana.

# Actor input Schema

## `municipalityCodes` (type: `array`):

5-digit INE codes of the municipalities to return: 2-digit province plus 3-digit municipality, as text. Only provinces 03 (Alicante), 12 (Castellon) and 46 (Valencia) exist in this registry. Leave empty to return every municipality, up to Max items. A wrong code (for example "3047" or "28079") fails the run before anything is downloaded.

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

Maximum number of dwellings to push to the dataset (1 to 100,000). The registry holds about 90,000 dwellings; Calp alone has about 5,500.

## Actor input object example

```json
{
  "municipalityCodes": [
    "03047"
  ],
  "maxItems": 50
}
```

# Actor output Schema

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

Dataset items validated against the item schema in dataset_schema.json (fields).

# 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 = {
    "municipalityCodes": [
        "03047"
    ],
    "maxItems": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("steadfetch/gva-viviendas-turisticas-extractor").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 = {
    "municipalityCodes": ["03047"],
    "maxItems": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("steadfetch/gva-viviendas-turisticas-extractor").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 '{
  "municipalityCodes": [
    "03047"
  ],
  "maxItems": 50
}' |
apify call steadfetch/gva-viviendas-turisticas-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,steadfetch/gva-viviendas-turisticas-extractor"
        }
    }
}
```

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/zKJlyChlOAurPnDHT/builds/qEiDckWcwgeGfiOWN/openapi.json
