# Blocket Bostad Location Autocomplete API Documentation

Scrappa's `GET /api/blocket-bostad/location-autocomplete` finds the Blocket Bostad areas that `GET /api/blocket-bostad/search` accepts in `area`, from the start of a name.

## What you get

Up to ten Swedish areas with `name`, `parent` (the city of a district), `country_code` and `identifier`. Names match from the start, also of a later word, and ignore case and accents: `go` finds Göteborg.

## Coverage

The list holds the areas Blocket Bostad publishes for search: cities, municipalities, counties and Stockholm districts in Sweden, It is refreshed daily. Areas outside Sweden are not listed.

- **Documentation:** [https://scrappa.co/docs/blocket-bostad-api/blocket_bostad_location_autocomplete](https://scrappa.co/docs/blocket-bostad-api/blocket_bostad_location_autocomplete)
- **API group:** Blocket Bostad API
- **Endpoint:** `GET https://scrappa.co/api/blocket-bostad/location-autocomplete`

## 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 |
| --- | --- | --- | --- |
| `q` | string | Yes | Start of an area name, at least 2 characters. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/blocket-bostad/location-autocomplete?q=g%C3%B6"
```

## Example response

```json
{
    "success": true,
    "query": "g\u00f6",
    "total": 1,
    "locations": [
        {
            "name": "G\u00f6teborg",
            "parent": null,
            "country_code": "SE",
            "identifier": "se/g\u00f6teborg"
        }
    ],
    "meta": {
        "endpoint_family": "location_autocomplete",
        "billable": true,
        "source": "cached_area_list"
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Validation Error | A query parameter is missing, unknown or unusable. Unknown parameters are rejected, never ignored. Non-billable. |
| 503 | Upstream Unavailable | Blocket Bostad could not be reached after retries, answered with an error, or its area list is not available (`upstream_unavailable`, `upstream_blocked`, `parser_drift`, `area_list_unavailable`). Retryable and never billed. Clients are never rate limited. |

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