# /fotocasa/properties/search

`POST /api/fotocasa/properties/search`

Price: 20 credits

Search Fotocasa real estate properties by location (city, municipality or neighbourhood) with transaction (comprar/alquiler), property type, an extra feature or situation filter, publisher type, price, surface, room and bathroom filters and ordering. Returns property cards with property and transaction type, price, price per m², surface, rooms, bathrooms, floor, condition, antiquity, orientation, furnished flag, amenity features, description, publication date, flags, address, photos, the property detail url and the listing agency.

## How to use it

Search Fotocasa properties in a location. location is a city or municipality ('Madrid', 'Barcelona'); transaction selects comprar (for sale) or alquiler (for rent); property_type filters the dwelling type (pisos, casas, chalets, aticos, ...); feature applies one extra feature or situation (terraza, ascensor, piscina, obra-nueva, lujo, ...); owner filters particular vs all; sort orders by price, surface or date; min_price/max_price, min_surface/max_surface, min_rooms/max_rooms and min_bathrooms narrow the results; bank_only restricts to bank-owned properties. Each result has id, real_estate_ad_id, url, property_type, transaction_type, price, price_drop, price_per_m2, surface, room_count, bathroom_count, floor, condition, antiquity, orientation, is_furnished, features (amenity keys such as elevator, air_conditioner, parking, terrace, storage_room, balcony), description, created_at, flags (is_new, is_new_construction, is_occupied, is_auctioned, is_bare_ownership, is_rented_with_tenants, is_premium, has_video, has_virtual_tour, has_quality_seal), address, images and agency (client_id, name, type, url, publisher_id).

## Parameters

- `access-token` (string, required)

## Request body

- `timeout` (integer) — Max scrapping execution timeout (in seconds) (default: 300; min: 20; max: 1500)
- `location` (string, required) — City, municipality or neighbourhood to search in (examples: "Madrid", "Barcelona", "Valencia"; minLength: 1)
- `transaction` (string) — Transaction type (default: "comprar"; one of: "comprar", "alquiler")
- `property_type` (string) — Property type filter (default: "viviendas"; one of: "viviendas", "pisos", "apartamentos", "aticos", "duplex", "estudios", "lofts", "plantas-intermedias", "bajos", "chalets", "adosados", "casas-rurales", "locales", "oficinas", "garajes", "trasteros", "naves-industriales", "edificios", "terrenos", "terrenos-residenciales", "terrenos-urbanizables", "terrenos-industriales")
- `feature` (string, nullable) — Single extra feature or situation filter (one of: "obra-nueva", "terraza", "ascensor", "piscina", "jardin", "amueblado", "no-amueblado", "subasta", "nuda-propiedad", "ocupado", "con-inquilino", "con-ayudas", "chimenea", "vistas-al-mar", "en-primera-linea-de-mar", "chollo", "aisladas", "lujo", "modernas", "campo", "prefabricadas", "unifamiliares", "villa", "vpo")
- `owner` (string) — Publisher type filter (default: "todos"; one of: "todos", "particular")
- `sort` (string) — Result ordering (default: "relevancia"; one of: "relevancia", "recientes", "precio-asc", "precio-desc", "superficie-desc", "superficie-asc")
- `min_price` (integer, nullable) — Minimum price filter (min: 0)
- `max_price` (integer, nullable) — Maximum price filter (min: 0)
- `min_surface` (integer, nullable) — Minimum surface filter in m² (min: 0)
- `max_surface` (integer, nullable) — Maximum surface filter in m² (min: 0)
- `min_rooms` (integer, nullable) — Minimum number of rooms filter (min: 0)
- `max_rooms` (integer, nullable) — Maximum number of rooms filter (min: 0)
- `min_bathrooms` (integer, nullable) — Minimum number of bathrooms filter (min: 0)
- `bank_only` (boolean) — Only properties from banks (default: false)
- `count` (integer, required) — Max number of results to return (min: 1)

## Response

### 200 — Successful Response

