# Graana Area Autocomplete API Documentation

Scrappa's `GET /api/graana/autocomplete` finds the areas, societies and phases that the Graana search accepts, for example `dha`.

## What you get

Each area has `area_id`, `name`, `city_id`, `city_name`, `long_name`, `latitude` and `longitude`, plus `search_params` with `city_id` and `area_id`. Pass `search_params` to the search endpoint as they are. A query without a match returns an empty list with `total` 0.

## Notes

Set `city_id` to see only the areas of one city. The list has no paging.

- **Documentation:** [https://scrappa.co/docs/graana-api/graana_autocomplete](https://scrappa.co/docs/graana-api/graana_autocomplete)
- **API group:** Graana API
- **Endpoint:** `GET https://scrappa.co/api/graana/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 an area name, at least 2 characters, for example dha. |
| `city_id` | integer | No | Limit the areas to one city. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/graana/autocomplete?q=dha&city_id=2"
```

## Example response

```json
{
    "success": true,
    "query": "dha",
    "total": 1,
    "areas": [
        {
            "area_id": 830,
            "name": "DHA Phase 7",
            "city_id": 2,
            "city_name": "Lahore",
            "long_name": "DHA Phase 7, Lahore",
            "latitude": 31.4647119,
            "longitude": 74.4935913,
            "search_params": {
                "city_id": 2,
                "area_id": 830
            }
        }
    ],
    "meta": {
        "endpoint_family": "autocomplete",
        "billable": true,
        "attempts": 1
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Validation Error | A query parameter is missing, unknown or unusable. Unknown parameters and unknown values are rejected, never ignored. Non-billable. |
| 503 | Upstream Unavailable | Graana could not be reached after retries, answered with an error or changed its format (`upstream_unavailable`, `upstream_blocked`, `parser_drift`). 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)
