# Flatmates Location Autocomplete API Documentation

Scrappa's `GET /api/flatmates/location-autocomplete` suggests Australian suburbs, cities, train stations and universities for the start of a name. Pass the `key` of a suggestion as `location` to the search endpoint.

`type` is `suburb` (default), `city`, `train_station` or `university`. Each suggestion has `id`, `name`, `title`, `suburb`, `city`, `state`, `postcode`, `country`, `latitude`, `longitude`, `location_type`, `key` and `average_rent`. Matching is fuzzy, so a small typo still finds the place. City slugs such as `sydney` and `melbourne` also work in `location` directly.

- **Documentation:** [https://scrappa.co/docs/flatmates-api/flatmates_location_autocomplete](https://scrappa.co/docs/flatmates-api/flatmates_location_autocomplete)
- **API group:** Flatmates API
- **Endpoint:** `GET https://scrappa.co/api/flatmates/location-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 | Yes | Start of a name, at least 2 characters. |
| `type` | string | No | suburb (default), city, train_station or university. |
| `limit` | integer | No | Suggestions to return, 1-10 (default 5). |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/flatmates/location-autocomplete?query=newt&limit=5"
```

## Example response

```json
{
    "success": true,
    "data": [
        {
            "id": 345,
            "name": "Newtown",
            "title": "Newtown, Sydney, NSW, 2042",
            "suburb": "Newtown",
            "city": "Sydney",
            "state": "NSW",
            "postcode": "2042",
            "country": "AU",
            "latitude": -33.8992,
            "longitude": 151.1782,
            "location_type": "suburb",
            "key": "newtown-2042",
            "average_rent": 405
        }
    ],
    "meta": {
        "endpoint_family": "location_autocomplete",
        "billable": true,
        "attempts": 1
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Validation Error | A query parameter is missing, unknown or unusable. Unknown parameters are rejected, never ignored. Non-billable. |
| 503 | Upstream Unavailable | Flatmates could not be reached after retries or answered with something unusable (`upstream_unavailable`, `upstream_blocked`, `parser_drift`). 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)
