# Wikicasa Location Autocomplete API Documentation

Scrappa's `GET /api/wikicasa/autocomplete` finds Italian places by name, or one place by its URL slug.

## What you get

Each place has `place_id`, `place_type` (city, zone, province, region, district and more), `name`, `slug`, `city_id`, `zone_id`, `province_id`, `region_id`, coordinates, a `description` and `searchable`.

## How to use it

Send `query` with at least 2 characters, or `url` with a place slug such as `roma`. The search endpoint takes places with `searchable` true: pass their `city_id` and `slug` as `city_id` and `city_slug`. A query without matches is a successful empty list. An unknown `url` answers 404.

- **Documentation:** [https://scrappa.co/docs/wikicasa-api/wikicasa_autocomplete](https://scrappa.co/docs/wikicasa-api/wikicasa_autocomplete)
- **API group:** Wikicasa API
- **Endpoint:** `GET https://scrappa.co/api/wikicasa/autocomplete`

## 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 | No | Start of a place name, at least 2 characters, for example mil. Send query or url. |
| `url` | string | No | Place slug to resolve, for example roma. Send query or url, not both. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/wikicasa/autocomplete?query=mil"
```

## Example response

```json
{
    "success": true,
    "data": {
        "places": [
            {
                "place_id": "15146",
                "place_type": "city",
                "name": "Milano (MI)",
                "slug": "milano",
                "city_id": 15146,
                "zone_id": null,
                "province_id": 15,
                "region_id": 3,
                "province_code": "MI",
                "region": "Lombardia",
                "latitude": 45.4684313155,
                "longitude": 9.1726979868,
                "description": "Milano e la capitale italiana della moda e del design.",
                "searchable": true
            }
        ]
    },
    "meta": {
        "endpoint_family": "autocomplete",
        "billable": true
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 404 | Not Found | The url slug matches no place (`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 | Wikicasa could not be reached, refused the request or answered with data 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)
