# Emlakjet Location Tree API Documentation

Scrappa's `GET /api/emlakjet/locations` walks the Emlakjet location tree: all cities, the districts of one city or the neighbourhoods of one district.

## Levels

- `level=cities` (default) returns all 82 cities. No `id`.
- `level=districts` needs `id` = a city id, for example 34 for İstanbul.
- `level=towns` needs `id` = a district id, for example 1421 for Kadıköy.

## What you get

Each item has `id`, `name`, `slug`, `type`, `parent_id` and `children`. Towns list their neighbourhoods in `children`. The `slug` of a city, district or neighbourhood works as `location` in the search.

## Notes

The level of the id is checked before the lookup. A district id used for districts, or a city id used for towns, returns `422`. An id that does not exist returns `404`.

- **Documentation:** [https://scrappa.co/docs/emlakjet-api/emlakjet_locations](https://scrappa.co/docs/emlakjet-api/emlakjet_locations)
- **API group:** Emlakjet API
- **Endpoint:** `GET https://scrappa.co/api/emlakjet/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 | cities (default), districts or towns. |
| `id` | integer | No | City id for districts, district id for towns. Not allowed for cities. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/emlakjet/locations?level=districts&id=34"
```

## Example response

```json
{
    "success": true,
    "data": {
        "level": "districts",
        "parent_id": 34,
        "items": [
            {
                "id": 1421,
                "name": "Kad\u0131k\u00f6y",
                "slug": "istanbul-kadikoy",
                "type": "district",
                "parent_id": 34,
                "children": null
            }
        ]
    },
    "meta": {
        "endpoint_family": "locations",
        "billable": true
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 404 | Not Found | Emlakjet knows no location with that id. (`NOT_FOUND`). Non-billable. |
| 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 | Emlakjet 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)
