{
  "openapi": "3.0.1",
  "info": {
    "title": "Fotocasa Scraper",
    "description": "Fotocasa scraper for Spain: homes, flats, garages, offices and land for sale or rent by city, district or pasted search URL, with price, size, bedroom and bathroom filters. Price per m2, price cuts, duplicate listings flagged. Monitor mode alerts on new listings and price drops.",
    "version": "0.1",
    "x-build-id": "fZVAitd7Kg24hj8Sy"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/datahamster~fotocasa-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-datahamster-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/datahamster~fotocasa-scraper/runs": {
      "post": {
        "operationId": "runs-sync-datahamster-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/datahamster~fotocasa-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-datahamster-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": {
          "maxItems": {
            "title": "Max items",
            "minimum": 1,
            "type": "integer",
            "description": "Stop after this many results (you are charged only for pushed items)",
            "default": 100
          },
          "mode": {
            "title": "Mode",
            "enum": [
              "scrape",
              "monitor"
            ],
            "type": "string",
            "description": "scrape = full results; monitor = only new/changed items since the previous run of this task",
            "default": "scrape"
          },
          "monitorStateId": {
            "title": "Monitor state id",
            "type": "string",
            "description": "Optional state id when not running as a saved task (monitor mode)"
          },
          "webhookUrl": {
            "title": "Webhook URL",
            "type": "string",
            "description": "POST a change summary here in monitor mode"
          },
          "telegramBotToken": {
            "title": "Telegram bot token",
            "type": "string",
            "description": "Optional: bot token for monitor-mode change summaries"
          },
          "telegramChatId": {
            "title": "Telegram chat id",
            "type": "string",
            "description": "Optional: chat id that receives monitor-mode summaries"
          },
          "searchUrls": {
            "title": "Fotocasa search URLs",
            "type": "array",
            "description": "Paste Fotocasa search URLs from your browser (sale or rent, any type, district and filters), e.g. https://www.fotocasa.es/es/alquiler/viviendas/madrid-capital/chamberi/l?maxPrice=1500. Every filter in the URL is kept.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "locations": {
            "title": "Locations",
            "type": "array",
            "description": "Cities, provinces or districts, one per line, e.g. \"Madrid\", \"Valencia\", \"Madrid, Chamberí\" or a Fotocasa location path such as \"madrid-capital/barajas\" or \"malaga-provincia\". A city name tries the city first, then the wider area. Each line is a separate search with the filters below.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "operation": {
            "title": "Buy or rent",
            "enum": [
              "sale",
              "rent"
            ],
            "type": "string",
            "description": "For the Locations searches. Pasted URLs keep their own. Example: rent.",
            "default": "sale"
          },
          "propertyType": {
            "title": "Property type",
            "enum": [
              "homes",
              "flats",
              "garages",
              "offices",
              "premises",
              "land",
              "buildings",
              "storageRooms"
            ],
            "type": "string",
            "description": "For the Locations searches. Example: homes.",
            "default": "homes"
          },
          "minPrice": {
            "title": "Min price (EUR)",
            "minimum": 0,
            "type": "integer",
            "description": "Sale price, or monthly rent for rentals. Example: 150000."
          },
          "maxPrice": {
            "title": "Max price (EUR)",
            "minimum": 0,
            "type": "integer",
            "description": "Example: 400000."
          },
          "minRooms": {
            "title": "Min bedrooms",
            "minimum": 0,
            "maximum": 20,
            "type": "integer",
            "description": "Example: 2."
          },
          "maxRooms": {
            "title": "Max bedrooms",
            "minimum": 0,
            "maximum": 20,
            "type": "integer",
            "description": "Example: 3."
          },
          "minBathrooms": {
            "title": "Min bathrooms",
            "minimum": 0,
            "maximum": 20,
            "type": "integer",
            "description": "Example: 2."
          },
          "minSize": {
            "title": "Min size (m²)",
            "minimum": 0,
            "type": "integer",
            "description": "Example: 60."
          },
          "maxSize": {
            "title": "Max size (m²)",
            "minimum": 0,
            "type": "integer",
            "description": "Example: 120."
          },
          "sort": {
            "title": "Sort",
            "enum": [
              "relevance",
              "newest",
              "price_low",
              "price_high",
              "size_high",
              "price_per_m2_low",
              "url"
            ],
            "type": "string",
            "description": "Monitor mode always reads newest first. Example: newest.",
            "default": "relevance"
          },
          "maxPagesPerSearch": {
            "title": "Max pages per search",
            "minimum": 1,
            "maximum": 333,
            "type": "integer",
            "description": "30 listings per page; Fotocasa serves at most 333 pages (about 10,000 listings) per search. In monitor mode this is the depth read and compared on every run: price drops are seen only within it, so set it to the search's result count divided by 30 to watch the whole search. Example: 10.",
            "default": 10
          },
          "onlyReduced": {
            "title": "Only price-reduced listings",
            "type": "boolean",
            "description": "true = return only listings that show a price cut on Fotocasa (priceReduction, priceBeforeReduction). Scrape mode only: monitor mode ignores it, because it must record every listing to report later price drops. Example: false.",
            "default": false
          },
          "duplicates": {
            "title": "Same property listed twice",
            "enum": [
              "flag",
              "drop",
              "off"
            ],
            "type": "string",
            "description": "The same flat is often listed by two or more agencies. flag = keep both rows and set duplicateOf on the later one; drop = skip the later one. Match: same type, map points within 150 m, size within 3 m² or 3%, same bedrooms and bathrooms, price within 5%. Example: flag.",
            "default": "flag"
          },
          "includeDescription": {
            "title": "Include description",
            "type": "boolean",
            "description": "The advert text, with phone numbers, e-mail addresses and sentences naming a contact person removed. Example: true.",
            "default": true
          },
          "priceAlerts": {
            "title": "Monitor: price alerts",
            "enum": [
              "drops",
              "any"
            ],
            "type": "string",
            "description": "Monitor mode: which price changes of known listings come back. Example: drops.",
            "default": "drops"
          },
          "minPriceDropPercent": {
            "title": "Monitor: min price change (%)",
            "minimum": 0,
            "maximum": 90,
            "type": "number",
            "description": "Monitor mode: report a price change only when it is at least this many percent of the last reported price. Smaller moves add up until they reach it. 0 = every change. Example: 5.",
            "default": 0
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}