# Sinyi Location Autocomplete API Documentation

Scrappa's `GET /api/sinyi/autocomplete` finds the roads, communities and districts of Taiwan from the start of a Chinese place name.

## What you get

Each item has `name`, `type` (`community`, `road` or `place`), `type_label`, `keyword_id`, `city_id`, `city`, `zip_code`, `district`, `road`, coordinates and `search_params`. Pass `search_params.location` to `/api/sinyi/search` as `location`. A name without a match returns an empty list.

- **Documentation:** [https://scrappa.co/docs/sinyi-api/sinyi_autocomplete](https://scrappa.co/docs/sinyi-api/sinyi_autocomplete)
- **API group:** Sinyi API
- **Endpoint:** `GET https://scrappa.co/api/sinyi/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 | Start of a place name in Chinese, for example 大安. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/sinyi/autocomplete?q=%E5%A4%A7%E5%AE%89"
```

## Example response

```json
{
    "success": true,
    "data": {
        "items": [
            {
                "name": "\u5927\u5b89\u8def\u4e00\u6bb5",
                "type": "road",
                "type_label": "\u8def\u6bb5",
                "keyword_id": "28474",
                "city_id": "1",
                "city": "\u53f0\u5317\u5e02",
                "zip_code": "106",
                "district": "\u5927\u5b89\u5340",
                "road": null,
                "latitude": 25.0448662145589,
                "longitude": 121.546123817978,
                "search_params": {
                    "location": "106"
                }
            }
        ]
    },
    "meta": {
        "endpoint_family": "autocomplete",
        "billable": true
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Validation Error | A query parameter is missing, unknown or unusable. Unknown parameters and unknown values are rejected before any lookup, never ignored. Non-billable. |
| 503 | Upstream Unavailable | Sinyi could not be reached after one retry, answered with an error or changed its format (`UPSTREAM_UNAVAILABLE`). 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)
