# HouseSigma Location Autocomplete API Documentation

Scrappa's `GET /api/housesigma/locations` suggests places for a text, such as `toronto`, a street or a neighbourhood.

## What you get

Six lists, each possibly empty:

- `cities`: `municipality_id` (use it in search and market), `name`, `label`, `province`, `slug` and `location`.
- `communities` and `community_suggestions`: neighbourhoods with `community_id` (use it as `community_id` in search), `municipality_id`, `municipality`, `province` and `location`.
- `places`: address and area matches with a `listing_id` when the match is a listing.
- `houses`: matching listings with address, price, rooms text, status, location and photo. `listing_id` feeds the listing endpoint.
- `precon`: new-build projects with name, address, property types, completion and photo.

Pass `province` (ON, BC or AB) to bias the suggestions to that province.

- **Documentation:** [https://scrappa.co/docs/housesigma-api/housesigma_locations](https://scrappa.co/docs/housesigma-api/housesigma_locations)
- **API group:** HouseSigma API
- **Endpoint:** `GET https://scrappa.co/api/housesigma/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 | Search text, at least 2 characters, for example toronto. |
| `province` | string | No | ON (default), BC or AB. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/housesigma/locations?q=toronto"
```

## Example response

```json
{
    "success": true,
    "query": "toronto",
    "province": "ON",
    "cities": [
        {
            "municipality_id": 10343,
            "name": "Toronto",
            "label": "Toronto, ON",
            "province": "ON",
            "slug": "toronto-real-estate",
            "location": {
                "lat": 43.653226,
                "lon": -79.3831843
            }
        }
    ],
    "communities": [
        {
            "community_id": 67,
            "name": "Danforth",
            "municipality_id": 10343,
            "municipality": "Toronto",
            "province": "ON",
            "location": {
                "lat": 43.6845831,
                "lon": -79.3289205
            }
        }
    ],
    "community_suggestions": [],
    "places": [
        {
            "listing_id": "eVbOYENw0kKyx2P0",
            "label": "Toronto Avenue, Oshawa - Central, ON",
            "municipality_id": 10243,
            "province": "ON",
            "location": {
                "lat": 43.88416,
                "lon": -78.84898
            }
        }
    ],
    "houses": [
        {
            "listing_id": "eVbOYENw0kKyx2P0",
            "address": "Toronto Avenue",
            "community": "Central",
            "municipality_id": 10243,
            "municipality": "Oshawa",
            "province": "ON",
            "property_type": "Vacant Land",
            "rooms": "0 Bedroom, 0 Bathroom,  Garage",
            "price": 219000,
            "status": "For Sale",
            "location": {
                "lat": 43.88416,
                "lon": -78.84898
            },
            "photo": null
        }
    ],
    "precon": [
        {
            "project_id": "njJKdOYrjY54lWL8",
            "name": "155 Cumberland",
            "address": "15 Cumberland St, Toronto",
            "municipality": "Toronto",
            "province": "ON",
            "property_types": [
                "Condo"
            ],
            "price": null,
            "completion": null,
            "photo": null
        }
    ],
    "meta": {
        "endpoint_family": "locations",
        "billable": true,
        "attempts": 1
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Validation Error | A query parameter is missing, unknown or unusable, for example `page` above 200. Unknown parameters are rejected, never ignored. Non-billable. |
| 503 | Upstream Unavailable | HouseSigma could not be reached after retries, answered with an error, or returned an unexpected answer (`upstream_unavailable`, `upstream_blocked`, `token_unavailable`, `upstream_changed`). 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)
