# Haraj Classifieds Scraper (`scrapyx/haraj-classifieds-scraper`) Actor

Saudi classifieds from Haraj: cars, real estate, jobs and general goods by category tag, city or seller. Every row is fully detailed — description, all images, precise location, and category-specific fields (price, car/property/job info).

- **URL**: https://apify.com/scrapyx/haraj-classifieds-scraper.md
- **Developed by:** [Ibnu Adzim](https://apify.com/scrapyx) (community)
- **Categories:** E-commerce, Lead generation, Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.56 / 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/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Haraj Classifieds Scraper

Scrapes classified ads from [Haraj](https://haraj.com.sa), Saudi Arabia's
largest general classifieds marketplace: cars, real estate, jobs and
general goods. Search by category tag, region or seller — or fetch
specific ads directly by id.

***

### What you get

One `POST` row per ad, plus a `SEARCH_SUMMARY` row per query.

**Every row is already complete** — unlike almost every other actor in
this portfolio, there is no separate "detail pass": the same fields
(full description, every image, exact location, category-specific data)
come back whether the ad was found via a tag/city search or fetched
directly by id.

`id` · `title` · `bodyTEXT` (full ad text) · `imagesList` (every photo,
full-resolution CDN URLs) · `city` / `geoCity` / `geoNeighborhood` ·
`tags` (the ad's full category/brand/model breadcrumb) · `authorUsername`
· `postDateISO` / `updateDateISO` · `URL` · `carInfo` (model year,
mileage, fuel, gear, condition — for vehicle ads) · `realEstateInfo` ·
`jobsInfo` · `price` (often null — see below) · `commentCount` ·
`isPromoted` · and more, passed through verbatim from the site's own API.

***

### Input

```jsonc
{
  "queries": [
    { "tag": "تويوتا", "city": "الرياض" }
  ],
  "postIds": [186515219],
  "maxItemsPerQuery": 40
}
```

Each `queries` entry needs at least one of `tag`, `city`, `cities`, or
`authorUsername`. `postIds` fetches specific ads directly, no search
needed.

#### `tag` is Haraj's own taxonomy, free text, no enum

Examples: `حراج السيارات` (cars), `تويوتا` (Toyota), `كامري` (Camry),
`شقق للايجار` (apartments for rent). There are many thousands of tags
(every brand/model/year combination, every product category) and no
lookup endpoint to enumerate them from — but an unrecognised tag is
**honest**: it returns a genuinely empty result, never a silent fallback
to the whole site.

#### `city` filters by REGION, not the city you'd expect — read this first

This is the one thing on this target that will surprise you. Despite the
name, `city`/`cities` filter by Saudi Arabia's **13 administrative
regions**, not individual municipalities:

```
city: "جدة"          (Jeddah, a city)   -> 0 results
city: "مكة المكرمة"   (Makkah, the region Jeddah belongs to) -> real results
```

All 13 verified working region names: `الرياض` (Riyadh), `مكة المكرمة`
(Makkah), `المدينة المنورة` (Madinah), `الشرقية` (Eastern Province),
`القصيم` (Qassim), `عسير` (Asir), `تبوك` (Tabuk), `حائل` (Hail), `جازان`
(Jazan), `نجران` (Najran), `الباحة` (Al-Bahah), `الجوف` (Al-Jouf),
`الحدود الشمالية` (Northern Borders). The output row's own `city` field
carries the same region-level granularity; `geoCity` and
`geoNeighborhood` on each row are the actual municipality/district — real
per-ad location detail, just not something you can filter a query by.

***

### Known limits

**1. `price` is often null even on formally-licensed listings.** One
REGA-registered real-estate agency's listing had `price: null` and
`realEstateInfo: null` while spelling out the exact rent price and every
property attribute as plain text inside `bodyTEXT` (a standard Saudi
real-estate disclosure block). Normal seller behaviour on this
marketplace, not missing data — the actual figures are usually in
`bodyTEXT` when the structured fields are empty.

**2. No total-count field exists anywhere in this API.** `SEARCH_SUMMARY`
reports `postsReturned` and `hasMoreAvailable` (a genuine boolean the API
provides), never a `totalMatches` — there is nothing upstream to report
one from.

**3. `limit` silently clamps above 60.** Values 1-60 behave linearly;
61 and above drop to a fixed ~20 items with no error. This actor never
sends more than 60, so it isn't something you'll hit through normal use.

***

### Anti-bot posture

**None observed.** 8/8 TLS profiles clean on the GraphQL endpoint; ten
rapid sequential requests all answered 200 with no rate-limit response.
The actor still ships a rotating profile pool, a retry ladder and
challenge-marker detection, and paces requests by default.

### Policy

`haraj.com.sa/robots.txt` (`User-agent: *`) names no
`ClaudeBot`/`anthropic-ai`/`GPTBot` group and does not disallow anything
this actor touches. `graphql.haraj.com.sa` (the API host) serves no
`robots.txt` at all.

# Actor input Schema

## `queries` (type: `array`):

One crawl per entry, each with its own SEARCH\_SUMMARY row. Each item: {"tag": "تويوتا", "city": "الرياض", "notTag": "كامري", "authorUsername": null, "onlyWithImage": true, "onlyWithVideo": false} -- at least one of 'tag', 'city', 'cities', or 'authorUsername' is required. 'tag' is Haraj's own category/brand/model taxonomy (e.g. 'حراج السيارات' for cars, 'تويوتا' for Toyota, 'شقق للايجار' for apartments for rent) -- there are many thousands of tags and no lookup endpoint to enumerate them from, but an unrecognised value is honest (an empty result), never a silent fallback to the whole site. IMPORTANT: despite the name, 'city'/'cities' filter by Saudi Arabia's 13 ADMINISTRATIVE REGIONS, not individual municipalities — 'جدة' (Jeddah, a city) returns nothing, 'مكة المكرمة' (Makkah, the region Jeddah belongs to) does. All 13 region names verified working: الرياض (Riyadh), مكة المكرمة (Makkah), المدينة المنورة (Madinah), الشرقية (Eastern Province), القصيم (Qassim), عسير (Asir), تبوك (Tabuk), حائل (Hail), جازان (Jazan), نجران (Najran), الباحة (Al-Bahah), الجوف (Al-Jouf), الحدود الشمالية (Northern Borders).

## `postIds` (type: `array`):

Fetch specific classified ads directly by their numeric post id (found in a post's URL, e.g. the '186515219' in '/11186515219/...'). Each one becomes its own row -- exactly as complete as a row found via 'queries', since this site's API answers both the same way.

## `maxItemsPerQuery` (type: `integer`):

Stop each query after this many posts. Set to 0 for unlimited -- pagination on this target is genuinely honest, with an explicit 'hasMoreAvailable' signal upstream provides directly rather than this actor having to infer it.

## `maxConcurrency` (type: `integer`):

How many requests may be in flight at once. This absorbs latency variance; it is NOT the throttle -- the crawl rate is set by 'Minimum interval between requests' below.

## `minRequestInterval` (type: `number`):

The actual speed control: the shortest gap between two requests, across all workers. No bot mitigation was observed during recon (8/8 TLS profiles clean, ten rapid sequential requests all succeeded with no rate-limit response).

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

Residential with no country pin is the cloud default. No WAF was observed anywhere during recon, so there's no known reason to narrow the exit-IP pool.

## Actor input object example

```json
{
  "queries": [
    {
      "tag": "تويوتا",
      "city": "الرياض"
    }
  ],
  "postIds": [],
  "maxItemsPerQuery": 40,
  "maxConcurrency": 5,
  "minRequestInterval": 0.4,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `items` (type: `string`):

One row per scraped record. See the dataset's default view for field definitions.

# 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 = {
    "queries": [
        {
            "tag": "تويوتا",
            "city": "الرياض"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapyx/haraj-classifieds-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 = { "queries": [{
            "tag": "تويوتا",
            "city": "الرياض",
        }] }

# Run the Actor and wait for it to finish
run = client.actor("scrapyx/haraj-classifieds-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 '{
  "queries": [
    {
      "tag": "تويوتا",
      "city": "الرياض"
    }
  ]
}' |
apify call scrapyx/haraj-classifieds-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,scrapyx/haraj-classifieds-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/Qr7nz9IDT6L5bAm8d/builds/uvfY0ilWTd4cBnMs6/openapi.json
