# CHINTAI Location Autocomplete API Documentation

Scrappa's `GET /api/chintai/autocomplete` finds the prefectures, municipalities and railway lines that the CHINTAI search accepts.

## What you get

Up to 20 results for the text in `q`, best matches first (names that start with the text come before names that contain it). Search by Japanese name, by prefecture slug (for example `tokyo`) or by municipality code. Each municipality and line result carries `search_params` with the `prefecture` and `city` or `line` to send to `/api/chintai/search`. A prefecture result has `search_params` set to `null` and `locations_params` for the location tree.

## Notes

The list is read from CHINTAI's public area and line pages for all 47 prefectures. CHINTAI lists only municipalities that have listings, so a quiet prefecture can have few municipalities. This call needs no lookup on CHINTAI and answers at once.

- **Documentation:** [https://scrappa.co/docs/chintai-api/chintai_autocomplete](https://scrappa.co/docs/chintai-api/chintai_autocomplete)
- **API group:** CHINTAI API
- **Endpoint:** `GET https://scrappa.co/api/chintai/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 or line name, for example 新宿, 山手 or tokyo. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/chintai/autocomplete?q=%E6%96%B0%E5%AE%BF"
```

## Example response

```json
{
    "success": true,
    "data": {
        "query": "\u65b0\u5bbf",
        "items": [
            {
                "type": "city",
                "name": "\u65b0\u5bbf\u533a",
                "code": "13104",
                "prefecture": "tokyo",
                "prefecture_name": "\u6771\u4eac\u90fd",
                "search_params": {
                    "prefecture": "tokyo",
                    "city": "13104"
                }
            },
            {
                "type": "line",
                "name": "\u6e58\u5357\u65b0\u5bbf\u30e9\u30a4\u30f3",
                "code": "101038",
                "prefecture": "tokyo",
                "prefecture_name": "\u6771\u4eac\u90fd",
                "search_params": {
                    "prefecture": "tokyo",
                    "line": "101038"
                }
            }
        ]
    },
    "meta": {
        "endpoint_family": "autocomplete",
        "billable": true
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Validation Error | A query parameter is missing, unknown or unusable. Non-billable. |
| 503 | Service Unavailable | The service could not answer (`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)
