# MagicBricks Localities API Documentation

List the localities of one city as integer locality ids with names. type popular returns the most active localities with their property count; type suburbs returns the city sub-regions. These ids are the locality parameter for the search, locality and price trends endpoints. A valid city with no localities is a successful response.

- **Documentation:** [https://scrappa.co/docs/magicbricks-api/magicbricks_localities](https://scrappa.co/docs/magicbricks-api/magicbricks_localities)
- **API group:** MagicBricks API
- **Endpoint:** `GET https://scrappa.co/api/magicbricks/v1/localities`

## 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 |
| --- | --- | --- | --- |
| `city` | string | Yes | City ref-no such as 4320 for Mumbai, or a city name resolved against /cities. Example: Mumbai. |
| `type` | string | No | popular or suburbs. Defaults to popular. |
| `limit` | integer | No | Localities to return for type popular, 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/magicbricks/v1/localities?city=Mumbai&limit=5"
```

## Example response

```json
{
    "success": true,
    "data": {
        "type": "popular",
        "items": [
            {
                "locality_id": 60018,
                "name": "Andheri West, Mumbai",
                "property_count": 3919,
                "city_id": 4320
            },
            {
                "locality_id": 78910,
                "name": "Worli, Mumbai",
                "property_count": 2863,
                "city_id": 4320
            }
        ]
    },
    "meta": {
        "endpoint_family": "localities",
        "billable": true
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Validation Error | A public parameter is missing or invalid, or a city, locality or property type cannot be resolved. No upstream call is made and the response is not billable. |
| 404 | Resource Not Found | The requested MagicBricks resource does not exist. The response is not billable. |
| 503 | Unexpected Upstream Response | MagicBricks answered with a body that is not the documented shape. The response is not billable. |
| 503 | Upstream 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)