- `@type` (string) (default: "FotocasaPropertyCard")
- `id` (string, required)
- `real_estate_ad_id` (string, nullable)
- `url` (string, nullable)
- `property_type` (string, nullable)
- `transaction_type` (string, nullable)
- `price` (integer, nullable)
- `price_drop` (integer, nullable)
- `price_per_m2` (number, nullable)
- `surface` (integer, nullable)
- `room_count` (integer, nullable)
- `bathroom_count` (integer, nullable)
- `floor` (integer, nullable)
- `condition` (string, nullable)
- `antiquity` (string, nullable)
- `orientation` (string, nullable)
- `is_furnished` (boolean, nullable)
- `description` (string, nullable)
- `created_at` (string, nullable)
- `is_new` (boolean, nullable)
- `is_new_construction` (boolean, nullable)
- `is_occupied` (boolean, nullable)
- `is_auctioned` (boolean, nullable)
- `is_bare_ownership` (boolean, nullable)
- `is_rented_with_tenants` (boolean, nullable)
- `is_premium` (boolean, nullable)
- `has_video` (boolean, nullable)
- `has_virtual_tour` (boolean, nullable)
- `has_quality_seal` (boolean, nullable)
- `features` (array) (default: [])
- `address` (object, nullable)
  - `@type` (string) (default: "FotocasaAddress")
  - `street` (string, nullable)
  - `street_number` (integer, nullable)
  - `neighborhood` (string, nullable)
  - `district` (string, nullable)
  - `municipality` (string, nullable)
  - `locality` (string, nullable)
  - `region` (string, nullable)
  - `province` (string, nullable)
  - `autonomous_community` (string, nullable)
  - `country` (string, nullable)
  - `zip_code` (string, nullable)
  - `coordinates` (object, nullable)
    - `@type` (string) (default: "FotocasaCoordinates")
    - `latitude` (number, nullable)
    - `longitude` (number, nullable)
- `images` (array) (default: [])
- `agency` (object, nullable)
  - `@type` (string) (default: "FotocasaCardAgency")
  - `client_id` (string, nullable)
  - `name` (string, nullable)
  - `type` (string, nullable)
  - `url` (string, nullable)
  - `publisher_id` (string, nullable)

## Errors

### 422 — Validation Error

The request body did not validate

What to do: Check the fields against this schema. A URN with the wrong prefix is the most common cause.

- `detail` (array)
  - `loc` (array, required)
  - `msg` (string, required)
  - `type` (string, required)
  - `input` (any)
  - `ctx` (object)

### 408

The request ran past its time limit

What to do: Raise `timeout` in the request body, up to the maximum this endpoint documents. Lowering `count` or turning off the `with_*` flags also helps, because less work finishes sooner.

### 412

Location could not be resolved

What to do: Retrying will not help: either the entity does not exist, or the input points at a different one.

### 429

Too many requests: a rate limit or a usage window is exhausted

What to do: When the response carries an X-Retry-After header, wait that many seconds and retry: the same number is in the body as `detail.retry_after`, and the limit clears once that window passes. The message in the body names the limit that was hit.

### 500

Something broke on our side

What to do: Retrying will not help. If it keeps happening, send us the X-Request-ID from the response headers.

### 529

Rate limit reached, or the endpoint is overloaded

What to do: Wait at least 30 seconds, then retry.

## Response envelope

Success: Array of objects (may be empty if no results)

Error: Error may coexist with partial results if it occurs mid-execution. Check X-Error header and status code.

Every response carries these headers:

- `X-Error` — Error message text (present only on error)
- `X-Request-ID` — Unique request identifier
- `X-Execution-Time` — Execution time in seconds
- `X-Result-Count` — How many records the body carries. 0 means an empty result, which is a normal answer and not by itself an error. A non-zero count can come back together with X-Error when the failure happened partway through — read this header and X-Error independently.
- `X-Total-Available-Results` — How many records exist for this query, when the endpoint can say. On a `dry_run` request this is the answer and the body is empty. It saturates: the endpoint's documented maximum means 'at least that many', any smaller number is exact.
- `X-Warning` — Present when the request body carried keys this endpoint does not document. They were ignored, so any filter you meant to apply through them did not apply. Check the spelling against this schema and retry.
- `X-Retry-After` — Seconds to wait before retrying. Present only on 429.

