# Tecnocasa Locations API Documentation

<p><strong>Tecnocasa Locations API</strong> turns a place name into provinces, cities, districts and quarters. Every city carries <code>city_id</code>, <code>province</code> and <code>region</code>, every district carries its <code>city_id</code>, so a result can go straight into the search route.</p><p>Notes: A name without any match returns empty groups and is a successful, billable response. Prices, areas and counts are numbers and the original text is kept in raw or label fields. A hidden price (for example Informazioni in agenzia) is <code>null</code>, never 0. A valid empty result is a successful, billable response; failed requests are never billed.</p>

- **Documentation:** [https://scrappa.co/docs/tecnocasa-api/tecnocasa_locations](https://scrappa.co/docs/tecnocasa-api/tecnocasa_locations)
- **API group:** Tecnocasa API
- **Endpoint:** `GET https://scrappa.co/api/tecnocasa/v1/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 |
| --- | --- | --- | --- |
| `q` | string | Yes | Place name, at least 2 characters. Example: mila. |
| `country` | string | No | it (default) or es. Example: es. |

## Example response

```json
{
    "data": {
        "query": "mila",
        "total": 3,
        "country": "it",
        "locations": {
            "cities": [
                {
                    "id": 13800324507779,
                    "name": "milano",
                    "type": "city",
                    "label": "Milano (MI)",
                    "region": "lom",
                    "city_id": 13800324507779,
                    "province": "MI",
                    "has_districts": true
                }
            ],
            "precise": [],
            "quarters": [],
            "districts": [
                {
                    "id": 10057,
                    "name": "navigli",
                    "type": "districts",
                    "label": "Milano - Navigli",
                    "region": "lom",
                    "city_id": 13800324507779,
                    "province": "MI"
                }
            ],
            "provinces": [
                {
                    "id": "MI",
                    "name": "milano",
                    "type": "province",
                    "label": "Milano",
                    "region": "lom",
                    "province": "MI"
                }
            ]
        }
    },
    "meta": {
        "billable": true,
        "endpoint_family": "locations"
    },
    "success": true
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Validation Error | A required parameter or a value is invalid. This response is not billable. |
| 404 | Not Found | The requested page does not exist. This response is not billable. |
| 503 | Upstream Unavailable | Tecnocasa could not be reached. This response is not billable and is retryable. |
| 503 | Unexpected Upstream Data | Tecnocasa returned data in an unexpected shape. This response is not billable and is retryable. |

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