# Milanuncios Locations API Documentation

Autocomplete for Spanish places. Returns matching localities and provinces with their ids. Use a province id (type province) as the province parameter of /search. A query without matches returns an empty locations array, which is a successful, billable response.

- **Documentation:** [https://scrappa.co/docs/milanuncios-api/milanuncios_locations](https://scrappa.co/docs/milanuncios-api/milanuncios_locations)
- **API group:** Milanuncios API
- **Endpoint:** `GET https://scrappa.co/api/milanuncios/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, 2 to 60 characters, for example madrid. |

## Example request

```bash
#!/bin/bash

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

## Example response

```json
{
    "success": true,
    "data": {
        "locations": [
            {
                "id": 44,
                "name": "Madrid (Localidad)",
                "slug": "madrid",
                "type": "locality",
                "region_id": 28,
                "province_id": 28,
                "city_id": 44
            },
            {
                "id": 28,
                "name": "Madrid (Provincia)",
                "slug": "madrid",
                "type": "province",
                "region_id": 28,
                "province_id": 28
            }
        ]
    },
    "meta": {
        "endpoint_family": "locations",
        "billable": true
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 404 | Not Found | The requested ad or car make was not found or has expired. This response is not billable. |
| 422 | Validation Error | A parameter is invalid, including a sort newest or oldest on a real estate category or an offset + limit above 10000. This response is not billable. |
| 503 | Service Unavailable | The service could not obtain a complete result from Milanuncios. This response is not billable. |

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