# Imovirtual Locations API Documentation

Resolve a typed place name into the location slugs used by the search endpoint. Each match returns the canonical id (e.g. braga/braga), its administrative level (district, council, parish or neighborhood), its name and full name, plus parents and children. Use the returned id as `search.location`. A query with no match is a valid empty list.

- **Documentation:** [https://scrappa.co/docs/imovirtual-api/imovirtual_locations](https://scrappa.co/docs/imovirtual-api/imovirtual_locations)
- **API group:** Imovirtual API
- **Endpoint:** `GET https://scrappa.co/api/imovirtual/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 | Place name to resolve, e.g. braga. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/imovirtual/locations?query=braga"
```

## Example response

```json
{
    "success": true,
    "data": {
        "query": "braga",
        "locations": [
            {
                "id": "braga/braga",
                "level": "council",
                "name": "Braga",
                "fullName": "Braga, Braga",
                "parents": [
                    {
                        "id": "braga",
                        "level": "district",
                        "name": "Braga"
                    }
                ]
            }
        ]
    },
    "meta": {
        "endpoint_family": "locations",
        "billable": true
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
|  | Error | The requested Imovirtual resource was not found. Not billed. |
|  | Error | Imovirtual could not be reached. Not billed. |
|  | Error | Imovirtual rejected the request. Not billed. |
|  | Error | The upstream service is temporarily unavailable. Please retry shortly. |
|  | Error | Imovirtual returned an unexpected payload shape. 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)
