# TocToc Autocomplete API

<p><strong>TocToc Autocomplete API</strong> resolves a place name to the ids the search route needs. Each result has a label, a parent label, a type (<code>region</code>, <code>commune</code>, <code>street</code> or <code>avenue</code>), the TocToc page path and the <code>region_id</code> and <code>commune_id</code> to pass into search. A street or avenue carries the ids of its commune. A query with no match returns an empty list. A query under 2 characters returns an empty list and is not billed. Failed requests are not billed.</p>

- **Documentation:** [https://scrappa.co/docs/toctoc-api/toctoc_autocomplete](https://scrappa.co/docs/toctoc-api/toctoc_autocomplete)
- **API group:** TocToc API
- **Endpoint:** `GET https://scrappa.co/api/toctoc/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 | Search text, for example providencia. Under 2 characters returns an empty list and is not billed. |
| `limit` | integer | No | Number of results, 1 to 25 (default 10). |

## Example response

```json
{
    "data": {
        "query": "providencia",
        "results": [
            {
                "type": "commune",
                "label": "Providencia",
                "place_id": 47,
                "seo_path": "metropolitana/providencia",
                "sublabel": "Santiago",
                "region_id": 13,
                "commune_id": 337
            },
            {
                "type": "avenue",
                "label": "Avenida Providencia",
                "place_id": 3433,
                "seo_path": "metropolitana/providencia/providencia",
                "sublabel": "Providencia",
                "region_id": 13,
                "commune_id": 337
            }
        ]
    },
    "meta": {
        "billable": true,
        "endpoint_family": "autocomplete"
    },
    "success": true
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Validation Error | A parameter is missing or invalid. This response is not billed. |
| 503 | Upstream Unavailable | TocToc could not be reached or returned data that does not match the request. This response is not billed and can be retried. |

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