{
  "openapi": "3.0.1",
  "info": {
    "title": "Habitaclia Scraper: Spain Property Listings",
    "description": "Scrape Habitaclia.com property listings (inmuebles) in Spain from a URL or filters. Extract price, EUR/m², price drops, energy certificate, amenities, coordinates, agency contacts, zone price comparison, rental yield estimate, risk flags, radius search, and monitor mode. Export JSON, CSV or Excel.",
    "version": "0.1",
    "x-build-id": "W7QP44JsJ2C59zkNK"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/kareninatech~habitaclia-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-kareninatech-habitaclia-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/kareninatech~habitaclia-scraper/runs": {
      "post": {
        "operationId": "runs-sync-kareninatech-habitaclia-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/kareninatech~habitaclia-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-kareninatech-habitaclia-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": {
          "input_url": {
            "title": "Input URL",
            "type": "string",
            "description": "Optional. Paste a Habitaclia search results URL after filtering on the website, for example https://www.habitaclia.com/comprar/viviendas/barcelona-provincia/barcelona-capital/s?minPrice=200000. A single listing URL also works. When set, it overrides all the filters below. Leave empty to use structured filters, which is better for AI agents."
          },
          "start_urls": {
            "title": "Extra URLs",
            "type": "array",
            "description": "Optional. More Habitaclia search or listing URLs to scrape in the same run. Also overrides the filters.",
            "items": {
              "type": "string"
            }
          },
          "operation": {
            "title": "Operation",
            "enum": [
              "comprar",
              "alquiler"
            ],
            "type": "string",
            "description": "Buy or rent. Ignored when input_url is set.",
            "default": "comprar"
          },
          "property_type": {
            "title": "Property type",
            "enum": [
              "viviendas",
              "oficinas",
              "locales_comerciales",
              "aparcamientos",
              "industriales",
              "terrenos_y_solares",
              "inversiones"
            ],
            "type": "string",
            "description": "Same categories as on Habitaclia. Ignored when input_url is set.",
            "default": "viviendas"
          },
          "location": {
            "title": "Location",
            "type": "string",
            "description": "City, town or province. Plain names work: Barcelona, Sant Cugat del Vallès, Girona, Madrid, Valencia. For a whole province use girona-provincia. You can also paste the path from a Habitaclia URL, like barcelona-provincia/barcelona-capital/eixample. Ignored when input_url is set.",
            "default": "barcelona"
          },
          "locations": {
            "title": "More locations",
            "type": "array",
            "description": "Optional. Search several places in one run with the same filters. Ignored when input_url is set.",
            "items": {
              "type": "string"
            }
          },
          "min_price": {
            "title": "Min price (EUR)",
            "minimum": 0,
            "type": "integer",
            "description": "Minimum price. For rentals this is the monthly rent."
          },
          "max_price": {
            "title": "Max price (EUR)",
            "minimum": 0,
            "type": "integer",
            "description": "Maximum price. For rentals this is the monthly rent."
          },
          "min_rooms": {
            "title": "Min bedrooms",
            "minimum": 0,
            "maximum": 10,
            "type": "integer",
            "description": "Minimum number of bedrooms, for example 2. Leave empty for no minimum."
          },
          "max_rooms": {
            "title": "Max bedrooms",
            "minimum": 0,
            "maximum": 10,
            "type": "integer",
            "description": "Maximum number of bedrooms, for example 4. Leave empty for no maximum."
          },
          "min_bathrooms": {
            "title": "Min bathrooms",
            "minimum": 0,
            "maximum": 10,
            "type": "integer",
            "description": "Minimum number of bathrooms, for example 1. Leave empty for no minimum."
          },
          "min_surface": {
            "title": "Min surface (m2)",
            "minimum": 0,
            "type": "integer",
            "description": "Minimum built surface in square metres, for example 60. Leave empty for no minimum."
          },
          "max_surface": {
            "title": "Max surface (m2)",
            "minimum": 0,
            "type": "integer",
            "description": "Maximum built surface in square metres, for example 180. Leave empty for no maximum."
          },
          "new_build_only": {
            "title": "New builds only",
            "type": "boolean",
            "description": "If true, only keep new-build homes (obra nueva).",
            "default": false
          },
          "private_sellers_only": {
            "title": "Private sellers only",
            "type": "boolean",
            "description": "Only listings from private owners (particulares). Private sellers never get contact data in the output.",
            "default": false
          },
          "sort_by": {
            "title": "Sort by",
            "enum": [
              "",
              "newest",
              "price_asc",
              "price_desc",
              "price_drop"
            ],
            "type": "string",
            "description": "Order of results. Empty keeps Habitaclia relevance order. Ignored when input_url is set.",
            "default": ""
          },
          "center_lat": {
            "title": "Center latitude",
            "type": "number",
            "description": "Optional. With center longitude, adds distance_km to every listing (for example your office, a school or the beach)."
          },
          "center_lng": {
            "title": "Center longitude",
            "type": "number",
            "description": "Optional longitude of the map center, for example 2.17. Use with center_lat."
          },
          "radius_km": {
            "title": "Radius (km)",
            "minimum": 0,
            "type": "number",
            "description": "Optional. Keep only listings within this distance of the center point. Listings without coordinates are dropped."
          },
          "compare_with_zone": {
            "title": "Compare with zone prices",
            "type": "boolean",
            "description": "Adds zone_median_price_per_m2, price_vs_zone_pct and deal_label: how cheap or expensive each listing is per m2 compared with the other listings of the same district (or city) in this run.",
            "default": true
          },
          "estimate_rental_yield": {
            "title": "Estimate rental yield",
            "type": "boolean",
            "description": "For sale listings, also reads a small sample of rentals in the same area and adds est_monthly_rent and gross_rental_yield_pct. Rent sample rows are not saved or charged.",
            "default": false
          },
          "yield_sample_pages": {
            "title": "Rent sample pages",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "How many rent result pages (29 listings each) to read per location for the yield estimate. More pages give better district medians.",
            "default": 3
          },
          "detect_risks": {
            "title": "Detect risk flags",
            "type": "boolean",
            "description": "Reads the title and description for warnings such as occupied (okupa), auction, bare ownership, rented with tenant, needs renovation, social housing (VPO), no visits and cash only. Adds risk_flags.",
            "default": true
          },
          "exclude_risky": {
            "title": "Exclude risky listings",
            "type": "boolean",
            "description": "If true, drop listings that have any risk flag.",
            "default": false
          },
          "max_properties": {
            "title": "Max properties",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Maximum number of listings to save per run (up to 1000).",
            "default": 100
          },
          "max_pages": {
            "title": "Max pages per search",
            "minimum": 1,
            "maximum": 300,
            "type": "integer",
            "description": "Optional. Limit of result pages per location (29 listings each). Leave empty for automatic."
          },
          "include_full_description": {
            "title": "Include full description",
            "type": "boolean",
            "description": "Adds the full listing description. A short description_snippet is always included.",
            "default": true
          },
          "fetch_details": {
            "title": "Fetch listing pages",
            "type": "boolean",
            "description": "Open each listing page too. Habitaclia already sends almost all data in the results pages, so this is rarely needed. One extra request per property.",
            "default": false
          },
          "monitor_mode": {
            "title": "Monitor mode (only new or changed)",
            "type": "boolean",
            "description": "Remember listings across runs in a named key-value store. Later runs save only listings that are new or whose price changed, with monitor_status, previous_price, price_change, first_seen_at and days_tracked. Pair with Apify Schedules for alerts.",
            "default": false
          },
          "monitor_key": {
            "title": "Monitor key",
            "type": "string",
            "description": "Namespace for monitor mode so two schedules (for example Barcelona sale vs Girona rent) do not share memory. Letters, numbers and dashes only.",
            "default": "default"
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Proxy settings. Apify Proxy is recommended. If a request keeps failing, the Actor retries it through Spanish residential proxies when your plan allows it.",
            "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}