# BRACK.CH Product Search API Documentation

`GET /api/brack/search` returns BRACK.CH products as structured JSON.

## What you get

Each item has `id`, `sku`, `title`, `brand`, `price`, `original_price`, `discount`, `discount_percent`, `currency`, `in_stock`, `stock_count`, `rating`, `review_count`, `image`, `breadcrumbs`, `states`, `labels` and `flags`. Pass `url` or `id` unchanged to the product route.

## Prices and pages

Prices are numbers in CHF. `original_price` is the published list price and `discount` the saving in CHF. A page holds up to 48 products in storefront order. Filters are applied upstream and checked again on the result: no returned item breaks a requested brand, price, availability or offer filter. Ids repeated by the storefront are removed. An empty page is never billed.

## Credits

A successful request with data costs **1 credit**. Errors, challenges and empty pages cost nothing. The response shows the charge in `meta.credits_charged`.

- **Documentation:** [https://scrappa.co/docs/brack-api/brack_search](https://scrappa.co/docs/brack-api/brack_search)
- **API group:** BRACK.CH API
- **Endpoint:** `GET https://scrappa.co/api/brack/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. |
| `page` | integer | No | Result page of 48 products, from 1. |
| `sort` | string | No | priceasc, pricedesc, newdesc, stockdesc, rankasc or nameasc. |
| `brand` | string | No | Exact manufacturer name. |
| `min_price` | number | No | Lowest price in CHF. |
| `max_price` | number | No | Highest price in CHF. |
| `availability` | boolean | No | Only products the storefront lists as available. |
| `offer` | string | No | offer, trade, sale, new or another published offer type. |
| `attribute` | array | No | Attribute facet as slug:value. Repeatable. |

## Example request

```bash
#!/bin/bash

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

## Example response

```json
{
    "success": true,
    "query": "iphone",
    "category": null,
    "items": [
        {
            "position": 1,
            "id": "1487423",
            "sku": "1487423",
            "title": "Example iPhone case",
            "brand": "ExampleBrand",
            "url": "https://www.brack.ch/example-iphone-case-1487423",
            "price": 13.95,
            "original_price": 29.9,
            "discount": 15.95,
            "discount_percent": 53,
            "currency": "CHF",
            "in_stock": true,
            "stock_count": 3,
            "rating": 4,
            "review_count": 1,
            "image": "https://assets.brack.ch/images2/example_xxl.jpg",
            "breadcrumbs": [],
            "states": [],
            "labels": [],
            "flags": []
        }
    ],
    "page": 1,
    "page_size": 48,
    "next_page": 2,
    "sort": null,
    "applied_filters": [],
    "meta": {
        "endpoint_family": "brack-search",
        "billable": true,
        "attempts": 1,
        "credits_charged": 1,
        "unavailable_reason": []
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Validation Error | A parameter is missing, unknown, conflicting or unusable. Unknown parameters are rejected, never ignored. Non-billable. |
| 503 | Upstream Unavailable | The storefront could not be reached, answered with a challenge, or changed its 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)
