# realestate.co.nz Autocomplete API Documentation

Suggest locations for a search text, like the search box on realestate.co.nz. Hits can be suburbs, districts, regions, schools, streets and listings. Suburb, district and region hits return a numeric id for the search filters. School hits return a value for the school filter. Listing hits return a listing id for the listing endpoint.

- **Documentation:** [https://scrappa.co/docs/realestate-co-nz-api/realestate_co_nz_autocomplete](https://scrappa.co/docs/realestate-co-nz-api/realestate_co_nz_autocomplete)
- **API group:** realestate.co.nz API
- **Endpoint:** `GET https://scrappa.co/api/realestate-co-nz/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 | Text to complete, 2 to 100 characters, e.g. ponsonby. |
| `type` | string | No | sale or rent. Limits listing hits to that category. Defaults to sale. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/realestate-co-nz/autocomplete?q=ponsonby&type=sale"
```

## Example response

```json
{
    "success": true,
    "data": {
        "hits": [
            {
                "type": "suburb",
                "title": "Ponsonby, Auckland City",
                "id": 3236,
                "value": "3236"
            },
            {
                "type": "listing",
                "title": "Ponsonby Road, Ponsonby, Auckland City, Auckland",
                "listing_id": 43039671,
                "street_address": "217 Ponsonby Road",
                "suburb": "Ponsonby",
                "district": "Auckland City",
                "region": "Auckland"
            }
        ]
    },
    "meta": {
        "endpoint_family": "autocomplete",
        "billable": true
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
|  | Error | page times rows is above 10000. Narrow the search. Not billed. |
|  | Error | The listing, agent or office does not exist. Not billed. |
|  | Error | realestate.co.nz could not be reached. Not billed. |
|  | Error | realestate.co.nz refused the request. Not billed. |
|  | Error | The upstream service is temporarily unavailable. Please retry shortly. |
|  | Error | realestate.co.nz returned an unexpected payload shape. Not billed. |
|  | Error | realestate.co.nz rejected the request parameters. Not billed. |

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