{
  "openapi": "3.0.1",
  "info": {
    "title": "Haraj Scraper",
    "description": "Scrape Haraj (haraj.com.sa) - Saudi Arabia's largest classifieds marketplace. Search by keyword, browse by category/city, look up listings by ID, pull a seller's listings, or fetch trending keywords. Get price (SAR), city, description, images, posted date.",
    "version": "1.0",
    "x-build-id": "sH5nOxOYkRE34ODfS"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/crawlerbros~haraj-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-crawlerbros-haraj-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/crawlerbros~haraj-scraper/runs": {
      "post": {
        "operationId": "runs-sync-crawlerbros-haraj-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/crawlerbros~haraj-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-crawlerbros-haraj-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",
        "required": [
          "mode"
        ],
        "properties": {
          "mode": {
            "title": "Mode",
            "enum": [
              "search",
              "browse",
              "byId",
              "byAuthor",
              "trending"
            ],
            "type": "string",
            "description": "What to fetch.",
            "default": "search"
          },
          "searchQuery": {
            "title": "Search query",
            "type": "string",
            "description": "Free-text keyword search, in Arabic or English (mode=search). Required for this mode."
          },
          "category": {
            "title": "Category",
            "enum": [
              "",
              "حراج السيارات",
              "حراج الأجهزة",
              "حراج العقار",
              "اثاث",
              "خدمات",
              "مستلزمات شخصية",
              "مواشي وحيوانات وطيور",
              "العاب وترفيه",
              "تعليم وتدريب",
              "اطعمة ومشروبات",
              "حفلات ومناسبات",
              "برمجة وتصاميم",
              "زراعة وحدائق",
              "نوادر و تراثيات",
              "مشاريع واستثمارات",
              "مكتبة وفنون",
              "صيد ورحلات",
              "سفر وسياحة",
              "مفقودات",
              "قسم غير مصنف"
            ],
            "type": "string",
            "description": "Restrict results to a Haraj top-level category (mode=search, browse). Leave as \"(any category)\" for no category filter.",
            "default": ""
          },
          "city": {
            "title": "City / region",
            "enum": [
              "",
              "الرياض",
              "الشرقيه",
              "جده",
              "مكه",
              "ينبع",
              "حفر الباطن",
              "المدينة",
              "الطايف",
              "تبوك",
              "القصيم",
              "حائل",
              "أبها",
              "عسير",
              "الباحة",
              "جيزان",
              "نجران",
              "الجوف",
              "عرعر",
              "الكويت",
              "الإمارات",
              "البحرين"
            ],
            "type": "string",
            "description": "Restrict results to a Saudi city/region (or Kuwait, UAE, Bahrain) (mode=search, browse). Leave as \"(any city)\" for no city filter.",
            "default": ""
          },
          "subTag": {
            "title": "Brand / model / sub-category tag",
            "type": "string",
            "description": "Narrower than `category` — a specific brand or model tag from Haraj's own hierarchical tag tree, e.g. `تويوتا` (Toyota), `كامري` (Camry), `ايفون` (iPhone) (mode=search, browse). Confirmed via live probing that Haraj's finer tags filter correctly server-side, but the full tag tree runs into the thousands (every brand/model/variant across every category) so it isn't a stable curated dropdown — enter the exact tag text, e.g. copied from a listing's own `categories[]` output field. When set, this takes priority over `category` for narrowing (only one tag value can be sent upstream at a time) — `category`/`excludeCategory` still apply as an extra check afterwards."
          },
          "carBodyType": {
            "title": "Car body type",
            "enum": [
              "",
              "سيدان صغيرة",
              "سيدان",
              "سيدان فاخرة",
              "هاتشباك",
              "كوبيه",
              "اس يو في",
              "جيوب",
              "جيوب فاخرة",
              "فان",
              "بيك أب صغير",
              "بيك أب كبير",
              "تراثية"
            ],
            "type": "string",
            "description": "Restrict results to a specific car body style (mode=search, browse). Haraj's own frontend uses this exact 12-value vocabulary as a hidden filter axis, distinct from `subTag`'s brand/model tags — confirmed via live probing that each value reliably narrows to the correct body style server-side. Since only one tag value can be sent upstream at a time, this takes priority over `subTag`/`category` for that slot when set (both still apply as extra client-side checks afterwards). Leave as \"(any body type)\" for no filter.",
            "default": ""
          },
          "cities": {
            "title": "Multiple cities / regions",
            "type": "array",
            "description": "Restrict results to any of several Saudi cities/regions (or Kuwait, UAE, Bahrain) in one request — a listing matching ANY selected city passes (mode=search, browse). Combines with `city` above (both are OR'd together) if both are set. Leave empty for no multi-city filter.",
            "items": {
              "type": "string",
              "enum": [
                "الرياض",
                "الشرقيه",
                "جده",
                "مكه",
                "ينبع",
                "حفر الباطن",
                "المدينة",
                "الطايف",
                "تبوك",
                "القصيم",
                "حائل",
                "أبها",
                "عسير",
                "الباحة",
                "جيزان",
                "نجران",
                "الجوف",
                "عرعر",
                "الكويت",
                "الإمارات",
                "البحرين"
              ],
              "enumTitles": [
                "Riyadh",
                "Eastern Province",
                "Jeddah",
                "Makkah",
                "Yanbu",
                "Hafr Al-Batin",
                "Madinah",
                "Taif",
                "Tabuk",
                "Qassim",
                "Hail",
                "Abha",
                "Asir",
                "Al Baha",
                "Jazan",
                "Najran",
                "Al Jouf",
                "Arar",
                "Kuwait",
                "UAE",
                "Bahrain"
              ]
            },
            "default": []
          },
          "neighborhood": {
            "title": "Neighborhood / town (fine-grained location)",
            "type": "string",
            "description": "Restrict results to an exact match of Haraj's finer town/neighborhood-level location tag (the `geoCity` output field) — e.g. `الدرعية` (Diriyah) or `الخبر` (Al Khobar). More granular than `city`/`cities` (which match the broader region/city) and combines with them as an AND — a listing must match both when both are set. Free-text because Haraj's neighborhood/town list runs into the hundreds and isn't a stable curated set — enter the exact value from a listing's own `geoCity` output field to filter by it precisely (mode=search, browse, byAuthor)."
          },
          "excludeCategory": {
            "title": "Exclude category",
            "enum": [
              "",
              "حراج السيارات",
              "حراج الأجهزة",
              "حراج العقار",
              "اثاث",
              "خدمات",
              "مستلزمات شخصية",
              "مواشي وحيوانات وطيور",
              "العاب وترفيه",
              "تعليم وتدريب",
              "اطعمة ومشروبات",
              "حفلات ومناسبات",
              "برمجة وتصاميم",
              "زراعة وحدائق",
              "نوادر و تراثيات",
              "مشاريع واستثمارات",
              "مكتبة وفنون",
              "صيد ورحلات",
              "سفر وسياحة",
              "مفقودات",
              "قسم غير مصنف"
            ],
            "type": "string",
            "description": "Drop results from this category, even if they match other filters (mode=search, browse).",
            "default": ""
          },
          "postIds": {
            "title": "Listing IDs or URLs (mode=byId)",
            "type": "array",
            "description": "Haraj numeric listing IDs or full listing URLs, e.g. `186610241` or `https://haraj.com.sa/11186610241/...`. Required for this mode.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "authorUsername": {
            "title": "Seller / store username (mode=byAuthor)",
            "type": "string",
            "description": "Exact Haraj seller username, e.g. `معرض رائد علي القحطاني`. Required for this mode."
          },
          "includeSimilarListings": {
            "title": "Include similar listings (mode=byId)",
            "type": "boolean",
            "description": "For each resolved listing, attach a `similarListings[]` array of related Haraj listings (id, title, url, priceSAR, thumbnailUrl, city) using Haraj's own \"related items\" lookup. Adds one extra request per listing ID, so only available for mode=byId.",
            "default": false
          },
          "trendingRangeDays": {
            "title": "Trending window in days (mode=trending)",
            "minimum": 1,
            "maximum": 14,
            "type": "integer",
            "description": "How many trailing days of search activity to rank trending keywords over. Haraj's public trending-keywords endpoint only has data for 1-14 days.",
            "default": 1
          },
          "priceMin": {
            "title": "Min price (SAR)",
            "minimum": 0,
            "maximum": 100000000,
            "type": "integer",
            "description": "Drop listings priced below this (SAR). Listings with no price stated always pass through."
          },
          "priceMax": {
            "title": "Max price (SAR)",
            "minimum": 0,
            "maximum": 100000000,
            "type": "integer",
            "description": "Drop listings priced above this (SAR). Listings with no price stated always pass through."
          },
          "onlyWithImage": {
            "title": "Only listings with images",
            "type": "boolean",
            "description": "Skip listings that have no photos.",
            "default": false
          },
          "onlyWithVideo": {
            "title": "Only listings with video",
            "type": "boolean",
            "description": "Skip listings that have no video.",
            "default": false
          },
          "hideShowRooms": {
            "title": "Hide dealer / store showroom listings",
            "type": "boolean",
            "description": "Exclude listings from dealer/store-type sellers (e.g. car-parts shops, showroom accounts), keeping only individual sellers (mode=search only — Haraj's browse/byAuthor endpoint doesn't support this filter).",
            "default": false
          },
          "sortBy": {
            "title": "Sort order",
            "enum": [
              "recentlyActive",
              "newestPosted"
            ],
            "type": "string",
            "description": "Ordering of results (mode=search, browse).",
            "default": "recentlyActive"
          },
          "maxItems": {
            "title": "Max items",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Hard cap on emitted records. Haraj's own pagination for a given search/browse request only exposes so many unique listings before it starts repeating — narrow queries may return fewer than this cap even when nothing is wrong; the run's status message explains when that happens.",
            "default": 30
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}