# Zonaprop Location Tree

Returns the location tree for a search context, so you can list every neighbourhood or zone inside a province without hardcoding slugs. Pass a parent location id to walk down the tree. Results are cached for speed, and a response served from the cache costs nothing: data.cached tells you which one you got.

- **Documentation:** [https://scrappa.co/docs/zonaprop-api/zonaprop_locations](https://scrappa.co/docs/zonaprop-api/zonaprop_locations)
- **API group:** Zonaprop API
- **Endpoint:** `GET https://scrappa.co/api/zonaprop/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 |
| --- | --- | --- | --- |
| `onboarding_searcher` | integer | Yes | Required. The search context whose location tree you want. |
| `real_estate_type` | integer | No | Restrict the tree to one property type. |
| `location` | string | No | Walk down from this location id. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/zonaprop/locations?onboarding_searcher=1&real_estate_type=2&location=V1-C-1003694"
```

## Example response

```json
{
    "success": true,
    "data": {
        "popular_locations": [],
        "all_locations": [],
        "cached": false
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 404 | Not Found | No Zonaprop posting or location matches that id. This response is not billable. |
| 422 | Validation Error | A parameter is invalid, including an unknown operation, property type, currency or sort value. Invalid enum values are rejected here rather than upstream, because upstream answers them with an empty result. This response is not billable. |
| 502 | Upstream Unavailable | Zonaprop did not return a usable result for this read. This response is not billable. |
| 503 | Service Unavailable | The upstream service is temporarily unavailable. Please retry shortly. |

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