# LankaPropertyWeb Location Autocomplete API Documentation

Scrappa's `GET /api/lankapropertyweb/autocomplete` resolves a start of a Sri Lankan place name to the places the property search accepts.

## What you get

Each item has `name`, `detail`, `kind` and `coordinates`. `name` is the value to pass as `location` to `/api/lankapropertyweb/search`. `detail` lists the neighbourhoods of an area, for example `Fort` for `Colombo 1`. `kind` is `city` or `district` for the "search the whole" rows, and `area` for a single area. Whole city and district rows have no coordinates, so `coordinates` is `null`. Otherwise `coordinates` holds `latitude` and `longitude`.

## Notes

`q` needs at least 3 characters. A name with no match returns an empty list with status `200`.

- **Documentation:** [https://scrappa.co/docs/lankapropertyweb-api/lankapropertyweb_autocomplete](https://scrappa.co/docs/lankapropertyweb-api/lankapropertyweb_autocomplete)
- **API group:** LankaPropertyWeb API
- **Endpoint:** `GET https://scrappa.co/api/lankapropertyweb/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 |
| --- | --- | --- | --- |
| `q` | string | Yes | Start of a place name, at least 3 characters. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/lankapropertyweb/autocomplete?q=col"
```

## Example response

```json
{
    "success": true,
    "data": {
        "query": "col",
        "items": [
            {
                "name": "Colombo",
                "detail": null,
                "kind": "city",
                "coordinates": null
            },
            {
                "name": "Colombo 1",
                "detail": "Fort",
                "kind": "area",
                "coordinates": {
                    "latitude": 6.87587,
                    "longitude": 79.860672
                }
            }
        ]
    },
    "meta": {
        "endpoint_family": "autocomplete",
        "billable": true
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Validation Error | A query parameter is missing, unknown or unusable. Unknown parameters and unknown values are rejected before any lookup, never ignored. Non-billable. |
| 503 | Upstream Unavailable | LankaPropertyWeb could not be reached after retries, answered with an error or changed its format (`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)
