# Loft Brazil Autocomplete API Documentation

<p><strong>Loft Brazil Autocomplete API</strong> matches a term against cities (the 1000 with the most listings) or, when <code>city</code> is sent, against that city's neighborhoods (the 100 with the most listings). Matches that start with the term come first, then the busiest places. Pass <code>filter.city</code> or <code>filter.neighborhood</code> to the search route as returned. A city with no neighborhoods answers 404 and is not billed.</p>

- **Documentation:** [https://scrappa.co/docs/loft-br-api/loft_br_autocomplete](https://scrappa.co/docs/loft-br-api/loft_br_autocomplete)
- **API group:** Loft Brazil API
- **Endpoint:** `GET https://scrappa.co/api/loft-br/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 |
| --- | --- | --- | --- |
| `term` | string | Yes | Text to match, for example pin. Matching ignores accents and case. |
| `city` | string | No | City value such as São Paulo, SP. When sent, the route matches that city's neighborhoods instead of cities. |

## Example response

```json
{
    "data": {
        "term": "pin",
        "type": "neighborhood",
        "returned": 1,
        "locations": [
            {
                "count": 14415,
                "value": "Pinheiros, S\u00e3o Paulo, SP",
                "filter": {
                    "neighborhood": "Pinheiros, S\u00e3o Paulo, SP"
                }
            }
        ]
    },
    "meta": {
        "attempts": 0,
        "billable": true,
        "endpoint_family": "autocomplete"
    },
    "success": true
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 404 | Not Found | No neighborhoods exist for that city. This response is not billed. |
| 422 | Rejected Request | A parameter is missing, unknown or out of range. This response is not billed. |
| 503 | Upstream Unavailable | Loft could not be reached or returned data that did not match the filters. Retry shortly. This response is not billed. |

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