# BoligPortal Postal Code API Documentation

Scrappa's `GET /api/boligportal/postal-code` returns the town name for a four-digit Danish postal code.

## Unknown codes

A code without a town returns `404` and is not billed.

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

## 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 |
| --- | --- | --- | --- |
| `code` | string | Yes | Four-digit Danish postal code. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/boligportal/postal-code?code=2100"
```

## Example response

```json
{
    "success": true,
    "postal_code": "2100",
    "postal_town": "K\u00f8benhavn \u00d8",
    "meta": {
        "endpoint_family": "postal_code",
        "billable": true
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 404 | Not Found | BoligPortal has nothing for this request (`not_found`): an ad that is gone, a list of ids where none exists, or a postal code without a town. 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)
