# Madlan Location Autocomplete API

Resolve a Hebrew place name to the ids Madlan uses for it: cities, streets, neighbourhoods, addresses, projects, developers, agents, offices, schools and mortgage offices. Pass the returned docId to the neighbourhood, geo, school and mortgage endpoints. Hebrew is accepted and returned as raw UTF-8 with no transliteration.

- **Documentation:** [https://scrappa.co/docs/madlan-api/madlan_autocomplete](https://scrappa.co/docs/madlan-api/madlan_autocomplete)
- **API group:** Madlan API
- **Endpoint:** `GET https://scrappa.co/api/madlan/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 | Place name to resolve, for example תל אביב. |
| `types[]` | string[] | Yes | One or more of ADDRESS, CITY, STREET, NEIGHBOURHOOD, DISTRICT, ZIPCODE, PROJECT_RESIDENTIAL, PROJECT_COMMERCIAL, PROJECT_RESIDENTIAL_DRAFT, PROJECT_COMMERCIAL_DRAFT, DEVELOPER, CONSTRUCTOR, LAWYER, SALE_AGENT, OFFICE, EDUCATION, SCHOOL, CUSTOM_ZONE, MORTGAGE_ADVISORS_OFFICE, MORTGAGE_ADVISORS_OFFICE_DRAFT. |
| `limit` | integer | No | Number of suggestions to return, 1 to 50. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/madlan/autocomplete?query=%D7%AA%D7%9C+%D7%90%D7%91%D7%99%D7%91&types%5B0%5D=CITY&types%5B1%5D=NEIGHBOURHOOD&limit=3"
```

## Example response

```json
{
    "success": true,
    "query": "\u05ea\u05dc \u05d0\u05d1\u05d9\u05d1",
    "completion_types": [
        "CITY",
        "NEIGHBOURHOOD"
    ],
    "returned": 2,
    "results": [
        {
            "docId": "\u05ea\u05dc-\u05d0\u05d1\u05d9\u05d1-\u05d9\u05e4\u05d5-\u05d9\u05e9\u05e8\u05d0\u05dc",
            "identityDocId": "\u05ea\u05dc-\u05d0\u05d1\u05d9\u05d1-\u05d9\u05e4\u05d5-\u05d9\u05e9\u05e8\u05d0\u05dc",
            "name": "\u05ea\u05dc \u05d0\u05d1\u05d9\u05d1 \u05d9\u05e4\u05d5",
            "type": "CITY"
        },
        {
            "docId": "\u05e9\u05db\u05d5\u05e0\u05d4-\u05dc\u05d1-\u05ea\u05dc-\u05d0\u05d1\u05d9\u05d1-\u05ea\u05dc-\u05d0\u05d1\u05d9\u05d1-\u05d9\u05e4\u05d5-\u05d9\u05e9\u05e8\u05d0\u05dc",
            "identityDocId": "\u05e9\u05db\u05d5\u05e0\u05d4-\u05dc\u05d1-\u05ea\u05dc-\u05d0\u05d1\u05d9\u05d1-\u05ea\u05dc-\u05d0\u05d1\u05d9\u05d1-\u05d9\u05e4\u05d5-\u05d9\u05e9\u05e8\u05d0\u05dc",
            "name": "\u05dc\u05d1 \u05ea\u05dc \u05d0\u05d1\u05d9\u05d1, \u05ea\u05dc \u05d0\u05d1\u05d9\u05d1 \u05d9\u05e4\u05d5",
            "type": "NEIGHBOURHOOD"
        }
    ],
    "notes": [
        "The docId returned here is what the neighbourhood, geo, school and mortgage endpoints expect. Pass it back as raw UTF-8.",
        "Madlan has no server-side location filter on listing search, so resolve a place here and then filter the returned listings by address."
    ],
    "meta": {
        "attempts": 1,
        "duration_ms": 231
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 503 | Madlan rejected the query | Madlan answered the request but refused to compute it. Branch on `error.code`: this response is not retryable. Nothing is charged for a failed request. |
| 503 | Madlan refused the request | Madlan answered with a client-side rejection before running the query, for example a bad path or an unsupported document. Retrying the same request changes nothing. Branch on `error.code`: this response is not retryable. Nothing is charged. |
| 503 | Madlan returned an unreadable response | Madlan answered, but not with the shape this endpoint reads, for example an HTML page where structured data was expected. The request was not answered, so it is not billed. Branch on `error.code`: this response is not retryable. |
| 503 | Madlan is temporarily unavailable | The upstream could not be reached, returned a server error, or throttled the request. `rate_limited_upstream` is the throttle path and is retryable once the wait has passed; `upstream_unavailable` covers a connection that could not be established, a server error, and a listing corpus that is still cold — the corpus is built in the background, so a cold one is a 503 that schedules a rebuild rather than a fan-out inside your request. Branch on `error.code`, then try again shortly. Nothing is charged. |
| 422 | Invalid parameters | One or more parameters are missing, out of range, or a filter Madlan cannot apply. Filters it cannot apply are refused rather than ignored, so the response never carries the unfiltered corpus in answer to a filter. The response lists the offending fields. |
| 404 | No record under that id | The id is well-formed and Madlan answered, but nothing is published under it. The body carries `found => false`. The lookup was answered, so it is billed; unlike a 503 this is not an upstream fault and retrying will not change it. |

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