{
  "openapi": "3.0.1",
  "info": {
    "title": "Habitaclia.com Spain Scraper | 1$/1k Cheap",
    "description": "Scrape habitaclia.com real-estate listings across Spain. Filter by transaction, property type, location, price, area, rooms and advertiser or paste any habitaclia URL. Get price, area, rooms, energy rating, amenities, photos and advertiser. Incremental monitoring for cheap daily runs.",
    "version": "1.0",
    "x-build-id": "YBQOlKemf8sIIwjG6"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/trev0n~habitaclia-com-spain-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-trev0n-habitaclia-com-spain-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/trev0n~habitaclia-com-spain-scraper/runs": {
      "post": {
        "operationId": "runs-sync-trev0n-habitaclia-com-spain-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/trev0n~habitaclia-com-spain-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-trev0n-habitaclia-com-spain-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": {
          "transactionType": {
            "title": "Transaction type",
            "enum": [
              "sale",
              "rent"
            ],
            "type": "string",
            "description": "Whether to scrape properties for sale or for rent.",
            "default": "sale"
          },
          "propertyType": {
            "title": "Property type",
            "enum": [
              "any",
              "apartment",
              "house",
              "attic",
              "duplex",
              "studio",
              "loft",
              "rural",
              "chalet",
              "office",
              "commercial",
              "industrial",
              "land",
              "parking",
              "building",
              "newbuild"
            ],
            "type": "string",
            "description": "Type of property. 'Any home' covers all residential listings; the rest map to habitaclia's dedicated categories.",
            "default": "any"
          },
          "location": {
            "title": "Location",
            "type": "string",
            "description": "Habitaclia location: a city, town, province or district. Free text is normalised to habitaclia's slug (e.g. 'Palma de Mallorca' → 'palma_de_mallorca'). Examples: barcelona, madrid, valencia, sevilla, girona.",
            "default": "barcelona"
          },
          "sort": {
            "title": "Sort order",
            "enum": [
              "relevance",
              "price_asc",
              "price_desc",
              "newest",
              "area_desc"
            ],
            "type": "string",
            "description": "Native habitaclia ordering of the search results.",
            "default": "relevance"
          },
          "startUrls": {
            "title": "Start URLs (advanced — overrides filters)",
            "type": "array",
            "description": "Optional. Paste any habitaclia.com URLs — a search-results page (e.g. https://www.habitaclia.com/viviendas-barcelona.htm) or an individual ad (…-i123456789.htm). Auto-classified. When provided, these REPLACE the filter fields above (price/area/room/keyword filters still apply).",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "minPrice": {
            "title": "Min price (€)",
            "minimum": 0,
            "type": "integer",
            "description": "Only keep listings priced at or above this (EUR)."
          },
          "maxPrice": {
            "title": "Max price (€)",
            "minimum": 0,
            "type": "integer",
            "description": "Only keep listings priced at or below this (EUR)."
          },
          "minArea": {
            "title": "Min area (m²)",
            "minimum": 0,
            "type": "integer",
            "description": "Only keep listings with at least this built area (m²)."
          },
          "maxArea": {
            "title": "Max area (m²)",
            "minimum": 0,
            "type": "integer",
            "description": "Only keep listings with at most this built area (m²)."
          },
          "minRooms": {
            "title": "Min rooms",
            "minimum": 0,
            "maximum": 20,
            "type": "integer",
            "description": "Only keep listings with at least this many rooms."
          },
          "maxRooms": {
            "title": "Max rooms",
            "minimum": 0,
            "maximum": 20,
            "type": "integer",
            "description": "Only keep listings with at most this many rooms."
          },
          "advertiserType": {
            "title": "Advertiser type",
            "enum": [
              "all",
              "agency",
              "private"
            ],
            "type": "string",
            "description": "Filter by who posted the ad.",
            "default": "all"
          },
          "keyword": {
            "title": "Keyword",
            "type": "string",
            "description": "Only keep listings whose title or description contains this text (accent-insensitive). E.g. 'ascensor', 'reformado', 'terraza'."
          },
          "fetchPropertyDetails": {
            "title": "Fetch full property details",
            "type": "boolean",
            "description": "When enabled, every listing is opened to collect the full record: long description, build year, energy certificate, all amenities, every photo and the advertiser. When disabled (default, cheapest), only the ~20 rich fields already on the listing card are returned — no extra request per listing.",
            "default": false
          },
          "maxListings": {
            "title": "Max listings",
            "minimum": 1,
            "type": "integer",
            "description": "Hard cap on the number of records pushed to the dataset.",
            "default": 200
          },
          "maxPages": {
            "title": "Max search pages",
            "minimum": 1,
            "type": "integer",
            "description": "Maximum number of search-result pages to crawl per start URL (~25 listings per page).",
            "default": 20
          },
          "maxConcurrency": {
            "title": "Max concurrency",
            "minimum": 1,
            "type": "integer",
            "description": "Maximum number of parallel requests.",
            "default": 10
          },
          "maxRequestRetries": {
            "title": "Max request retries",
            "minimum": 0,
            "type": "integer",
            "description": "How many times a failed request is retried on a fresh proxy session.",
            "default": 5
          },
          "incremental": {
            "title": "Incremental monitoring",
            "type": "boolean",
            "description": "Track changes across runs. The first run records a baseline; later runs emit only NEW, UPDATED (e.g. price drops) and REAPPEARED listings — typically 80–95% cheaper for daily monitoring of the same search.",
            "default": false
          },
          "stateKey": {
            "title": "Monitoring state key",
            "type": "string",
            "description": "Optional. Identifier for this monitoring baseline. Leave empty to derive one automatically from the search filters. Use a fixed value to keep one baseline across config tweaks."
          },
          "emitUnchanged": {
            "title": "Emit unchanged listings",
            "type": "boolean",
            "description": "Incremental only. Also output listings that did not change since the last run.",
            "default": false
          },
          "emitExpired": {
            "title": "Emit expired listings",
            "type": "boolean",
            "description": "Incremental only. Also output listings that disappeared since the last run (likely sold/rented), tagged EXPIRED.",
            "default": false
          },
          "skipReposts": {
            "title": "Skip reposts",
            "type": "boolean",
            "description": "Incremental only. Drop NEW listings whose content matches a recently expired one (same property re-listed under a new id).",
            "default": false
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "habitaclia serves fine over datacenter IPs, so the automatic Apify Proxy (cheapest) is the default. For very large or fast runs, switch to RESIDENTIAL with country ES.",
            "default": {
              "useApifyProxy": true
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}