# Hagebau Product Search API Documentation

`GET /api/hagebau/search?query=...` returns hagebau.de products as structured JSON. Each item has `id` (`anP...`), `brand.name`, `ean`, `sku`, `features[]`, full-size `images[]`, numeric `ratings`, availability and a price object. Page (`p`), sorting (`sortBy`) and `filter[...]` are honoured. The dotted `filter.` form stays accepted as an alias.

## Credits

A successful request costs **1 credit**. Errors and missing products cost nothing. The response shows the charge in `meta.credits_charged`.

- **Documentation:** [https://scrappa.co/docs/hagebau-api/hagebau_search](https://scrappa.co/docs/hagebau-api/hagebau_search)
- **API group:** Hagebau API
- **Endpoint:** `GET https://scrappa.co/api/hagebau/search`

## 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 | Search words, such as bohrmaschine. |
| `p` | integer | No | Result page, default 1. Unpublished pages return 422 and cost nothing. |
| `sortBy` | string | No | One of ft, ct, price, pricedesc, reviewrating. |
| `filter[category]` | string | No | Category filter. |
| `filter[manufacturer]` | string | No | Brand or manufacturer filter. |
| `filter[from_PRICE]` | number | No | Minimum price in EUR. |
| `filter[to_PRICE]` | number | No | Maximum price in EUR. |
| `filter[ITEM_TYPE]` | string | No | Item type filter. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/hagebau/search?query=bohrmaschine"
```

## Example response

```json
{
    "success": true,
    "site": "de",
    "query": "bohrmaschine",
    "result_count": 1,
    "items": [
        {
            "position": 1,
            "id": "anP7000051228",
            "name": "Bohrmaschine",
            "price_value": 255,
            "currency": "EUR"
        }
    ],
    "page": 1,
    "meta": {
        "endpoint_family": "hagebau-search",
        "billable": true,
        "credits_charged": 1
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Page Not Available | That page is not published (`unsupported_page`). Non-billable. |
| 422 | Validation Error | A parameter is missing, unknown or malformed. Unknown parameters are rejected, never ignored. Non-billable. |
| 503 | Upstream Unavailable | The upstream could not be reached or changed its embedded page shape. 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)
