# Bayut Locations API Documentation

Look up the Bayut location tree by name: emirates, communities and buildings, with the numeric id used by the search location filter, the public slug and url, the parent hierarchy, the live listing count and the coordinates. A valid empty result is a successful response.

- **Documentation:** [https://scrappa.co/docs/bayut-api/bayut_locations](https://scrappa.co/docs/bayut-api/bayut_locations)
- **API group:** Bayut API
- **Endpoint:** `GET https://scrappa.co/api/bayut/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 |
| --- | --- | --- | --- |
| `query` | string | Yes | Location name, e.g. Dubai Marina. |
| `level` | integer | No | 1 = emirate, 2 = community, 3 = building. |
| `page` | integer | No | Zero-based page number. Defaults to 0. |
| `limit` | integer | No | Locations per page, 1 to 50. Defaults to 20. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/bayut/locations?query=Dubai+Marina"
```

## Example response

```json
{
    "success": true,
    "data": {
        "locations": [
            {
                "external_id": "5003",
                "name": "Dubai Marina",
                "slug": "/dubai/dubai-marina",
                "url": "https://www.bayut.com/dubai/dubai-marina",
                "type": "neighbourhood",
                "ad_count": 10083,
                "has_children": true,
                "level": 2,
                "hierarchy": [
                    "UAE",
                    "Dubai",
                    "Dubai Marina"
                ],
                "latitude": 25.083189748036,
                "longitude": 55.14430056087
            }
        ]
    },
    "meta": {
        "endpoint_family": "locations",
        "billable": true,
        "pagination": {
            "page": 0,
            "limit": 20,
            "total": 778,
            "has_more": true,
            "next_page": 1,
            "truncated": false
        }
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Validation Error | A public parameter or range is invalid. This response is not billable. |
| 502 | Invalid Source Response | Bayut returned an unexpected response shape. This response is not billable. |
| 503 | Service Unavailable | The transport or Bayut was unavailable after retries. This response is not billable and is safe to retry. |

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