# Casa 47 Spain Public Housing Rental Scraper (`angaba92/casa47-public-housing-scraper`) Actor

Export every affordable rental home published by Casa 47, Spain's state housing entity: rent, size, bedrooms, elevator, storage room and GPS coordinates. Official API, no browser.

- **URL**: https://apify.com/angaba92/casa47-public-housing-scraper.md
- **Developed by:** [Andres Garcia-Baquero Leon](https://apify.com/angaba92) (community)
- **Categories:** Real estate
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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

## Casa 47 Spain Public Housing Rental Scraper

Export every affordable rental home published by **Casa 47**, Spain's state housing entity (*Entidad Estatal de Vivienda*), as clean structured data.

Casa 47 launched its public rental portal in September 2026 with its first **645 homes** across Spain. This actor reads the portal's own official data API and returns each listing with rent, size, rooms, amenities and GPS coordinates — ready for analysis, alerts or a map.

### What you get

Each listing includes:

| Field | Description |
|---|---|
| `reference` | Official Casa 47 reference code, e.g. `26-7-VAL-004` |
| `listingId` | Stable internal record ID |
| `province` | Spanish province, resolved from postcode |
| `region` | Region implied by the official reference code |
| `postcode` | Postcode (`null` when the portal has not published it) |
| `priceMonth` | Monthly rent in EUR |
| `currency` | Always `EUR` |
| `sizeM2` | Built floor area in square metres |
| `pricePerM2` | Computed rent per square metre |
| `bedrooms` / `bathrooms` | Room counts |
| `floor` | Floor label, e.g. `Bajo`, `1` |
| `hasElevator` / `hasStorageRoom` | Building amenities |
| `latitude` / `longitude` | GPS coordinates |
| `mapUrl` | Ready-to-open Google Maps link |
| `status` | Listing status reported by the portal |
| `listedAt` | When the home was published |
| `portalUrl`, `source`, `scrapedAt` | Provenance metadata |

### Example output

```json
{
  "reference": "26-7-VAL-004",
  "province": "Valencia",
  "region": "Valencia",
  "postcode": "46550",
  "priceMonth": 587.0,
  "currency": "EUR",
  "sizeM2": 73.0,
  "pricePerM2": 8.04,
  "bedrooms": 3,
  "bathrooms": 1,
  "floor": "Bajo",
  "hasElevator": false,
  "hasStorageRoom": false,
  "latitude": 39.544381216274,
  "longitude": -0.325596341982626,
  "mapUrl": "https://www.google.com/maps?q=39.544381216274,-0.325596341982626",
  "listedAt": "2026-07-14T07:52:17Z",
  "source": "portal.casa47.es"
}
```

### Input options

All inputs are optional — run it empty to get the cheapest homes in Spain.

| Option | Description |
|---|---|
| `maxItems` | Maximum listings to return (default 100) |
| `provinces` | Filter by province or region, e.g. `["Valencia", "Galicia"]` |
| `minPriceEur` / `maxPriceEur` | Monthly rent bounds. Current rents run 350–1066 EUR |
| `minBedrooms` | Minimum number of bedrooms |
| `minSizeM2` | Minimum built size in m² |
| `requireElevator` | Only buildings with an elevator |
| `requireStorageRoom` | Only homes including a storage room (*trastero*) |
| `onlyNew` | Only homes that appeared, or changed price, since the previous run |
| `sort` | `priceAsc`, `priceDesc`, `sizeAsc`, `sizeDesc`, `bedroomsDesc`, `newest`, `reference` |

#### Example: large affordable family homes in Valencia

```json
{
  "provinces": ["Valencia"],
  "minBedrooms": 3,
  "maxPriceEur": 650,
  "sort": "priceAsc",
  "maxItems": 50
}
```

### Track new homes (alerts)

Casa 47 publishes stock in waves, so the useful question is usually *what changed*, not *what exists*. Set `onlyNew: true` and schedule the Actor: each run compares the portal against what the previous run saw and returns only homes that are **new** or whose **rent changed**.

```json
{ "onlyNew": true, "provinces": ["Valencia"], "maxPriceEur": 600 }
```

Every listing carries `changeType` (`new`, `priceChanged`, `existing`), `isNew`, and `previousPriceMonth` when the rent moved. The Actor also writes a `RUN_SUMMARY` record with counts and the references that **disappeared** from the portal.

> The first run has no baseline, so it records the starting point and returns nothing. From the second run onwards you get real changes — combine it with Apify's scheduler and integrations to get an email or webhook the moment a matching home appears.

### Use cases

- **Housing seekers** — track new affordable homes and get alerted when one matches your budget, size and location.
- **Journalists and researchers** — analyse public rent levels, price per m² and geographic distribution of Spain's state housing rollout.
- **Policy and NGO analysts** — monitor how the public housing stock grows across regions over time.
- **Proptech and data teams** — benchmark public rents against private market listings.

Schedule the actor daily and compare runs to detect newly published homes as future Casa 47 rounds open.

### How it works

The actor calls the official public data API behind `portal.casa47.es` and paginates through every record. There is no login, no cookies, no headless browser and no HTML parsing, so runs are fast and cheap. Filtering and sorting are applied to the full inventory before results are returned, so `maxItems` always gives you the *best* matches, not just the first ones found.

### Scope and limitations

- Returns the homes **published on the Casa 47 rental portal**. It does not cover regional or municipal public housing registries, nor the private market.
- The portal exposes rent, size, rooms, floor, elevator, storage room and coordinates. It does **not** expose street addresses, photos or energy certificates through its public API, so those are not included.
- About 29 of the current listings carry a placeholder postcode on the portal; for those, `postcode` is `null` and the province is resolved from the official reference code instead.
- This actor **reads published listings only**. It cannot submit an application. Applications must be filed through the official Casa 47 electronic office within each open call's deadline.
- Casa 47 publishes homes in time-limited rounds. Inventory size and availability change between calls.

### Pricing

Pay per result: **$2.00 per 1,000 listings** ($0.002 per listing), plus a small run-start fee. You are charged only for listings actually delivered to your dataset.

### Data source

Official portal of Casa 47, Entidad Estatal de Vivienda — <https://portal.casa47.es>. Public listing data only.

# Actor input Schema

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

Maximum number of housing listings to return. The portal currently publishes around 645 homes.

## `provinces` (type: `array`):

Filter by province or region name, e.g. Valencia, Alicante, Cataluña, Galicia, Navarra, Asturias, Castilla-La Mancha. Leave empty for all of Spain.

## `minPriceEur` (type: `integer`):

Only return homes with a monthly rent at or above this amount.

## `maxPriceEur` (type: `integer`):

Only return homes with a monthly rent at or below this amount. Current rents range from 350 to 1066 EUR.

## `minBedrooms` (type: `integer`):

Only return homes with at least this many bedrooms.

## `minSizeM2` (type: `integer`):

Only return homes with at least this built floor area in square metres.

## `requireElevator` (type: `boolean`):

Return only buildings that have an elevator.

## `requireStorageRoom` (type: `boolean`):

Return only homes that include a storage room (trastero).

## `onlyNew` (type: `boolean`):

Return only homes that appeared, or changed price, since the previous run of this Actor. The very first run has no baseline to compare against, so it returns nothing and just records the starting point — schedule the Actor and the following runs will report real changes.

## `sort` (type: `string`):

How to order the returned listings.

## Actor input object example

```json
{
  "maxItems": 100,
  "provinces": [],
  "requireElevator": false,
  "requireStorageRoom": false,
  "onlyNew": false,
  "sort": "priceAsc"
}
```

# Actor output Schema

## `dataset` (type: `string`):

One row per Casa 47 affordable rental home.

# 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": 100,
    "provinces": [],
    "sort": "priceAsc"
};

// Run the Actor and wait for it to finish
const run = await client.actor("angaba92/casa47-public-housing-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": 100,
    "provinces": [],
    "sort": "priceAsc",
}

# Run the Actor and wait for it to finish
run = client.actor("angaba92/casa47-public-housing-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": 100,
  "provinces": [],
  "sort": "priceAsc"
}' |
apify call angaba92/casa47-public-housing-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,angaba92/casa47-public-housing-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/If8I4NJSFmOazXO4G/builds/OEmOwyMmQkQVp0XOj/openapi.json
