# CHINTAI Location Tree API Documentation

Scrappa's `GET /api/chintai/locations` lists all 47 CHINTAI prefectures, the municipalities of one prefecture or its railway lines.

## What you get

`level=prefectures` (default) returns each prefecture with its `slug`, Japanese `name`, `city_count` and `line_count`. `level=cities` with a `prefecture` returns each municipality with its `code` and `search_params`. `level=lines` returns each line with its `code` and `search_params`. An unknown prefecture slug returns `404`.

## Notes

The tree is read from CHINTAI's public area and line pages. CHINTAI lists only municipalities that have listings. This call needs no lookup on CHINTAI and answers at once.

- **Documentation:** [https://scrappa.co/docs/chintai-api/chintai_locations](https://scrappa.co/docs/chintai-api/chintai_locations)
- **API group:** CHINTAI API
- **Endpoint:** `GET https://scrappa.co/api/chintai/locations`

## 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 |
| --- | --- | --- | --- |
| `level` | string | No | prefectures (default), cities or lines. |
| `prefecture` | string | No | Prefecture slug. Required for cities and lines, not allowed for prefectures. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/chintai/locations?level=cities&prefecture=tokyo"
```

## Example response

```json
{
    "success": true,
    "data": {
        "level": "cities",
        "prefecture": "tokyo",
        "items": [
            {
                "type": "city",
                "name": "\u5343\u4ee3\u7530\u533a",
                "code": "13101",
                "prefecture": "tokyo",
                "prefecture_name": "\u6771\u4eac\u90fd",
                "search_params": {
                    "prefecture": "tokyo",
                    "city": "13101"
                }
            }
        ]
    },
    "meta": {
        "endpoint_family": "locations",
        "billable": true
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 404 | Not Found | No CHINTAI prefecture has that slug (`NOT_FOUND`). Non-billable. |
| 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)
