# /fotocasa/agencies/listings

`POST /api/fotocasa/agencies/listings`

Price: 20 credits

Get a Fotocasa real estate agency profile and its published listings by numeric agency client id. Returns the agency profile (name, contact details, address, coordinates, logo, quality seal, counters) together with the agency's property listings (same cards as the property search).

## How to use it

Fetch a single Fotocasa agency (inmobiliaria) and its listings by numeric client_id (obtained from fotocasa/agencies/search). transaction selects comprar (for sale) or alquiler (for rent) listings; min_price/max_price, min_surface/max_surface, min_rooms/max_rooms and min_bathrooms narrow the listings. Returns one item with agency (client_id, name, alias, description, email, phones, web, web_domain, address, address_url, town, province, zip_code, coordinates, image, has_quality_seal, agent_count, franchisee_count, created_at, publisher_id) and listings (property cards: id, url, property_type, transaction_type, price, price_per_m2, surface, room_count, bathroom_count, floor, address, images, ...).

## Parameters

- `access-token` (string, required)

## Request body

- `timeout` (integer) — Max scrapping execution timeout (in seconds) (default: 300; min: 20; max: 1500)
- `client_id` (string, required) — Numeric Fotocasa agency client id (examples: "9202765062251", "900140000987"; minLength: 1)
- `transaction` (string) — Transaction type of the listings (default: "comprar"; one of: "comprar", "alquiler")
- `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)
- `count` (integer, required) — Max number of agency listings to return (min: 1)

## Response

### 200 — Successful Response

- `@type` (string) (default: "FotocasaAgencyListings")
- `agency` (object, nullable)
  - `@type` (string) (default: "FotocasaAgencyProfile")
  - `client_id` (string, required)
  - `name` (string, nullable)
  - `alias` (string, nullable)
  - `description` (string, nullable)
  - `email` (string, nullable)
  - `phones` (array) (default: [])
  - `web` (string, nullable)
  - `web_domain` (string, nullable)
  - `address` (string, nullable)
  - `address_url` (string, nullable)
  - `town` (string, nullable)
  - `province` (string, nullable)
  - `zip_code` (string, nullable)
  - `coordinates` (object, nullable)
    - `@type` (string) (default: "FotocasaCoordinates")
    - `latitude` (number, nullable)
    - `longitude` (number, nullable)
  - `image` (string, nullable)
  - `has_quality_seal` (boolean, nullable)
  - `agent_count` (integer, nullable)
  - `franchisee_count` (integer, nullable)
  - `created_at` (string, nullable)
  - `publisher_id` (string, nullable)
- `listings` (array) (default: [])
  - `@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

Agency not found (well-formed but nonexistent client id)

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.

