# Fotocasa Autocomplete

Returns suggestions carrying combined_location_ids, the 9-slot chain every other Fotocasa endpoint accepts. Two 0 slots in a chain are normal. variant=geoadvisor is the cheap default; variant=v3 adds ads_count and vertical filters.

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

## 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 |
| --- | --- | --- | --- |
| `query` | string | Yes | Place name to resolve, for example Madrid. |
| `variant` | string | No | geoadvisor (default) or v3 for result counts. |
| `property_type` | integer | No | v3 only: numeric propertyType id, same values as /search. Sending it on the default geoadvisor variant is a 422, since that endpoint takes no filters. |
| `transaction_type` | integer | No | v3 only: numeric transactionType id, same values as /search. Sending it on the default geoadvisor variant is a 422. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/fotocasa/locations?query=Madrid"
```

## Example response

```json
{
    "success": true,
    "data": {
        "suggestions": [
            {
                "text": "Madrid, Madrid",
                "level": "MUNICIPALITY",
                "combined_location_ids": "724,14,28,173,0,28079,0,0,0"
            }
        ]
    }
}
```

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