# Casa.it Locations

Look up Italian towns, provinces, regions and city zones by name. Each location has its id, name, slug, type, level, coordinates, whether it has children and its parents. Use the slug of a location with searchable true (type town, province or region) as the location parameter of the search endpoint. City zones (type block) are listed but not searchable yet. A query without matches is a successful empty list.

- **Documentation:** [https://scrappa.co/docs/casa-it-api/casa_it_locations](https://scrappa.co/docs/casa-it-api/casa_it_locations)
- **API group:** Casa.it API
- **Endpoint:** `GET https://scrappa.co/api/casa_it/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, at least 2 characters, e.g. rom. |

## Example request

```bash
#!/bin/bash

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

## Example response

```json
{
    "success": true,
    "data": {
        "locations": [
            {
                "id": "IT-LAZ-058091",
                "name": "Roma",
                "slug": "roma",
                "type": "town",
                "level": 9,
                "has_children": true,
                "searchable": true,
                "latitude": 41.885454,
                "longitude": 12.460768,
                "parents": [
                    {
                        "name": "Italia",
                        "slug": "italia"
                    },
                    {
                        "name": "Lazio",
                        "slug": "lazio"
                    },
                    {
                        "name": "Roma",
                        "slug": "roma"
                    }
                ]
            },
            {
                "id": "IT-LAZ-RM",
                "name": "Roma",
                "slug": "roma",
                "type": "province",
                "level": 6,
                "has_children": true,
                "searchable": true,
                "latitude": 41.851809,
                "longitude": 12.63105,
                "parents": [
                    {
                        "name": "Italia",
                        "slug": "italia"
                    },
                    {
                        "name": "Lazio",
                        "slug": "lazio"
                    }
                ]
            }
        ]
    },
    "meta": {
        "endpoint_family": "locations",
        "billable": true
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Validation Error | A required query parameter is missing or invalid. This response is not billable. |
| 503 | Source Temporarily Blocked | The upstream service is temporarily unavailable. Please retry shortly. |
| 503 | Service Unavailable | Casa.it could not be reached or answered with a page that no longer matches the documented contract. 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)
