# Zameen.com Scraper | Pakistan Real Estate & Property Data (`haketa/zameen-scraper`) Actor

Zameen scraper & API for Pakistan real estate: search property for sale and rent and export address, price, beds, baths, area, type, agent, photos and coordinates. Pakistan property market data and real-estate lead generation — fast, no login.

- **URL**: https://apify.com/haketa/zameen-scraper.md
- **Developed by:** [Haketa](https://apify.com/haketa) (community)
- **Categories:** Real estate, Developer tools, Automation
- **Stats:** 3 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.50 / 1,000 results

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

## Zameen.com Scraper — Pakistan Real Estate, Property Listings & Plot Files Data Extractor

> **The most complete Zameen.com property data extraction tool on Apify.** Pull live for-sale and for-rent listings — houses, plots, flats, and commercial — from Pakistan's largest real estate portal, with **prices normalized from Crore/Lakh to PKR**, **areas converted from Marla/Kanal to square feet**, agent contact details, and society detection across **DHA, Bahria Town, Capital Smart City, Gulberg, Clifton, Model Town**, and more.

[![Apify Actor](https://img.shields.io/badge/Apify-Actor-blue)](https://apify.com/haketa/zameen-scraper)
[![Live Data](https://img.shields.io/badge/Data-Live%20at%20Run-orange)]()
[![Engine](https://img.shields.io/badge/Engine-Cheerio%20%2B%20got--scraping-green)]()
[![Pay Per Event](https://img.shields.io/badge/Pricing-Pay%20Per%20Event-yellow)]()
[![Coverage](https://img.shields.io/badge/Cities-10%2B%20Pakistani%20Metros-purple)]()
[![Country](https://img.shields.io/badge/Country-Pakistan-success)]()
[![No Auth](https://img.shields.io/badge/Authentication-None%20Required-success)]()
[![Currency](https://img.shields.io/badge/Currency-PKR%20%7C%20Crore%20%7C%20Lakh-red)]()

---

### What This Actor Does

The **Zameen.com Scraper** is a production-ready Apify Actor that extracts **structured property listings from [Zameen.com](https://www.zameen.com/)** — Pakistan's largest and most-trafficked real estate portal, owned by EMPG/Dubizzle Group. Zameen is the default search engine for nearly every Pakistani home buyer, tenant, builder, and overseas Pakistani investor looking at residential and commercial real estate across **Karachi, Lahore, Islamabad, Rawalpindi, Faisalabad, Multan, Peshawar, Gujranwala, Sialkot, Hyderabad, and Quetta**.

The actor crawls Zameen's server-rendered listing pages, parses each property card (with JSON-LD as a fallback for structured data), and pushes a flat, analytics-ready JSON record per listing to the Apify dataset. Unlike a generic HTML scraper, it understands the **Pakistani real estate vocabulary** out of the box — it converts `3.5 Crore` to `35,000,000 PKR`, turns `10 Marla` into `2,722 sq ft`, detects whether a listing belongs to a known housing scheme (DHA, Bahria Town, Capital Smart City, etc.), and recognizes Zameen's hybrid URL pattern (`/Homes/Lahore-for_sale-1-{page}.html`).

In a single run the actor returns ready-to-use records covering:

- **Houses & Bungalows** — single-family homes across DHA phases, Bahria Town, Gulberg, Model Town, Wapda Town, Johar Town, and every major society
- **Flats & Apartments** — high-rise apartments in Karachi (Clifton, DHA, Bahria Icon Tower), Lahore, and Islamabad
- **Upper / Lower Portions** — Pakistan-specific subdivided units common in Lahore and Karachi
- **Plots** — residential, commercial, agricultural and industrial plot files (DHA, Bahria, CDA Sectors)
- **Commercial Property** — shops, offices, warehouses, factories, plazas, and whole buildings
- **Penthouses, Farm Houses, Rooms** — the long tail of Pakistani property inventory

Each record includes title, transaction purpose (for-sale vs for-rent), property type, **normalized PKR price**, original Crore/Lakh display string, beds/baths, **area + unit + sq ft equivalent**, city, location/neighborhood, detected housing society, agent and agency name, optional phone number, full description, feature list, image URLs, and the canonical listing URL — making this the **fastest way to populate or refresh a Pakistan real estate dataset for investor analytics, AVM models, proptech apps, valuer comps, or realtor lead generation.**

---

### Why scrape Zameen yourself when this exists?

Zameen.com is technically a server-rendered Next.js site, but in practice scraping it cleanly is a multi-week engineering project. Most teams try the obvious requests-and-BeautifulSoup approach and quickly hit:

- **Mixed price formats** — `3.5 Crore`, `45 Lakh`, `PKR 35,000,000`, `Rs. 3,50,00,000` — all need to coexist in a single normalized numeric column
- **Marla / Kanal / Sq. Yd. / Sq. Ft.** — four area units used interchangeably; comparing two listings means converting everything to the same denominator
- **Society & sector parsing** — "House in DHA Phase 6 Block H" vs "10 Marla DHA Lahore" — extracting the society, phase, and block reliably requires a curated dictionary
- **403 / 429 throttling** — Zameen aggressively rate-limits non-residential IPs; ordinary VPS and cloud-egress IPs get blocked within a few hundred requests
- **Listing card selectors change** — Zameen ships UI updates every few weeks; brittle CSS selectors break overnight
- **Pagination ambiguity** — Zameen's URL scheme alternates between `/Homes/Lahore-1-{page}.html` and `/Homes/Lahore-for_sale-1-{page}.html` depending on filters
- **JSON-LD vs HTML inconsistency** — some listings expose `RealEstateListing` JSON-LD, others only have inline HTML
- **Bot detection on detail pages** — phone numbers are gated behind click events and only render after a delay; tel: links are sometimes injected client-side
- **Duplicate listings** — the same property is often posted by multiple agents; deduping requires a stable identifier (the actor uses listing ID + URL)
- **Mixed English / Urdu transliteration** — neighborhoods are spelled multiple ways (`Gulshan-e-Iqbal` / `Gulshan e Iqbal` / `Gulshan Iqbal`)
- **Phone formats** — Pakistani mobiles appear as `+92 300 1234567`, `0300-1234567`, `923001234567`; the actor normalizes these
- **No public Zameen API** — there is no official `api.zameen.com/v2/listings` endpoint; everything must be scraped from the consumer-facing HTML

This actor solves all of that: it ships with a curated society dictionary, a dual selector + JSON-LD parser, currency and area normalization functions tuned for Pakistani conventions, residential-proxy support, and a deterministic dedupe key so you can re-run safely.

---

### Quick Start

#### One-Click Run

1. Open the actor on [Apify Store](https://apify.com/haketa/zameen-scraper)
2. Pick a city (or accept the `Lahore` default) and a property type (`Homes`, `Plots`, `Commercial`, or `all`)
3. Optionally set `maxRecords: 50` to test, then hit **Start**
4. Download your dataset as **JSON, CSV, Excel, HTML, or XML** the moment the run finishes

#### API Run (Python)

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")

run = client.actor("haketa/zameen-scraper").call(run_input={
    "cities": ["Karachi", "Lahore", "Islamabad"],
    "propertyType": "Homes",
    "purpose": "for_sale",
    "scrapeDetails": True,
    "maxRecords": 500,
    "requestDelay": 1000,
    "proxyConfiguration": {"useApifyProxy": True}
})

for listing in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(
        listing["city"],
        listing["society"],
        listing["priceDisplay"],
        listing["area"], listing["areaUnit"],
        listing["bedrooms"], "bed,",
        listing["bathrooms"], "bath",
    )
````

#### API Run (Node.js / TypeScript)

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });

const run = await client.actor('haketa/zameen-scraper').call({
    cities: ['Islamabad'],
    propertyType: 'Plots',
    purpose: 'for_sale',
    maxRecords: 200,
    requestDelay: 800,
    proxyConfiguration: { useApifyProxy: true },
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
const dha   = items.filter(i => i.society === 'DHA');
const bahria = items.filter(i => i.society === 'Bahria Town');
console.log(`DHA plots: ${dha.length} | Bahria Town plots: ${bahria.length}`);
```

#### API Run (cURL)

```bash
curl -X POST "https://api.apify.com/v2/acts/haketa~zameen-scraper/runs?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
        "cities": ["Lahore"],
        "propertyType": "Homes",
        "purpose": "for_rent",
        "maxRecords": 100
      }'
```

#### API Run (Direct URLs)

If you already have specific Zameen search URLs (e.g., a saved filter for "5 Marla houses in DHA Phase 5 Lahore under 2.5 Crore"), pass them via `startUrls` to override the city/type builder:

```json
{
  "startUrls": [
    "https://www.zameen.com/Homes/Lahore-for_sale-1-1.html",
    "https://www.zameen.com/Plots/Bahria_Town_Rawalpindi-26922-1.html"
  ],
  "scrapeDetails": true,
  "maxRecords": 0
}
```

***

### How It Works

The actor uses a **direct HTTP + Cheerio** architecture — no headless browser, no Puppeteer, no Playwright. Zameen's listing pages are server-rendered, so a plain `got-scraping` request returns the full DOM. This keeps runtime fast and memory low while still surviving Zameen's anti-bot stack.

#### Pipeline

| Stage | Detail |
|---|---|
| 1. Build task list | Either expand `cities × propertyType × purpose` into search URLs, or use `startUrls` verbatim |
| 2. Fetch page | `got-scraping` with realistic Chrome 124 headers, optional Apify Residential proxy, 3-retry exponential backoff on 403/429 |
| 3. Try card selectors | `[aria-label="Listing"]`, `[role="article"]`, `li[aria-label]`, `.listing-card`, `article`, `.property-card` (selectors evaluated in order; first one with >2 hits wins) |
| 4. Fallback to property links | If no cards detected, scan for `<a href*="/Property/">` and use their closest list container |
| 5. JSON-LD harvest | Parse every `<script type="application/ld+json">` for `RealEstateListing`, `Apartment`, `SingleFamilyResidence`, `Product` types |
| 6. Field extraction | Title, price text, area text, beds, baths, location, agent, image — per card |
| 7. Currency normalization | `parsePrice()` maps `Crore`, `Lakh`, `PKR`, `Rs.` to a single numeric PKR value |
| 8. Area normalization | `parseArea()` maps Marla, Kanal, Sq. Ft., Sq. Yd. to a single `areaInSqFt` value |
| 9. Society detection | Lowercase title + location + full card text scanned against a 20-entry society dictionary |
| 10. Optional detail page | If `scrapeDetails: true`, visit each `/Property/` URL for full description, agent phone, coordinates, images, features |
| 11. Dedupe + push | `listingId || listingUrl || title` key prevents duplicates across multi-page runs |
| 12. Pagination | Increment `{page}` in URL until a page returns zero listings or `maxPages` reached |

#### Source endpoints

| Path pattern | Example | Purpose |
|---|---|---|
| `/Homes/{City}-{code}-{page}.html` | `/Homes/Lahore-1-1.html` | Houses + flats listing pages |
| `/Homes/{City}-for_sale-{code}-{page}.html` | `/Homes/Karachi-for_sale-2-1.html` | Filtered for-sale homes |
| `/Homes/{City}-for_rent-{code}-{page}.html` | `/Homes/Islamabad-for_rent-3-1.html` | Filtered for-rent homes |
| `/Plots/{City}-{code}-{page}.html` | `/Plots/Islamabad-3-1.html` | Plot listings |
| `/Commercial/{City}-{code}-{page}.html` | `/Commercial/Karachi-2-1.html` | Shops, offices, warehouses |
| `/Property/{slug}-{id}.html` | `/Property/dha_phase_6-...-12345678.html` | Individual listing detail pages |

#### Anti-bot hardening

- **Residential proxies** — enable Apify Residential when scraping >200 pages to avoid 403s
- **Configurable `requestDelay`** — default 800 ms between requests; bump to 1500 ms for very large scrapes
- **Realistic browser headers** — Chrome 124, en-US Accept-Language, full Accept header
- **Exponential backoff** — 3 retries with 3 s, 6 s, 9 s sleeps on 403/429
- **Graceful pagination termination** — actor stops a city when a page returns zero listings, avoiding infinite loops on changed schemas

***

### Input Parameters

```json
{
  "startUrls": [],
  "cities": ["Lahore", "Karachi", "Islamabad"],
  "propertyType": "Homes",
  "purpose": "for_sale",
  "scrapeDetails": false,
  "maxRecords": 500,
  "maxPages": 10,
  "requestDelay": 800,
  "proxyConfiguration": { "useApifyProxy": true }
}
```

#### Parameter reference

| Parameter | Type | Default | Description |
|---|---|---|---|
| `startUrls` | `array<string>` | `[]` | Direct Zameen listing URLs. If set, this overrides `cities` / `propertyType` / `purpose`. Use this when you already have a curated saved search URL. |
| `cities` | `array<string>` | `["Lahore"]` | City names or numeric codes. Built-in: `Lahore` (1), `Karachi` (2), `Islamabad` (3), `Rawalpindi` (4), `Multan` (7), `Faisalabad` (8), `Peshawar` (9), `Gujranwala` (12), `Sialkot` (14), `Hyderabad` (16). Custom names accepted with a default code fallback. |
| `propertyType` | `string` | `Homes` | One of `Homes`, `Plots`, `Commercial`, or `all`. `all` expands into all three. |
| `purpose` | `string` | `all` | `all` returns both transaction types, `for_sale` returns buy-only listings, `for_rent` returns rent-only listings. |
| `scrapeDetails` | `boolean` | `false` | When `true`, visits each individual `/Property/` page for full description, agent phone, coordinates, images, and features. Slower but richer data. |
| `maxRecords` | `integer` | `0` | Hard cap on total dataset items. `0` means unlimited. Set this for cost-controlled runs. |
| `maxPages` | `integer` | `0` | Maximum listing pages per `city × propertyType × purpose` combination. Each page has ~25 listings. `0` means unlimited (until empty page). |
| `requestDelay` | `integer` | `800` | Milliseconds between requests. Range: 200-5000. Increase for very large or proxy-free scrapes. |
| `proxyConfiguration` | `object` | Apify Residential ON | Apify proxy settings. Residential strongly recommended for any run >200 pages — Zameen rate-limits datacenter IPs. |

***

### Output Schema

Every dataset record uses a single flat schema regardless of property type or transaction purpose — your warehouse loader does not need per-type branching.

#### Core fields

| Field | Type | Description |
|---|---|---|
| `listingId` | `string` | Numeric Zameen listing ID extracted from URL (e.g., `12345678`) |
| `title` | `string` | Listing headline as shown on Zameen (e.g., `10 Marla House for Sale in DHA Phase 6`) |
| `purpose` | `string` | `For Sale` or `For Rent` |
| `propertyType` | `string` | `House`, `Flat`, `Upper Portion`, `Lower Portion`, `Plot`, `Farm House`, `Room`, `Penthouse`, `Shop`, `Office`, `Warehouse`, `Building` |
| `price` | `number` | Normalized numeric price in **PKR** (rupees), e.g., `35000000` |
| `priceDisplay` | `string` | Original human-readable price string, e.g., `3.5 Crore PKR` or `45 Lakh PKR` |
| `bedrooms` | `integer` | Number of bedrooms (null for plots / most commercial) |
| `bathrooms` | `integer` | Number of bathrooms (null for plots / most commercial) |
| `area` | `number` | Numeric area value in the original unit |
| `areaUnit` | `string` | Original unit: `Marla`, `Kanal`, `Sq. Ft.`, `Sq. Yd.` |
| `areaInSqFt` | `number` | Area normalized to square feet (1 Marla = 272.25 sq ft, 1 Kanal = 5,445 sq ft, 1 Sq. Yd. = 9 sq ft) |
| `city` | `string` | City name (e.g., `Lahore`, `Karachi`, `Islamabad`) |
| `location` | `string` | Neighborhood / sector / phase (e.g., `DHA Phase 6`, `F-7`, `Clifton Block 2`) |
| `society` | `string` | Detected housing society (e.g., `DHA`, `Bahria Town`, `Capital Smart City`, `Gulberg`, `Model Town`, `Clifton`) |
| `addedDate` | `string` | Listing freshness text as shown (e.g., `2 days ago`, `15 January 2026`) |
| `agentName` | `string` | Listing agent or property dealer name |
| `agencyName` | `string` | Brokerage / agency name (populated when `scrapeDetails: true`) |
| `agentPhone` | `string` | Pakistani mobile (`+92...` or `03...`); only when `scrapeDetails: true` |
| `description` | `string` | Full listing description; only when `scrapeDetails: true` |
| `features` | `array<string>` | Amenity list: parking, lawn, servant quarter, drawing room, etc. (detail mode only) |
| `images` | `array<string>` | One image URL in list mode; full gallery (10-30 URLs) in detail mode |
| `listingUrl` | `string` | Canonical Zameen URL for the listing |
| `scrapedAt` | `string` | ISO-8601 timestamp of extraction |

#### Example: House for sale in DHA Lahore

```json
{
  "listingId": "12345678",
  "title": "10 Marla House for Sale in DHA Phase 6 Block H",
  "purpose": "For Sale",
  "propertyType": "House",
  "price": 35000000,
  "priceDisplay": "3.5 Crore PKR",
  "bedrooms": 4,
  "bathrooms": 4,
  "area": 10,
  "areaUnit": "Marla",
  "areaInSqFt": 2722,
  "city": "Lahore",
  "location": "DHA Phase 6 Block H",
  "society": "DHA",
  "addedDate": "3 days ago",
  "agentName": "Ahmed Properties",
  "agencyName": "Ahmed Properties & Marketing",
  "agentPhone": "+923001234567",
  "description": "Beautiful corner double-unit house in DHA Phase 6 Block H, located on a 50-foot road. Drawing, dining, TV lounge, 4 bedrooms with attached baths, modern kitchen, servant quarter, two-car garage, lawn. Near Lahore Grammar School, Y-Block Commercial.",
  "features": ["Parking", "Lawn", "Servant Quarter", "Drawing Room", "Boundary Wall", "Electricity", "Sui Gas"],
  "images": [
    "https://images.zameen.com/.../listing-1.jpg",
    "https://images.zameen.com/.../listing-2.jpg"
  ],
  "listingUrl": "https://www.zameen.com/Property/dha_defence_dha_phase_6-12345678.html",
  "scrapedAt": "2026-05-16T09:00:00.000Z"
}
```

#### Example: 1 Kanal residential plot in Bahria Town Rawalpindi

```json
{
  "listingId": "98765432",
  "title": "1 Kanal Residential Plot for Sale in Bahria Town Phase 8",
  "purpose": "For Sale",
  "propertyType": "Plot",
  "price": 28000000,
  "priceDisplay": "2.8 Crore PKR",
  "bedrooms": null,
  "bathrooms": null,
  "area": 1,
  "areaUnit": "Kanal",
  "areaInSqFt": 5445,
  "city": "Rawalpindi",
  "location": "Bahria Town Phase 8, Sector F",
  "society": "Bahria Town",
  "addedDate": "1 week ago",
  "agentName": "Capital Estate",
  "agencyName": "Capital Estate & Builders",
  "agentPhone": "+923215554433",
  "description": "Prime 1 Kanal residential plot in Bahria Town Phase 8 Sector F, near Grand Jamia Mosque. Possession plot with all utilities. Suitable for immediate construction.",
  "features": ["Boundary Wall", "Possession", "Corner", "Electricity", "Sui Gas", "Water"],
  "images": ["https://images.zameen.com/.../plot.jpg"],
  "listingUrl": "https://www.zameen.com/Property/bahria_town_rawalpindi_phase_8-98765432.html",
  "scrapedAt": "2026-05-16T09:00:00.000Z"
}
```

***

### Property Type & Purpose Reference

#### Property categories

| Category | Sub-types returned |
|---|---|
| **Homes** | House, Flat / Apartment, Upper Portion, Lower Portion, Farm House, Penthouse, Room |
| **Plots** | Residential Plot, Commercial Plot, Agricultural Land, Industrial Land, Plot File |
| **Commercial** | Shop, Office, Warehouse, Factory, Building, Plaza |

#### Transaction purpose

| Purpose value | Meaning |
|---|---|
| `for_sale` | Properties listed to buy outright |
| `for_rent` | Properties listed to lease monthly |
| `all` | Both — actor expands into two URL series per city/type |

#### Area unit conversions

| Unit | Sq Ft equivalent | Common usage |
|---|---|---|
| 1 Marla | 272.25 sq ft | Standard small-plot/house measure in Punjab |
| 1 Kanal | 5,445 sq ft (≈20 Marla) | Larger plots, farmhouses, big DHA homes |
| 1 Sq. Yd. | 9 sq ft | Karachi / Sindh property measure |
| 1 Sq. Ft. | 1 sq ft | Apartments and commercial |

#### Price conversions

| Display | PKR value | USD ≈ (PKR/USD 280) | AED ≈ (PKR/AED 76) |
|---|---|---|---|
| 1 Lakh | 100,000 | $357 | AED 1,316 |
| 1 Crore | 10,000,000 | $35,714 | AED 131,578 |
| 3.5 Crore | 35,000,000 | $125,000 | AED 460,526 |
| 25 Crore | 250,000,000 | $892,857 | AED 3,289,473 |

> FX rates are illustrative — your downstream pipeline should call a live FX API (e.g., openexchangerates.org) for current PKR/USD/AED/GBP/SAR/EUR rates.

***

### Use Cases

#### Overseas Pakistani (OP) Investor Research

Pakistani diaspora in the UK, US, UAE, KSA, and Canada are some of the largest property buyers in Lahore, Islamabad and Karachi:

- **Track DHA and Bahria Town pricing** across phases and blocks for remote investment decisions
- **Convert prices to GBP, USD, AED, SAR, CAD** for like-for-like comparison with home-market real estate
- **Build dashboards for family in-country** showing newly listed plots near a specific society or sector
- **Monitor plot file vs developed plot pricing** — overseas buyers are heavy plot-file purchasers
- **Detect price-drop alerts** by diffing daily runs against a baseline, then notifying via WhatsApp / email
- **Filter agents by responsiveness** — combine `agentPhone` capture with downstream call tracking

#### Prop-tech & Automated Valuation Models (AVM)

Pakistani prop-tech startups (Graana, EasyProperty, AlphaProp, JagahOnline, etc.) and AVM builders use this dataset to:

- **Train per-Marla price models** by city × society × phase × block
- **Benchmark rental yields** (annual rent / sale price) per society
- **Detect over/under-priced listings** automatically using society-level medians
- **Power instant-offer flows** by enriching incoming seller leads with comparable listings
- **Build a national property index** updated weekly with millions of normalized data points

#### Real Estate Brokerage Lead Generation

Agencies and individual realtors use the data to:

- **Identify private (non-agency) listings** to call and convert into exclusive mandates
- **Build farming lists** of every listing in DHA Phase 6 / Bahria Town Sector E posted in the last 30 days
- **Auto-import inventory** from competing agencies into their own CRM / WhatsApp catalog
- **Monitor commercial listings** in Gulberg, Blue Area, MM Alam Road, and Clifton for relocation clients
- **Track agency market share** by counting listings per `agencyName` over time

#### Market Research & Real Estate Journalism

Consulting firms, banks (HBL, UBL, Meezan), and outlets like Dawn, Business Recorder, and Profit by Pakistan Today use the data to:

- **Quantify the "DHA premium"** — average PKR/sq ft for DHA listings vs surrounding areas
- **Track Islamabad sectoral pricing** (F-6, F-7, F-8, F-10, F-11, E-11, G-13, I-8) over time
- **Map commercial vs residential plot inventory** by city
- **Document the cost of housing** for Pakistani middle-class families in real terms
- **Investigate housing scheme launches** — Capital Smart City, Top City, Park View City inventory growth

#### Bank Mortgage & Valuation Comps

State Bank of Pakistan licensed valuers and bank mortgage departments (HBL, Faysal, Bank Alfalah, Meezan) use the data to:

- **Pull comparable sales** for residential mortgage valuation reports
- **Validate borrower-claimed property value** against current Zameen listings
- **Build internal valuation reference tables** by society × Marla × bedroom count
- **Cross-check declared rental income** against current Zameen for-rent inventory in the same area
- **Document valuation methodology** with cited comp URLs for audit compliance

#### Currency-Conversion Investment Comparisons

Wealth managers and family offices serving high-net-worth Pakistani clients use the data to:

- **Compare Lahore DHA prices** in PKR/USD/AED/GBP against London zone 2, Dubai Marina, Toronto condos
- **Compute rental yields net of withholding tax** on Pakistani vs overseas rentals
- **Hedge currency exposure** by tracking PKR-denominated real estate appreciation against PKR/USD moves
- **Build investor decks** with live market data instead of stale broker presentations
- **Surface arbitrage opportunities** between Karachi DHA City and Dubai International City off-plan inventory

#### Government, Planning & Policy Research

CDA, RDA, LDA, KDA planning departments, World Bank Pakistan urban units, and academic researchers use the data to:

- **Map informal vs planned housing pricing differentials**
- **Quantify housing affordability** vs SBP-published median household income
- **Track post-flood reconstruction pricing** in affected districts
- **Support Naya Pakistan Housing Programme planning** with private-market reference pricing
- **Document urban sprawl** by tracking plot-listing geographic spread per city per year

#### Insurance Underwriting

Pakistani non-life insurers (Adamjee, EFU, Jubilee) writing fire / home / contents policies use the data to:

- **Confirm declared property value** matches current market value at policy bind
- **Stratify risk by society** — DHA / Bahria vs older inner-city neighborhoods
- **Validate replacement cost** for total-loss settlements
- **Price condo / apartment master policies** based on local rental yield data

***

### Sample Queries & Recipes

#### Recipe 1: Every 10-Marla house listed for sale in DHA Lahore

```json
{
  "cities": ["Lahore"],
  "propertyType": "Homes",
  "purpose": "for_sale",
  "scrapeDetails": true,
  "maxRecords": 500
}
```

Then downstream:

```python
dha10 = [r for r in records
         if r["society"] == "DHA"
         and r["area"] == 10
         and r["areaUnit"] == "Marla"]
```

#### Recipe 2: All 1-Kanal plots in Bahria Town Rawalpindi

```json
{
  "startUrls": ["https://www.zameen.com/Plots/Bahria_Town_Rawalpindi-26922-1.html"],
  "scrapeDetails": false,
  "maxRecords": 0
}
```

#### Recipe 3: Karachi Clifton & DHA apartment-rental market sweep

```json
{
  "cities": ["Karachi"],
  "propertyType": "Homes",
  "purpose": "for_rent",
  "maxRecords": 1000,
  "scrapeDetails": true
}
```

Then filter for `propertyType == "Flat"` and `society in ("Clifton", "DHA")`.

#### Recipe 4: Islamabad sector-by-sector pricing snapshot

```json
{
  "cities": ["Islamabad"],
  "propertyType": "Homes",
  "purpose": "for_sale",
  "maxRecords": 2000,
  "scrapeDetails": false
}
```

Group results by the leading sector token (`F-6`, `F-7`, `F-8`, `F-10`, `F-11`, `E-11`, `G-13`, `I-8`) extracted from `location`.

#### Recipe 5: Commercial inventory in MM Alam, Blue Area, II Chundrigar

```json
{
  "cities": ["Lahore", "Islamabad", "Karachi"],
  "propertyType": "Commercial",
  "purpose": "all",
  "maxRecords": 0,
  "scrapeDetails": true
}
```

#### Recipe 6: Multi-city for-sale national pull (with test sampling)

```json
{
  "cities": ["Karachi", "Lahore", "Islamabad", "Rawalpindi"],
  "propertyType": "all",
  "purpose": "for_sale",
  "maxPages": 20,
  "requestDelay": 1000,
  "proxyConfiguration": { "useApifyProxy": true }
}
```

Set `maxRecords: 25` first for a sandbox run before committing budget to the full pull.

***

### Integration Examples

#### Google Sheets

Schedule the actor daily on Apify, then attach the built-in **Google Sheets** integration to dump the latest DHA / Bahria run into a shared workbook your team and family already use.

#### Make.com / Zapier / n8n

Use the **Apify** connector to:

- Trigger a fresh Zameen run when a row is added to a "Properties I'm watching" sheet
- POST every new listing under PKR 1 Crore in F-8 Islamabad to a Telegram or WhatsApp group via Webhook
- Auto-create a HubSpot deal when a `For Sale` listing in DHA Phase 6 drops in price by >10% vs the prior run

#### Power BI / Tableau / Looker / Metabase

Connect the Apify dataset URL as a JSON source. Build dashboards covering:

- Median PKR/sq ft per society × phase × block
- For-sale vs for-rent inventory mix per city
- Days-on-market estimated from `addedDate`
- Agent / agency league tables by listing volume
- Heat maps of new construction (proxied by listing counts)

#### Postgres / Snowflake / BigQuery / ClickHouse

Use the Apify **dataset webhook** to push every completed run as JSON Lines into your warehouse ingestion endpoint. Suggested table:

```sql
CREATE TABLE zameen_listings (
  listing_id      TEXT PRIMARY KEY,
  scraped_at      TIMESTAMPTZ,
  purpose         TEXT,
  property_type   TEXT,
  city            TEXT,
  society         TEXT,
  location        TEXT,
  price_pkr       BIGINT,
  area_sq_ft      NUMERIC,
  bedrooms        INT,
  bathrooms       INT,
  agent_name      TEXT,
  agency_name     TEXT,
  listing_url     TEXT,
  raw             JSONB
);
```

#### CRM enrichment, WhatsApp/Telegram alerts, AVM endpoints

Trigger a nightly run with `purpose: "for_sale"` and `scrapeDetails: true`, then upsert against your Salesforce / HubSpot / Zoho / Bitrix24 Account or Property objects keyed on `listingId`. Status flips (`For Sale` → disappears = likely sold) auto-close opportunities. Pipe filtered output (`price <= 25000000 AND society = "DHA"`) into a WhatsApp Business or Telegram bot for instant deal alerts to overseas Pakistani clients, or POST every fresh record to your in-house AVM endpoint to refresh per-society price curves throughout the day.

***

### Major Pakistani Markets & Society Coverage

| City | Population | Major Societies / Sectors |
|---|---|---|
| **Karachi** | 17M+ | DHA (Defence) Phase 1-8, Clifton Blocks 1-9, Gulshan-e-Iqbal, Gulistan-e-Jauhar, PECHS, North Nazimabad, Nazimabad, Bahria Town Karachi, Federal B Area, Malir Cantt |
| **Lahore** | 13M+ | DHA Phases 1-9 + EME, Bahria Town Lahore Sectors A-G, Bahria Orchard, Gulberg I-IV, Model Town, Johar Town, Wapda Town, Garden Town, Cantt, Askari, Valencia, Eden, Paragon City, Lake City, Citi Housing |
| **Islamabad** | 1.1M+ | F-6, F-7, F-8, F-10, F-11, E-11, G-13, G-14, G-15, I-8, I-10, B-17, DHA Islamabad, Bahria Town Phases 1-8, Capital Smart City, Park View City, Top City |
| **Rawalpindi** | 2.3M+ | Bahria Town Phases 1-8, DHA Phase 1-4, Adyala Road, Bahria Garden City, Saddar, Westridge, Chaklala Scheme |
| **Faisalabad** | 3.5M+ | Wapda City, Eden Valley, Citi Housing, Madina Town, Susan Road, Saeed Colony, D-Ground |
| **Multan** | 2.0M+ | DHA Multan, Wapda Town, Model Town, Buch Villas, Royal Orchard |
| **Peshawar** | 2.0M+ | DHA Peshawar, Hayatabad, University Town, Cantt, Regi Model Town |
| **Gujranwala** | 2.0M+ | Citi Housing, DC Colony, Satellite Town, Wapda Town |
| **Sialkot** | 0.8M+ | Cantt, Defence Road, Bismillah Housing |
| **Hyderabad** | 1.7M+ | Latifabad, Qasimabad, Auto Bhan Road |
| **Quetta** | 1.1M+ | Satellite Town, Jinnah Town, Brewery Road |
| **Abbottabad** | 0.4M+ | Mansehra Road, Karakoram Highway corridor |

> Society detection is built-in for the major schemes (DHA, Bahria Town, Capital Smart City, Gulberg, Model Town, Johar Town, Askari, Cantt, Clifton, PECHS, Nazimabad, North Nazimabad, Wapda Town, Eden, Valencia, Paragon City, Lake City, Citi Housing, Park View, Al Kabir). Other societies are returned in the raw `location` and `title` fields for downstream parsing.

***

### Cost & Performance

| Metric | Value |
|---|---|
| Engine | HTTP + Cheerio (no headless browser) |
| Runtime (1 city, 1 page, list mode) | 5-15 seconds |
| Runtime (3 cities, ~500 records, list mode) | 3-7 minutes |
| Runtime (1 city, ~500 records, `scrapeDetails: true`) | 10-25 minutes |
| Cost per typical 500-record run | small fraction of $1 (pay-per-event) |
| Pricing model | Pay-per-event — actor start + per dataset item |
| Data freshness | Live at run time — Zameen listings update minute-by-minute |
| Auth required | None |
| Proxy required | Apify Residential recommended for >200 pages |
| Concurrency | Safe to run multiple city configurations in parallel |
| Memory footprint | 256 MB sufficient (max 1024 MB allocated) |
| Output formats | JSON, JSONL, CSV, Excel (XLSX), HTML, XML, RSS |

***

### Compliance, Privacy & Legal Notes

- **Public data only** — every field is publicly visible on [zameen.com](https://www.zameen.com/) without login
- **No PII beyond listing-side agent contact** — agent name and phone are intentionally published by the agent for lead capture
- **No buyer-side PII** — no prospective buyer searches, saved listings, or messaging history is scraped
- **No financial / banking data** — only listing-side asking prices
- **Respect Zameen ToS** — keep request delays at >=500 ms, use Apify Residential proxies for large runs, and avoid hammering the same URL
- **Pakistan PECA 2016 & PDPA-style guidance** — consumers should not use agent contact data for unsolicited bulk WhatsApp / SMS / robo-calls
- **GDPR / UK GDPR / CCPA** — if you're processing data on behalf of EU/UK/California residents (e.g., overseas Pakistani investors), apply your normal lawful-basis assessment; agent contact info that the agent voluntarily published on a public portal generally qualifies as "manifestly made public"
- **No copyrighted scraping** — listing photos remain copyright of the original lister; the actor returns URLs only, not re-hosted bytes
- **Robots / fair use** — Zameen does not block crawling of public listing pages in its robots.txt as of the actor's release; behavior should be re-checked periodically

> **Important:** Use the data responsibly. Do not impersonate listings, generate fake comparables, or use scraped phone numbers for SMS spam — these are illegal under Pakistan's PECA Act, UAE/KSA telecoms regulations, and most Western jurisdictions.

***

### Frequently Asked Questions

#### How fresh is the data?

Live at run time. Zameen listings update minute-by-minute as agents post, edit, and remove inventory. Each actor run re-fetches every requested URL — there is no internal cache.

#### How many listings will I get per run?

Depends on filters. A single city / single propertyType / single purpose Zameen search typically exposes a few thousand pages × ~25 listings each, capped by Zameen's pagination ceiling. Use `maxRecords` and `maxPages` to control cost.

#### Do I need to log in to Zameen?

No. The actor scrapes only public listing pages — no Zameen account, no API key, no authentication needed. You only need an Apify account.

#### Does Zameen rate-limit?

Yes. Datacenter IPs get 403/429 quickly on large scrapes. Enable Apify Residential proxies (default ON) and use `requestDelay: 1000`+ for runs over a few hundred pages.

#### Can I get the agent's phone number?

Yes — set `scrapeDetails: true`. The actor opens each individual `/Property/` page and extracts the `+92...` or `03...` mobile from the tel: link and inline HTML. List mode (without `scrapeDetails`) does NOT include phone numbers.

#### What's the difference between Marla and Kanal?

In Punjab and AJK, 1 Marla = ~272.25 sq ft and 1 Kanal = 20 Marla = ~5,445 sq ft. The actor returns the original number + unit AND a normalized `areaInSqFt` so you can compare any two listings on a single axis.

#### Are prices in PKR or some other currency?

The numeric `price` field is always **Pakistani Rupees (PKR)**. The string `priceDisplay` preserves the original `Crore` / `Lakh` formatting for human-readable dashboards. Convert PKR to USD / AED / GBP downstream using your preferred FX feed.

#### Does this work for plots and commercial, not just houses?

Yes — set `propertyType: "Plots"`, `"Commercial"`, or `"all"`. Plot listings have null `bedrooms` / `bathrooms`. Set `purpose: "for_rent"` for rent-only, `"for_sale"` for buy-only, or `"all"` for both.

#### Does it cover Quetta, Peshawar, Faisalabad, Gujranwala, Hyderabad?

Yes for Faisalabad (code 8), Peshawar (9), Gujranwala (12), Sialkot (14), Hyderabad (16). For cities without a built-in code (Quetta, Abbottabad, etc.), pass the city name and use `startUrls` with a Zameen-search URL you've copied from the site.

#### Can I filter by price range?

The actor doesn't apply price filters at the source (Zameen's URL scheme doesn't expose stable price-range parameters across all property types). Instead, scrape the relevant city/type, then filter on the numeric `price` field in your warehouse / Sheets / Python.

#### How do I get listings from a specific society like Bahria Town Karachi or DHA Phase 6?

Two options. **(a)** Run a city-wide scrape and filter on `society` and `location` downstream. **(b)** Open the Zameen society/sector page in your browser, copy its URL, and pass it via `startUrls`.

#### What if Zameen changes its HTML structure?

The actor uses **multiple fallback selectors** plus a **JSON-LD parser** plus a **`/Property/` href fallback** — if Zameen changes one card class, the others typically still match. Open an Issue on the Apify Store page if a redesign breaks parsing and the maintainer ships a fix.

#### Does the actor deduplicate and follow detail pages by default?

Dedupe yes — key is `listingId || listingUrl || title`, so overlapping start URLs or pagination overlap are dropped. Detail pages no — set `scrapeDetails: true` to fetch full description, phone, coordinates, and full image galleries per listing.

#### Can I run this on the Apify Free Plan and schedule it?

Yes to both — small runs fit comfortably on the free tier, and Apify's built-in Scheduler triggers the actor on any cron expression. Combine with Google Sheets / webhook / dataset integrations for fully automated daily inventory pulls. Export formats: JSON, JSON Lines, CSV, Excel (XLSX), HTML, XML, and RSS.

#### Is there a Zameen API alternative?

Not officially — Zameen does not publish a public REST or GraphQL listings API to third-party developers. This actor is the practical equivalent: a maintained, schema-stable, normalized JSON feed of Zameen.com inventory.

#### Can I use this data commercially?

Yes — the data itself is publicly listed. Respect Zameen's ToS, agents' phone-number consent intent (don't use them for SMS / WhatsApp spam), and any local data-protection law that applies to your downstream use.

#### Does this work for other portals (Graana, OLX Pakistan, JagahOnline)?

No — this actor is Zameen-only. For other Asian, Latin American, European, and North American real estate portals, see the **Related Actors** section below.

***

### Related Apify Actors by Haketa

If you need real estate inventory from other countries, or marketplace classifieds adjacent to property, these complementary actors are maintained by the same developer:

- [Lamudi Philippines Real Estate Scraper](https://apify.com/haketa/lamudi-scraper) — Philippines property listings (Manila, Cebu, Davao)
- [Realestate.com.kh Cambodia Scraper](https://apify.com/haketa/realestate-com-kh-scraper) — Phnom Penh and Siem Reap property inventory
- [VivaReal Brazil Real Estate Scraper](https://apify.com/haketa/vivareal-scraper) — Brazil-wide property listings
- [ZAP Imóveis Brazil Scraper](https://apify.com/haketa/zapimoveis-scraper) — Brazilian apartments and houses
- [Realtor.ca Scraper (Canada)](https://apify.com/haketa/realtor-ca-scraper) — Canadian MLS listings
- [Immoweb.be Belgium Property Scraper](https://apify.com/haketa/immoweb-scraper) — Belgian for-sale and for-rent
- [Domain.com.au Property Scraper (Australia)](https://apify.com/haketa/domain-com-au-scraper) — Australia residential portal
- [Apartments.com Scraper (US)](https://apify.com/haketa/apartments-com-scraper) — US rental marketplace
- [Rent.com Scraper (US)](https://apify.com/haketa/rent-com-scraper) — US rental listings
- [Mourjan Scraper (MENA)](https://apify.com/haketa/mourjan-scraper) — Middle East classifieds incl. property
- [Lelong.my Scraper (Malaysia)](https://apify.com/haketa/lelong-my-scraper) — Malaysia's veteran online marketplace (electronics, fashion, auto parts)
- [Chotot.com Scraper (Vietnam)](https://apify.com/haketa/chotot-scraper) — Vietnam classifieds incl. property

***

### Comparison vs. Alternatives

| Approach | Setup time | Data freshness | Per-1K records cost | PKR + Marla normalization | Maintenance |
|---|---|---|---|---|---|
| **This actor** | < 2 minutes | Live at run | small fraction of $1 | Built-in | Maintained |
| Manual Zameen browsing | Hours | Live | Free + your time | None | None |
| DIY Python + BeautifulSoup | 1-3 weeks dev | Live | Free + infra | DIY | DIY, breaks on UI updates |
| Hire a freelance scraper | $200-1000+ | Variable | Variable | Variable | None after delivery |
| Paid Pakistan real estate API | Hours setup | Real-time | $100s-1000s/month | Varies | Vendor |
| Zameen's own export | Not available | N/A | N/A | N/A | N/A |

***

### Why Pay-Per-Event Pricing?

This actor uses **pay-per-event** pricing instead of a flat monthly fee:

- Only pay when the actor runs — no idle subscription burn
- Costs scale linearly with how many listings you actually collect
- Transparent line-item billing inside the Apify console
- No monthly minimums or annual commitments
- Trivially cheap to sandbox: `maxRecords: 25` runs cost pennies
- Predictable cost-per-record makes ROI math obvious for prop-tech and AVM teams

***

### Changelog

| Version | Date | Notes |
|---|---|---|
| 1.0.0 | 2026-05 | Initial public release — Cheerio + got-scraping, Crore/Lakh and Marla/Kanal normalization, society detection, JSON-LD fallback, optional detail-page mode, residential-proxy support |

***

### Keywords

Zameen scraper · Zameen.com data · Zameen API alternative · Pakistan real estate data · Pakistan property scraper · Karachi property scraper · Lahore property scraper · Islamabad property scraper · Rawalpindi property data · DHA property listings scraper · Bahria Town property scraper · Capital Smart City listings · Gulberg property data · Model Town Lahore property · Clifton Karachi apartments · PECHS Nazimabad listings · F-6 F-7 F-8 F-10 Islamabad sector data · Pakistan plot file data · Marla Kanal property scraper · PKR Crore Lakh price normalization · Pakistan real estate API · Pakistan property listings JSON · for sale Pakistan property data · for rent Pakistan property data · Pakistan agent dealer contact data · DHA Bahria Town comparable sales · overseas Pakistani property investor data · Pakistan AVM data feed · prop-tech Pakistan dataset · Pakistan house price scraper · Pakistan commercial property data · Pakistan plot file scraper · Faisalabad Multan Peshawar property data · Lahore Islamabad Karachi property feed · Apify Pakistan real estate actor · Zameen.com listings extractor · Zameen.com pagination scraper · Pakistan real estate lead generation

***

### Support

- **Bug reports:** Use the **Issues** tab on the [Apify Store actor page](https://apify.com/haketa/zameen-scraper)
- **Feature requests:** Same place — please include a sample Zameen URL and the field/behavior you'd like added
- **Direct contact:** Through the Apify developer profile

If this actor saves you time, a **5-star rating** on the Apify Store helps overseas Pakistani investors, prop-tech teams, valuers, and realtors discover it. Shukriya!

# Actor input Schema

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

Direct Zameen.com listing URLs. Overrides city/propertyType if provided. Example: 'https://www.zameen.com/Homes/Lahore-1-1.html'

## `cities` (type: `array`):

City codes to scrape. Lahore=1, Karachi=2, Islamabad=3, Rawalpindi=4, Multan=7, Faisalabad=8, Peshawar=9. Use city name or code.

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

Type of property to scrape.

## `purpose` (type: `string`):

'all' = both, 'for\_sale' = buy only, 'for\_rent' = rent only.

## `scrapeDetails` (type: `boolean`):

Visit each listing page for full description, agent phone, coordinates, all images and features. Slower but richer data.

## `maxRecords` (type: `integer`):

Maximum total listings to output. Set 0 for unlimited.

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

Maximum listing pages per city/type combination. Each page has ~25 listings. Set 0 for unlimited.

## `requestDelay` (type: `integer`):

Delay between requests. 500-1500ms recommended.

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

Rotating proxy recommended for large scrapes.

## Actor input object example

```json
{
  "startUrls": [],
  "cities": [
    "Lahore"
  ],
  "propertyType": "Homes",
  "purpose": "all",
  "scrapeDetails": false,
  "maxRecords": 100,
  "maxPages": 0,
  "requestDelay": 800,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `listingId` (type: `string`):

No description

## `title` (type: `string`):

No description

## `purpose` (type: `string`):

No description

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

No description

## `priceDisplay` (type: `string`):

No description

## `price` (type: `string`):

No description

## `bedrooms` (type: `string`):

No description

## `bathrooms` (type: `string`):

No description

## `area` (type: `string`):

No description

## `areaUnit` (type: `string`):

No description

## `areaInSqFt` (type: `string`):

No description

## `city` (type: `string`):

No description

## `location` (type: `string`):

No description

## `society` (type: `string`):

No description

## `agentName` (type: `string`):

No description

## `agencyName` (type: `string`):

No description

## `listingUrl` (type: `string`):

No description

## `scrapedAt` (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 = {
    "startUrls": [],
    "cities": [
        "Lahore"
    ],
    "propertyType": "Homes",
    "scrapeDetails": false,
    "maxRecords": 100,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("haketa/zameen-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 = {
    "startUrls": [],
    "cities": ["Lahore"],
    "propertyType": "Homes",
    "scrapeDetails": False,
    "maxRecords": 100,
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("haketa/zameen-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "startUrls": [],
  "cities": [
    "Lahore"
  ],
  "propertyType": "Homes",
  "scrapeDetails": false,
  "maxRecords": 100,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call haketa/zameen-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=haketa/zameen-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Zameen.com Scraper | Pakistan Real Estate & Property Data",
        "description": "Zameen scraper & API for Pakistan real estate: search property for sale and rent and export address, price, beds, baths, area, type, agent, photos and coordinates. Pakistan property market data and real-estate lead generation — fast, no login.",
        "version": "0.0",
        "x-build-id": "7Wz7lgP72Wbs9hCUm"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/haketa~zameen-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-haketa-zameen-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/haketa~zameen-scraper/runs": {
            "post": {
                "operationId": "runs-sync-haketa-zameen-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/haketa~zameen-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-haketa-zameen-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "startUrls": {
                        "title": "Start URLs (optional)",
                        "type": "array",
                        "description": "Direct Zameen.com listing URLs. Overrides city/propertyType if provided. Example: 'https://www.zameen.com/Homes/Lahore-1-1.html'",
                        "items": {
                            "type": "object",
                            "required": [
                                "url"
                            ],
                            "properties": {
                                "url": {
                                    "type": "string",
                                    "title": "URL of a web page",
                                    "format": "uri"
                                }
                            }
                        }
                    },
                    "cities": {
                        "title": "Cities",
                        "type": "array",
                        "description": "City codes to scrape. Lahore=1, Karachi=2, Islamabad=3, Rawalpindi=4, Multan=7, Faisalabad=8, Peshawar=9. Use city name or code.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "propertyType": {
                        "title": "Property Type",
                        "enum": [
                            "Homes",
                            "Plots",
                            "Commercial",
                            "all"
                        ],
                        "type": "string",
                        "description": "Type of property to scrape.",
                        "default": "Homes"
                    },
                    "purpose": {
                        "title": "Transaction Type",
                        "enum": [
                            "all",
                            "for_sale",
                            "for_rent"
                        ],
                        "type": "string",
                        "description": "'all' = both, 'for_sale' = buy only, 'for_rent' = rent only.",
                        "default": "all"
                    },
                    "scrapeDetails": {
                        "title": "Scrape Detail Pages",
                        "type": "boolean",
                        "description": "Visit each listing page for full description, agent phone, coordinates, all images and features. Slower but richer data.",
                        "default": false
                    },
                    "maxRecords": {
                        "title": "Max Records",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Maximum total listings to output. Set 0 for unlimited.",
                        "default": 100
                    },
                    "maxPages": {
                        "title": "Max Pages per City",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Maximum listing pages per city/type combination. Each page has ~25 listings. Set 0 for unlimited.",
                        "default": 0
                    },
                    "requestDelay": {
                        "title": "Request Delay (ms)",
                        "minimum": 200,
                        "maximum": 5000,
                        "type": "integer",
                        "description": "Delay between requests. 500-1500ms recommended.",
                        "default": 800
                    },
                    "proxyConfiguration": {
                        "title": "Proxy Configuration",
                        "type": "object",
                        "description": "Rotating proxy recommended for large scrapes."
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
