# MagicBricks Cities API Documentation

List the cities MagicBricks covers, as integer ids with names. group top returns the top cities, popular the popular cities with a cover image, and new the full catalog grouped by region, where region names the state. These ids are the city parameter for every other endpoint.

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

## 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 |
| --- | --- | --- | --- |
| `group` | string | No | top, new or popular. Defaults to top. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/magicbricks/v1/cities?group=top"
```

## Example response

```json
{
    "success": true,
    "data": {
        "group": "top",
        "items": [
            {
                "id": 2624,
                "name": "New Delhi",
                "group": "top"
            },
            {
                "id": 4320,
                "name": "Mumbai",
                "group": "top"
            },
            {
                "id": 2951,
                "name": "Gurgaon",
                "group": "top"
            }
        ]
    },
    "meta": {
        "endpoint_family": "cities",
        "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)
