# Zameen Location Autocomplete API Documentation

<p><strong>Zameen Location Autocomplete API</strong> Find locations by a search text of 2 or more characters. Each result has a name, an Urdu name, a slug, a level (0 country, 2 city, deeper levels are areas and phases), the number of listings, the position and the full hierarchy. Send the slug as the location parameter of the search endpoint. Send the slug of a city as the city parameter to search only inside that city. Results are ordered by match and by number of listings.</p>

- **Documentation:** [https://scrappa.co/docs/zameen-api/zameen_autocomplete](https://scrappa.co/docs/zameen-api/zameen_autocomplete)
- **API group:** Zameen API
- **Endpoint:** `GET https://scrappa.co/api/zameen/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 | Search text, 2 to 100 characters, e.g. dha ph. Matches area, phase and city names. |
| `city` | string | No | Optional. Search only inside one city or area. Use the slug of a result, e.g. /Lahore-1. |
| `limit` | integer | No | Rows to return, 1 to 20 (default 8). |

## Example response

```json
{
    "data": {
        "query": "dha ph",
        "results": [
            {
                "id": "1450",
                "name": "DHA Phase 7",
                "path": "DHA Phase 7 DHA Defence Lahore Punjab Pakistan",
                "slug": "/Lahore_Defence__DHA__Phase_7-1450",
                "level": 4,
                "name_ur": "\u0688\u06cc \u0627\u06cc\u0686 \u0627\u06d2 \u0641\u06cc\u0632 7",
                "latitude": 31.484893,
                "hierarchy": [
                    {
                        "id": "1521",
                        "name": "Pakistan",
                        "slug": "/Pakistan-1521",
                        "level": 0,
                        "name_ur": "\u067e\u0627\u06a9\u0633\u062a\u0627\u0646"
                    },
                    {
                        "id": "1522",
                        "name": "Punjab",
                        "slug": "/Punjab-1522",
                        "level": 1,
                        "name_ur": "\u067e\u0646\u062c\u0627\u0628"
                    },
                    {
                        "id": "1",
                        "name": "Lahore",
                        "slug": "/Lahore-1",
                        "level": 2,
                        "name_ur": "\u0644\u0627\u06c1\u0648\u0631"
                    },
                    {
                        "id": "9",
                        "name": "DHA Defence",
                        "slug": "/Lahore_DHA_Defence-9",
                        "level": 3,
                        "name_ur": "\u0688\u06cc \u0627\u06cc\u0686 \u0627\u06d2 \u0688\u06cc\u0641\u06cc\u0646\u0633"
                    },
                    {
                        "id": "1450",
                        "name": "DHA Phase 7",
                        "slug": "/Lahore_Defence__DHA__Phase_7-1450",
                        "level": 4,
                        "name_ur": "\u0688\u06cc \u0627\u06cc\u0686 \u0627\u06d2 \u0641\u06cc\u0632 7"
                    }
                ],
                "longitude": 74.472342,
                "has_children": true,
                "listing_count": 17604
            },
            {
                "id": "1485",
                "name": "DHA Phase 8",
                "path": "DHA Phase 8 DHA Defence Karachi Sindh Pakistan",
                "slug": "/Karachi_D.H.A_Phase_8-1485",
                "level": 4,
                "name_ur": "\u0688\u06cc \u0627\u06cc\u0686 \u0627\u06d2 \u0641\u06cc\u0632 8",
                "latitude": 24.77235659,
                "hierarchy": [
                    {
                        "id": "1521",
                        "name": "Pakistan",
                        "slug": "/Pakistan-1521",
                        "level": 0,
                        "name_ur": "\u067e\u0627\u06a9\u0633\u062a\u0627\u0646"
                    },
                    {
                        "id": "1523",
                        "name": "Sindh",
                        "slug": "/Sindh-1523",
                        "level": 1,
                        "name_ur": "\u0633\u0646\u062f\u06be"
                    },
                    {
                        "id": "2",
                        "name": "Karachi",
                        "slug": "/Karachi-2",
                        "level": 2,
                        "name_ur": "\u06a9\u0631\u0627\u0686\u06cc"
                    },
                    {
                        "id": "213",
                        "name": "DHA Defence",
                        "slug": "/Karachi_DHA_Defence-213",
                        "level": 3,
                        "name_ur": "\u0688\u06cc \u0627\u06cc\u0686 \u0627\u06d2 \u0688\u06cc\u0641\u06cc\u0646\u0633"
                    },
                    {
                        "id": "1485",
                        "name": "DHA Phase 8",
                        "slug": "/Karachi_D.H.A_Phase_8-1485",
                        "level": 4,
                        "name_ur": "\u0688\u06cc \u0627\u06cc\u0686 \u0627\u06d2 \u0641\u06cc\u0632 8"
                    }
                ],
                "longitude": 67.08148313,
                "has_children": true,
                "listing_count": 16188
            }
        ]
    },
    "meta": {
        "billable": true,
        "endpoint_family": "autocomplete"
    },
    "success": true
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Validation Error | A required parameter is missing or invalid. This response is not billable. |
| 503 | Temporarily Unavailable | Zameen did not answer or refused the request after several attempts. This response is not billable. Retry after a short pause. |

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