# InfoCasas Location Autocomplete API Documentation

Scrappa's `GET /api/infocasas/location-autocomplete` turns a place name into the location ids that the search filter takes. Results are scoped to the chosen country.

Each result has an `id`, a `name`, a `type` (for example `NEIGHBOURHOOD`, `STATE` or `CITY`), the state it belongs to, and coordinates. The `filter` object holds the exact `id` and `type` pair to send back as `locations[0][id]` and `locations[0][type]` on the search endpoint.

- **Documentation:** [https://scrappa.co/docs/infocasas-api/infocasas_location_autocomplete](https://scrappa.co/docs/infocasas-api/infocasas_location_autocomplete)
- **API group:** InfoCasas API
- **Endpoint:** `GET https://scrappa.co/api/infocasas/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 |
| --- | --- | --- | --- |
| `term` | string | Yes | Place name to resolve, at least 2 characters. |
| `country` | string | No | uy (default), py or bo. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/infocasas/location-autocomplete?term=pocitos&country=uy"
```

## Example response

```json
{
    "success": true,
    "country": "uy",
    "term": "pocitos",
    "returned": 1,
    "locations": [
        {
            "id": "d38dadb5-5212-4a9b-95a7-54824f178c0e",
            "name": "Pocitos",
            "type": "NEIGHBOURHOOD",
            "state": {
                "id": "a475c197-e6d7-4833-aa87-0ffd96a879ec",
                "name": "Montevideo"
            },
            "longitude": -56.1504057,
            "latitude": -34.9085301,
            "filter": {
                "id": "d38dadb5-5212-4a9b-95a7-54824f178c0e",
                "type": "NEIGHBOURHOOD"
            }
        }
    ],
    "meta": {
        "billable": true,
        "attempts": 1,
        "last_status": 200,
        "endpoint_family": "location-autocomplete"
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Validation Error | A query parameter failed validation. Non-billable. |
| 503 | Upstream Unavailable | InfoCasas could not be reached after retries, or answered with a body this API cannot read (`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)
