# Square Yards Location Autocomplete API Documentation

Resolve free text into localities, projects and builders inside one city. Each item has the type, the name, the ids, the number of sale and rent listings, the property types, the price range and for projects the status and a photo. The locality_id of a locality item is the value for the locality filter of /search. A query that matches nothing returns an empty list as a successful response.

- **Documentation:** [https://scrappa.co/docs/squareyards-api/squareyards_autocomplete](https://scrappa.co/docs/squareyards-api/squareyards_autocomplete)
- **API group:** Square Yards API
- **Endpoint:** `GET https://scrappa.co/api/squareyards/v1/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 | Free text, 2 to 80 characters. Example: andheri. |
| `city` | string | Yes | City id or city name from /cities. Example: Mumbai. |
| `category` | string | No | buy or rent. Defaults to buy. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/squareyards/v1/autocomplete?q=andheri&city=Mumbai"
```

## Example response

```json
{
    "success": true,
    "data": {
        "items": [
            {
                "type": "locality",
                "name": "Andheri West",
                "locality_id": 65173,
                "project_id": null,
                "builder_id": null,
                "city": "Mumbai",
                "city_id": 3,
                "listing_count": 6094,
                "sale_listing_count": 1678,
                "rent_listing_count": 4416,
                "project_count": 1867,
                "property_types": [
                    "apartment",
                    "commercial",
                    "builder_floor"
                ],
                "price_min": null,
                "price_avg": 15232321,
                "price_max": 4900000000,
                "currency": "INR",
                "project_status": null,
                "possession_status": null,
                "image": null
            }
        ],
        "query": "andheri",
        "city": "Mumbai"
    },
    "meta": {
        "endpoint_family": "autocomplete",
        "billable": true
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Validation Error | A public parameter is missing or invalid, or a city, property type, bedroom value or sort cannot be resolved. The response is not billable. |
| 404 | Resource Not Found | The requested Square Yards resource does not exist. The response is not billable. |
| 503 | Unexpected Upstream Response | Square Yards answered with a body that is not the documented shape. The response is not billable. |
| 503 | Upstream Unavailable | Square Yards was temporarily unavailable or blocked the request. The response is not billable and the request never answers 429. |

## 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)
