# Magicbricks Property Scraper (`scrapeai/magicbricks-property-scraper`) Actor

Magicbricks is an Indian online real estate platform that helps users buy, sell, and rent residential and commercial properties by providing verified listings, advanced search filters, price trends, and direct contact with property owners, agents, and builders.

- **URL**: https://apify.com/scrapeai/magicbricks-property-scraper.md
- **Developed by:** [ScrapeAI](https://apify.com/scrapeai) (community)
- **Categories:** Real estate, Lead generation, Automation
- **Stats:** 29 total users, 0 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

$4.00/month + usage

To use this Actor, you pay a monthly rental fee to the developer. The rent is subtracted from your prepaid usage every month after the free trial period. You also pay for the Apify platform usage, which gets cheaper the higher Apify subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#rental-actors

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

## 🏠 Magicbricks Property Scraper - API Based

This Apify actor retrieves real estate data directly through the Magicbricks API. Search by city, property type, and bedrooms to collect structured property information including title, price, location, area, amenities, and images. Perfect for real estate research, price monitoring, and market analysis.

### ✅ Use Cases

- 📊 Monitor property pricing trends
- 🔍 Track property availability across cities
- 📈 Conduct real estate market research
- 💰 Build property comparison databases
- 📋 Generate property listings with specifications

### 📥 Input Configuration

You can customize the actor using the following input fields:

```json
{
    "searchUrl": "https://www.magicbricks.com/property-for-sale/residential-real-estate?bedroom=2,3&proptype=Multistorey-Apartment,Villa&cityName=Bangalore",
    "apiUrl": "",
    "maxProperties": 50,
    "minPrice": 0,
    "maxPrice": 0,
    "minBedrooms": 2,
    "maxBedrooms": 3,
    "sortBy": "premiumRecent"
}
```

#### 🧾 Fields Explained

| Field | Type | Description |
|-------|------|-------------|
| `searchUrl` | string | Magicbricks search URL with filters (city, bedrooms, property type) |
| `apiUrl` | string | Direct Magicbricks API URL. If provided, searchUrl is ignored |
| `maxProperties` | number | Maximum number of properties to retrieve (1-1000) |
| `minPrice` | number | Minimum price filter in INR. Set to 0 for no minimum |
| `maxPrice` | number | Maximum price filter in INR. Set to 0 for no maximum |
| `minBedrooms` | number | Minimum bedrooms (BHK). Set to 0 for no filter |
| `maxBedrooms` | number | Maximum bedrooms (BHK). Set to 0 for no filter |
| `sortBy` | string | Sort order: "premiumRecent", "price\_asc", "price\_desc", "recentFirst", "relevance" |
| `pageNumber` | number | Starting page number for pagination |

### 📤 Output

The actor returns a dataset containing structured property records. Each record includes comprehensive details about the property, suitable for price monitoring, analytics, and market research.

#### 🧩 Sample Output

```json
{
    "property_id": "12345678",
    "property_title": "3 BHK Apartment in Whitefield",
    "property_type": "Multistorey-Apartment",
    "locality": "Whitefield",
    "city": "Bangalore",
    "address": "Whitefield Main Road, Bangalore",
    "bedrooms": 3,
    "bathrooms": 2,
    "carpet_area": 1450,
    "carpet_area_unit": "sqft",
    "floor_number": 5,
    "total_floors": 12,
    "price": 9500000,
    "price_display": "95 Lac",
    "price_per_sqft": 6551,
    "possession_status": "Ready to Move",
    "furnishing": "Semi-Furnished",
    "age_of_property": "New Construction",
    "builder_name": "ABC Developers",
    "project_name": "Green Valley Heights",
    "amenities": ["Gym", "Swimming Pool", "Parking"],
    "image_url": "https://img.staticmb.com/...",
    "listing_url": "https://www.magicbricks.com/..."
}
```

#### 📋 Output Fields

| Field | Type | Description |
|-------|------|-------------|
| `property_id` | string | Unique property identifier |
| `property_title` | string | Property listing title |
| `property_type` | string | Type of property (Apartment, Villa, etc.) |
| `locality` | string | Property locality/area name |
| `city` | string | City where property is located |
| `bedrooms` | integer | Number of bedrooms (BHK) |
| `bathrooms` | integer | Number of bathrooms |
| `carpet_area` | number | Carpet area of the property |
| `carpet_area_unit` | string | Unit of measurement (sqft, sqm) |
| `floor_number` | integer | Floor number of the property |
| `total_floors` | integer | Total floors in the building |
| `price` | number | Property price in INR |
| `price_display` | string | Formatted price for display |
| `price_per_sqft` | number | Price per square foot |
| `possession_status` | string | Possession status (Ready to Move, etc.) |
| `furnishing` | string | Furnishing status |
| `builder_name` | string | Builder/developer name |
| `project_name` | string | Project/society name |
| `amenities` | array | Property amenities list |
| `image_url` | string | Main property image URL |
| `listing_url` | string | Property listing URL on Magicbricks |

### 🔍 Data Source

- ✓ Data fetched exclusively via Magicbricks API (HTTP GET requests)
- ✓ No HTML scraping or DOM parsing
- ✓ Real-time property information directly from Magicbricks
- ✓ Automatic filtering and deduplication

### 🔒 Proxy Configuration

This actor uses standard HTTP headers with optional proxy support for:

- Avoiding IP-based rate limiting or bans
- Accessing location-specific data
- Ensuring stable data retrieval at scale

Configure proxy settings in Apify:

```json
{
  "useApifyProxy": true,
  "apifyProxyGroups": ["RESIDENTIAL"],
  "apifyProxyCountry": "IN"
}
```

### 🚀 How to Use

1. Open the actor in Apify Console
2. Click "Try actor" or create a new task
3. Enter your Magicbricks search URL or API URL
4. Configure optional filters (price range, bedrooms)
5. Run the actor
6. Download results in JSON, CSV, or Excel format

### ⚙️ Advanced Input Example

```json
{
    "apiUrl": "https://www.magicbricks.com/mbsrp/propertySearch.html?editSearch=Y&category=S&propertyType=10002,10003&bedrooms=11701,11702&city=3327&page=1&sortBy=premiumRecent&pType=10002,10003&isNRI=N&multiLang=en",
    "maxProperties": 100,
    "minPrice": 5000000,
    "maxPrice": 20000000,
    "minBedrooms": 2,
    "maxBedrooms": 3,
    "sortBy": "price_asc"
}
```

### 🛠️ Tech Stack

- **Apify SDK** — actor orchestration and data handling
- **Node.js 18+** — runtime environment
- **node-fetch** — HTTP client for API requests
- **Magicbricks API** — exclusive data source for property information

### 📊 Data Processing Features

- ✓ Automatic duplicate detection using Property IDs
- ✓ Filtering by price range and bedroom count
- ✓ Structured data parsing and normalization
- ✓ Comprehensive logging and error handling
- ✓ Schema validation for all output records
- ✓ Pagination support for large result sets

### 🔧 Local Development

#### Installation

```bash
npm install
```

#### Running the Actor

```bash
npm start
```

#### Validation

Validate all generated datasets against the schema:

```bash
node validate-datasets.js
```

#### Code Quality

Format code:

```bash
npm run format
```

Check linting:

```bash
npm run lint
```

### 📂 Project Structure

```
.
├── .actor/                          # Actor configuration
│   ├── actor.json                  # Actor metadata
│   ├── input_schema.json           # Input parameters schema
│   ├── dataset_schema.json         # Output dataset schema
│   ├── input.json                  # Default input
│   ├── input-local.json            # Local development input
│   └── input-production.json       # Production input
├── src/
│   └── main.js                     # Main actor script
├── storage/
│   └── datasets/default/           # Generated datasets
├── package.json                    # Dependencies
├── validate-datasets.js            # Dataset validator
└── README.md                       # This file
```

### 🤝 Support

For issues, questions, or feature requests, please refer to the Apify documentation or contact support.

# Actor input Schema

## `searchUrl` (type: `string`):

Magicbricks search URL. The scraper will automatically capture the API endpoint from network requests. Example: 'https://www.magicbricks.com/property-for-sale/residential-real-estate?bedroom=2,3\&proptype=Multistorey-Apartment\&cityName=Bangalore'

## `maxProperties` (type: `integer`):

Maximum number of properties to retrieve

## `minPrice` (type: `integer`):

Minimum price filter (in INR). Set to 0 for no minimum.

## `maxPrice` (type: `integer`):

Maximum price filter (in INR). Set to 0 for no maximum.

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

Minimum number of bedrooms (BHK). Set to 0 for no filter.

## `maxBedrooms` (type: `integer`):

Maximum number of bedrooms (BHK). Set to 0 for no filter.

## `sortBy` (type: `string`):

Sort order for search results

## `pageNumber` (type: `integer`):

Starting page number for pagination

## `useProxy` (type: `boolean`):

Use Apify Proxy for requests. Recommended for production to avoid rate limiting.

## `proxyConfig` (type: `object`):

Proxy configuration. Leave default for best results. Using Indian IPs for optimal Magicbricks access.

## Actor input object example

```json
{
  "searchUrl": "https://www.magicbricks.com/property-for-sale/residential-real-estate?bedroom=2,3&proptype=Multistorey-Apartment,Builder-Floor-Apartment,Penthouse,Studio-Apartment,Residential-House,Villa&cityName=Bangalore",
  "maxProperties": 50,
  "minPrice": 0,
  "maxPrice": 0,
  "minBedrooms": 0,
  "maxBedrooms": 0,
  "sortBy": "premiumRecent",
  "pageNumber": 1,
  "useProxy": true,
  "proxyConfig": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "IN"
  }
}
```

# 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 = {
    "searchUrl": "https://www.magicbricks.com/property-for-sale/residential-real-estate?bedroom=2,3&proptype=Multistorey-Apartment,Builder-Floor-Apartment,Penthouse,Studio-Apartment,Residential-House,Villa&cityName=Bangalore",
    "maxProperties": 50,
    "proxyConfig": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ],
        "apifyProxyCountry": "IN"
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapeai/magicbricks-property-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 = {
    "searchUrl": "https://www.magicbricks.com/property-for-sale/residential-real-estate?bedroom=2,3&proptype=Multistorey-Apartment,Builder-Floor-Apartment,Penthouse,Studio-Apartment,Residential-House,Villa&cityName=Bangalore",
    "maxProperties": 50,
    "proxyConfig": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
        "apifyProxyCountry": "IN",
    },
}

# Run the Actor and wait for it to finish
run = client.actor("scrapeai/magicbricks-property-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 '{
  "searchUrl": "https://www.magicbricks.com/property-for-sale/residential-real-estate?bedroom=2,3&proptype=Multistorey-Apartment,Builder-Floor-Apartment,Penthouse,Studio-Apartment,Residential-House,Villa&cityName=Bangalore",
  "maxProperties": 50,
  "proxyConfig": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "IN"
  }
}' |
apify call scrapeai/magicbricks-property-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,scrapeai/magicbricks-property-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/D3AASTKdOINn8qDT4/builds/0Zlb6jM2V4wqcoPwH/openapi.json
