# Pisos.com Agency Listings API Documentation

Scrappa's `GET /api/pisos/agency/listings` returns the properties one Pisos.com agency has online, for sale or for rent, 30 per page.

## What you get

The same item fields as the search endpoint, with `pagination.total` as the agency's count for that operation. Sale and rent are separate lists: pass `operation`.

## Pagination

`page` is 1-based. A page past the last page returns an empty list, never another page's items.

- **Documentation:** [https://scrappa.co/docs/pisos-api/pisos_agency_listings](https://scrappa.co/docs/pisos-api/pisos_agency_listings)
- **API group:** Pisos.com API
- **Endpoint:** `GET https://scrappa.co/api/pisos/agency/listings`

## Authentication

Send your Scrappa API key in the `X-API-KEY` request header. Paid endpoints also support accountless x402 payments when called without an API key.

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `slug` | string | Yes | Agency slug, for example anna_riba. |
| `operation` | string | No | sale (default) or rent. |
| `sort` | string | No | relevance (default), newest, price_asc, price_desc, bedrooms_asc, bedrooms_desc, size_asc or size_desc. |
| `page` | integer | No | Result page, 1-based. A page holds up to 30 listings. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/pisos/agency/listings?slug=anna_riba&operation=sale"
```

## Example response

```json
{
    "success": true,
    "data": {
        "items": [
            {
                "id": "65098413759",
                "listing_id": "65098413759.100500",
                "url": "https://www.pisos.com/comprar/piso-gaztambide-65098413759_100500/",
                "path": "/comprar/piso-gaztambide-65098413759_100500/",
                "title": "Piso en calle de la Princesa, 76",
                "location": "Gaztambide (Distrito Chamber\u00ed. Madrid Capital)",
                "operation": "sale",
                "property_type": "piso",
                "price": 1600000,
                "currency": "EUR",
                "price_period": null,
                "price_per_m2": null,
                "bedrooms": 3,
                "bathrooms": 3,
                "area_m2": 155,
                "floor": "4\u00aa planta",
                "description": "Espectacular propiedad de alta gama llave en mano...",
                "photo_count": 34,
                "image": "https://fotos.imghs.net/mm-wp/1005/101/photo.jpg",
                "latitude": 40.4325,
                "longitude": -3.71735,
                "locality": "Madrid Capital",
                "region": "Madrid",
                "agency": {
                    "id": "100500",
                    "slug": "princess_homes",
                    "url": "https://www.pisos.com/inmobiliaria-princess_homes/"
                },
                "is_new_development": false,
                "is_promoted": true,
                "tag": "Oportunidad",
                "listing_type": null
            }
        ],
        "pagination": {
            "page": 1,
            "per_page": 30,
            "total": 117,
            "total_pages": 4,
            "has_next_page": true
        },
        "items_dropped": 0,
        "total_includes_dropped": false,
        "applied_filters": {
            "slug": "anna_riba",
            "operation": "sale",
            "sort": "relevance"
        }
    },
    "meta": {
        "endpoint_family": "agency_listings",
        "billable": true,
        "attempts": 1,
        "items_dropped": 0
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 404 | Not Found | No agency with that slug exists on Pisos.com (`NOT_FOUND`). Non-billable. |
| 422 | Validation Error | A query parameter is missing, unknown or unusable. Unknown parameters and unknown values are rejected, never ignored. Non-billable. |
| 503 | Upstream Unavailable | Pisos.com could not be reached, refused the request or answered with a page this API could not read (`UPSTREAM_UNAVAILABLE`). Retryable and never billed. Clients are never rate limited. |

## More Scrappa resources

- [API documentation](https://scrappa.co/docs)
- [Full LLM-readable API reference](https://scrappa.co/llms-full.txt)
- [OpenAPI specification](https://scrappa.co/docs/api.json)
- [Pricing](https://scrappa.co/pricing)
