# BoligPortal Result Count API Documentation

Scrappa's `GET /api/boligportal/count` returns how many BoligPortal rentals match the same filters as search, without loading the homes.

## Exactness

The count comes from BoligPortal. When you filter by rooms, BoligPortal rounds half rooms, so the count can include homes that search then drops; `meta.count_exact` is false in that case. Without a rooms filter it is exact.

## Filters

All search filters except `order` and `page`. Unknown parameters are rejected with `422`.

- **Documentation:** [https://scrappa.co/docs/boligportal-api/boligportal_count](https://scrappa.co/docs/boligportal-api/boligportal_count)
- **API group:** BoligPortal API
- **Endpoint:** `GET https://scrappa.co/api/boligportal/count`

## 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 |
| --- | --- | --- | --- |
| `location` | string | No | City such as København, Aarhus or Odense (not case sensitive). Unknown cities return 422 with suggestions. |
| `district` | string | No | District inside the city, for example valby or frederiksberg. |
| `area` | string | No | Neighbourhood inside the district. |
| `street` | string | No | Street name, for example Gammel Køge Landevej. |
| `type` | string | No | apartment, house, townhouse or room. Comma-separated. |
| `min_rooms` | number | No | Minimum number of rooms, halves allowed, for example 1.5. Applied exactly: the platform rounds, so results are checked again. |
| `max_rooms` | number | No | Maximum number of rooms, halves allowed. |
| `min_size` | integer | No | Minimum size in square metres. |
| `max_size` | integer | No | Maximum size in square metres. |
| `min_rent` | integer | No | Minimum monthly rent in DKK, without extra costs. |
| `max_rent` | integer | No | Maximum monthly rent in DKK, without extra costs. |
| `min_rental_period` | integer | No | Minimum rental period in months. |
| `available_before` | string | No | Latest move-in date, YYYY-MM-DD. |
| `min_lat` | number | No | South edge of a bounding box. Send all four box values or none. |
| `max_lat` | number | No | North edge of a bounding box. |
| `min_lng` | number | No | West edge of a bounding box. |
| `max_lng` | number | No | East edge of a bounding box. |
| `pet_friendly` | boolean | No | true to require the feature. false or omitted applies no filter. Homes where the feature is unknown are left out. |
| `furnished` | boolean | No | true to require the feature. false or omitted applies no filter. Homes where the feature is unknown are left out. |
| `balcony` | boolean | No | true to require the feature. false or omitted applies no filter. Homes where the feature is unknown are left out. |
| `parking` | boolean | No | true to require the feature. false or omitted applies no filter. Homes where the feature is unknown are left out. |
| `elevator` | boolean | No | true to require the feature. false or omitted applies no filter. Homes where the feature is unknown are left out. |
| `shareable` | boolean | No | true to require the feature. false or omitted applies no filter. Homes where the feature is unknown are left out. |
| `student_only` | boolean | No | true to require the feature. false or omitted applies no filter. Homes where the feature is unknown are left out. |
| `senior_friendly` | boolean | No | true to require the feature. false or omitted applies no filter. Homes where the feature is unknown are left out. |
| `social_housing` | boolean | No | true to require the feature. false or omitted applies no filter. Homes where the feature is unknown are left out. |
| `newbuild` | boolean | No | true to require the feature. false or omitted applies no filter. Homes where the feature is unknown are left out. |
| `electric_charging_station` | boolean | No | true to require the feature. false or omitted applies no filter. Homes where the feature is unknown are left out. |
| `dishwasher` | boolean | No | true to require the feature. false or omitted applies no filter. Homes where the feature is unknown are left out. |
| `washing_machine` | boolean | No | true to require the feature. false or omitted applies no filter. Homes where the feature is unknown are left out. |
| `dryer` | boolean | No | true to require the feature. false or omitted applies no filter. Homes where the feature is unknown are left out. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/boligportal/count?location=Aarhus&type=apartment&max_rent=9000"
```

## Example response

```json
{
    "success": true,
    "result_count": 412,
    "applied_filters": {
        "location": "aarhus",
        "type": [
            "apartment"
        ],
        "max_rent": 9000
    },
    "meta": {
        "endpoint_family": "count",
        "count_exact": true,
        "billable": true
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Unknown Location | The `location` is not a BoligPortal city (`unknown_location`). BoligPortal would answer an unknown city with zero results, so the request is rejected with up to five suggestions. Non-billable. |
| 422 | Validation Error | A query parameter is missing, unknown or unusable. Unknown parameters are rejected, never ignored. Sale, bathroom and agency filters do not exist. Non-billable. |
| 503 | Upstream Unavailable | BoligPortal could not be reached after retries, blocked the request, returned another page than asked for, or returned a page this API could not read (`upstream_unavailable`, `upstream_blocked`, `offset_mismatch`, `parser_drift`, `transport_unavailable`, `no_exit_available`). 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)
