{
  "openapi": "3.0.1",
  "info": {
    "title": "Fotocasa Scraper — Spain Real Estate & Agency Leads (MCP)",
    "description": "Fotocasa scraper for all Spain: pisos, chalets & rentals in every province with price drops, m2, rooms, photos, GPS + the agency phone number. Beats the 10 000-listing cap automatically. Monitor mode: only new listings, price cuts & removed ads. MCP-ready.",
    "version": "0.0",
    "x-build-id": "fkAP71lGmUO2gjvWy"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/amygraphics~fotocasa-spain-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-amygraphics-fotocasa-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/amygraphics~fotocasa-spain-scraper/runs": {
      "post": {
        "operationId": "runs-sync-amygraphics-fotocasa-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/amygraphics~fotocasa-spain-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-amygraphics-fotocasa-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": {
          "mode": {
            "title": "Mode",
            "enum": [
              "search",
              "monitor"
            ],
            "type": "string",
            "description": "search = extract every matching listing. monitor = compare with the previous run and return only what is new, changed (price cuts included) or gone — ideal for a daily schedule.",
            "default": "search"
          },
          "operation": {
            "title": "Operation",
            "enum": [
              "buy",
              "rent"
            ],
            "type": "string",
            "description": "Buy (comprar) or rent (alquiler).",
            "default": "buy"
          },
          "locations": {
            "title": "Locations (Fotocasa segments)",
            "type": "array",
            "description": "One location per item, as Fotocasa writes it in its URLs: country 'espana', province 'madrid' or 'barcelona', city 'madrid-capital', 'barcelona-capital', 'valencia-capital', or a barrio 'madrid-capital/chamberi'. Spaces and accents are fine ('Madrid Capital' → madrid-capital).",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "propertyType": {
            "title": "Property type",
            "enum": [
              "viviendas",
              "pisos",
              "apartamentos",
              "aticos",
              "duplex",
              "estudios",
              "chalets",
              "adosados",
              "casas-rurales",
              "bajos",
              "plantas-intermedias",
              "lofts",
              "terrenos",
              "locales",
              "oficinas",
              "garajes",
              "trasteros",
              "edificios"
            ],
            "type": "string",
            "description": "Fotocasa type segment. 'viviendas' = homes in general (recommended).",
            "default": "viviendas"
          },
          "minPrice": {
            "title": "Min price (€)",
            "type": "integer",
            "description": "Optional.",
            "default": null
          },
          "maxPrice": {
            "title": "Max price (€)",
            "type": "integer",
            "description": "Optional. Also the first splitting dimension when a search is capped.",
            "default": null
          },
          "minSurface": {
            "title": "Min surface (m²)",
            "type": "integer",
            "description": "Optional.",
            "default": null
          },
          "maxSurface": {
            "title": "Max surface (m²)",
            "type": "integer",
            "description": "Optional.",
            "default": null
          },
          "minRooms": {
            "title": "Min rooms",
            "type": "integer",
            "description": "Optional.",
            "default": null
          },
          "maxRooms": {
            "title": "Max rooms",
            "type": "integer",
            "description": "Optional.",
            "default": null
          },
          "sort": {
            "title": "Sort",
            "enum": [
              "newest",
              "price_desc",
              "price_asc"
            ],
            "type": "string",
            "description": "Newest first is recommended (used for monitoring); price sorting works for market scans.",
            "default": "newest"
          },
          "addedWithinDays": {
            "title": "Only listings added within (days)",
            "type": "integer",
            "description": "Optional. With 'newest first' sorting the Actor stops as soon as it reaches older listings — cheap incremental runs.",
            "default": null
          },
          "maxResults": {
            "title": "Max listings to return",
            "minimum": 1,
            "maximum": 300000,
            "type": "integer",
            "description": "Global cap on rows returned (and charged).",
            "default": 200
          },
          "autoSplit": {
            "title": "Auto-split when a search is truncated",
            "type": "boolean",
            "description": "Recommended. Fotocasa cuts every search at 10 323 listings (page 333) without warning; the Actor splits such searches by price → rooms → surface and merges the results.",
            "default": true
          },
          "includeImages": {
            "title": "Include photo URLs",
            "type": "boolean",
            "description": "Up to 25 original-size photo URLs per listing.",
            "default": true
          },
          "onlyChanges": {
            "title": "Monitor: keep unchanged listings out of the output",
            "type": "boolean",
            "description": "Monitor mode only. Unchanged listings are not returned and not charged.",
            "default": true
          },
          "detectClosed": {
            "title": "Monitor: detect removed / sold listings",
            "type": "boolean",
            "description": "Monitor mode only. Listings that disappeared from Fotocasa are returned once with changeType='closed'. Only when the scan was complete and error-free.",
            "default": true
          },
          "stateKey": {
            "title": "Monitor state key (advanced)",
            "type": "string",
            "description": "Leave empty: derived from your search scope, so each search keeps its own history.",
            "default": ""
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}