{
  "openapi": "3.0.1",
  "info": {
    "title": "Fotocasa Scraper - Spain Real Estate",
    "description": "Scrape Fotocasa — Spain's top real estate portal. Homes for sale or rent with prices, m², rooms, energy rating, photos, geo, full description & agency leads (name, phone, profile). Filter by city, price, size. Monitor new listings & price drops. Export JSON, CSV, Excel.",
    "version": "0.1",
    "x-build-id": "O3p5iVMbsVkYniHVO"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/scrapesage~fotocasa-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-scrapesage-fotocasa-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/scrapesage~fotocasa-scraper/runs": {
      "post": {
        "operationId": "runs-sync-scrapesage-fotocasa-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/scrapesage~fotocasa-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-scrapesage-fotocasa-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": {
          "location": {
            "title": "Location",
            "type": "string",
            "description": "A Spanish city or area to search — e.g. <code>Madrid</code>, <code>Barcelona</code>, <code>Valencia</code>, <code>Marbella</code>. Major cities are resolved automatically; you can also pass a Fotocasa location slug (e.g. <code>madrid-capital</code>) or use <b>Start URLs</b> for full control."
          },
          "locations": {
            "title": "More locations (optional)",
            "type": "array",
            "description": "Search several locations in one run. Each is combined with the transaction, property type and filters below.",
            "items": {
              "type": "string"
            }
          },
          "transactionType": {
            "title": "Transaction",
            "enum": [
              "buy",
              "rent",
              "rent-to-own",
              "share",
              "transfer"
            ],
            "type": "string",
            "description": "What kind of deal to search.",
            "default": "buy"
          },
          "propertyType": {
            "title": "Property type",
            "enum": [
              "homes",
              "new-homes",
              "apartments",
              "flats",
              "houses",
              "semi-detached",
              "detached-villas",
              "penthouses",
              "duplex",
              "studios",
              "ground-floor",
              "rural-houses",
              "rooms",
              "garages",
              "commercial-premises",
              "offices",
              "warehouses",
              "land",
              "storage-rooms",
              "buildings"
            ],
            "type": "string",
            "description": "Type of property. <code>Homes</code> covers flats and houses. Choose a subtype, or use <code>New developments</code> for new construction.",
            "default": "homes"
          },
          "zone": {
            "title": "Zone (optional)",
            "type": "string",
            "description": "Fotocasa zone/district slug within the location. Leave as <code>todas-las-zonas</code> for all zones.",
            "default": "todas-las-zonas"
          },
          "searchUrls": {
            "title": "Start URLs (optional)",
            "type": "array",
            "description": "Paste any Fotocasa search/listing page URL — apply every filter on fotocasa.es and copy the URL here (e.g. <code>https://www.fotocasa.es/es/comprar/viviendas/barcelona-capital/todas-las-zonas/l</code>). Used in addition to the location above. Detail (<code>/d</code>) URLs are scraped as single properties.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "propertyUrls": {
            "title": "Property detail URLs (optional)",
            "type": "array",
            "description": "Scrape specific listings directly — paste Fotocasa property detail URLs (those ending in <code>/d</code>).",
            "items": {
              "type": "string"
            }
          },
          "minPrice": {
            "title": "Min price (€)",
            "minimum": 0,
            "type": "integer",
            "description": "Minimum price. For rentals this is the monthly rent."
          },
          "maxPrice": {
            "title": "Max price (€)",
            "minimum": 0,
            "type": "integer",
            "description": "Maximum price. For rentals this is the monthly rent."
          },
          "minRooms": {
            "title": "Min bedrooms",
            "minimum": 0,
            "maximum": 10,
            "type": "integer",
            "description": "Minimum number of bedrooms."
          },
          "minBathrooms": {
            "title": "Min bathrooms",
            "minimum": 0,
            "maximum": 10,
            "type": "integer",
            "description": "Minimum number of bathrooms."
          },
          "minSurface": {
            "title": "Min surface (m²)",
            "minimum": 0,
            "type": "integer",
            "description": "Minimum built surface in square meters."
          },
          "maxSurface": {
            "title": "Max surface (m²)",
            "minimum": 0,
            "type": "integer",
            "description": "Maximum built surface in square meters."
          },
          "onlyNewConstruction": {
            "title": "Only new construction",
            "type": "boolean",
            "description": "Keep only new-build / off-plan listings.",
            "default": false
          },
          "onlyWithPhoto": {
            "title": "Only with photos",
            "type": "boolean",
            "description": "Keep only listings that have at least one photo.",
            "default": false
          },
          "onlyPriceReduced": {
            "title": "Only price-reduced",
            "type": "boolean",
            "description": "Keep only listings whose price was recently dropped.",
            "default": false
          },
          "advertiserType": {
            "title": "Advertiser",
            "enum": [
              "any",
              "professional",
              "private"
            ],
            "type": "string",
            "description": "Limit to professional (agency) or private (owner) listings.",
            "default": "any"
          },
          "maxAgeDays": {
            "title": "Max listing age (days)",
            "minimum": 0,
            "type": "integer",
            "description": "Keep only listings published within this many days. Great for monitoring fresh inventory."
          },
          "includePropertyDetails": {
            "title": "Fetch full property details",
            "type": "boolean",
            "description": "Open each listing's detail page for the energy certificate, decoded features (orientation, condition, age, floor), construction type, plot size and the full photo set. One extra request per listing.",
            "default": true
          },
          "includeAgencyLeads": {
            "title": "Extract agency leads",
            "type": "boolean",
            "description": "Also output a deduplicated list of advertising agencies/owners as B2B leads (name, phone, profile, active-listing count, cities, price range and a 0-100 lead score).",
            "default": true
          },
          "maxResults": {
            "title": "Max properties",
            "minimum": 1,
            "type": "integer",
            "description": "Maximum number of property records to scrape across all searches.",
            "default": 100
          },
          "maxAgencyLeads": {
            "title": "Max agency leads",
            "minimum": 1,
            "type": "integer",
            "description": "Maximum number of agency lead records to output (highest lead score first).",
            "default": 200
          },
          "monitorMode": {
            "title": "Monitor mode (only new / changed)",
            "type": "boolean",
            "description": "Remember listings across runs and output only NEW listings and PRICE CHANGES. Pair with Apify Schedules to track a market for fresh inventory and price drops.",
            "default": false
          },
          "monitorKey": {
            "title": "Monitor key",
            "type": "string",
            "description": "Name for this monitor's memory. Use a different key per saved search you track separately.",
            "default": "default"
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Proxy settings. Fotocasa requires Spanish residential IPs — the default (Apify Residential, country ES) is strongly recommended.",
            "default": {
              "useApifyProxy": true,
              "apifyProxyGroups": [
                "RESIDENTIAL"
              ],
              "apifyProxyCountry": "ES"
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}