# Fotocasa Search

Search the live Fotocasa catalogue for Spain. Enums are numeric: property_type 2 home, 3 garage, 4 land, 5 commercial, 6 office, 7 storage room, 8 other; transaction_type 1 sale, 3 rent, 5 share, 7 rent with option to buy. Pass a combinedLocationIds chain from the autocomplete endpoint to scope the search; omitting it searches all of Spain. Listing agency phone numbers are withheld.

- **Documentation:** [https://scrappa.co/docs/fotocasa-api/fotocasa_search](https://scrappa.co/docs/fotocasa-api/fotocasa_search)
- **API group:** Fotocasa API
- **Endpoint:** `GET https://scrappa.co/api/fotocasa/search`

## 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 |
| --- | --- | --- | --- |
| `property_type` | integer | No | Numeric propertyType: 2 home, 3 garage, 4 land, 5 commercial, 6 office, 7 storage room, 8 other. |
| `transaction_type` | integer | No | Numeric transactionType: 1 sale, 3 rent, 5 share (habitaciones), 7 rent with option to buy. |
| `location` | array | No | One or more 9-slot combinedLocationIds chains from /autocomplete, for example 724,14,28,173,0,28079,0,0,0. |
| `new_construction` | boolean | No | Filter to obra nueva. This is a flag, not a property type. |
| `sort` | string | No | scoring (relevance), publicationDate, or price. |
| `sort_order_desc` | boolean | No | Reverse the sort order. Default true. |
| `page` | integer | No | 1-based page number. Paginate on total_items, not on the item count. |
| `size` | integer | No | Page size, 1-1000. A page can return one item fewer than requested when a promoted placement takes a slot. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/fotocasa/search?property_type=2&transaction_type=1&location%5B0%5D=724%2C14%2C28%2C173%2C0%2C28079%2C0%2C0%2C0&size=5"
```

## Example response

```json
{
    "success": true,
    "data": {
        "total_items": 12088,
        "page": 1,
        "has_more": true,
        "items": [
            {
                "id": "1_190783970",
                "property_type": 2,
                "property_type_label": "home",
                "transaction_type": 1,
                "transaction_type_label": "sale",
                "surface": 211,
                "features": [
                    {
                        "id": 3,
                        "label": "heating"
                    }
                ]
            }
        ]
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 404 | Not Found | The requested listing or location was not found. This response is not billable. |
| 422 | Validation Error | A public parameter is invalid, including an unknown property_type or transaction_type. This response is not billable. |
| 503 | Service Unavailable | The service could not obtain a complete result from Fotocasa. This response is not billable. |

## 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)
