# B&H Photo Search API Documentation

<p><strong>B&H Photo Search API Documentation</strong> Search public B&H products by keyword or category id. Filter by price range, brand, sort and page. Every item has the product id, name, brand, sale price, original price, discount, rating, review count, availability and a full-size photo. Product ids work unchanged in the product endpoint. The answer has the total result count and the page count. Every requested filter is checked on every item. A one-word query that B&H answers with a category page is followed to the product list of the matching category. Queries that return only editorial articles get 422 NO_PRODUCTS and are not billed. 1 credit per successful request. An empty result and a failed request are not billed. Not affiliated with B&H Photo.</p>

- **Documentation:** [https://scrappa.co/docs/bhphoto-api/bhphoto_search](https://scrappa.co/docs/bhphoto-api/bhphoto_search)
- **API group:** B&H Photo API
- **Endpoint:** `GET https://scrappa.co/api/bhphoto/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 | No | Search words, up to 100 characters. Required without category. |
| `category` | integer | No | B&H category id, the number after /ci/ in a B&H category url, for example 60095 Mini PCs, 9811 Digital Cameras or 16158 Mirrorless Cameras. Required without query. |
| `sort` | string | No | relevance (default), price_asc or rating. price_asc sorts the fetched page by ascending price. rating sorts by rating then review count, unrated last. |
| `min_price` | number | No | Lowest price. |
| `max_price` | number | No | Highest price. Must not be lower than min_price. |
| `brand` | string | No | Brand name filter, checked on every item. |
| `page` | integer | No | Page number, 1 or higher. |
| `site` | string | No | bh only. Other sites return 422. |

## Example response

```json
{
    "data": {
        "site": "bh",
        "items": [
            {
                "id": "1948568-REG",
                "mpn": "3382C002",
                "sku": "1948568",
                "url": "https://www.bhphotovideo.com/c/product/1948568-REG/canon_eos_r6_mirrorless_camera.html",
                "brand": "Canon",
                "image": "https://static.bhphoto.com/images/images2500x2500/1948568_1.jpg",
                "price": {
                    "amount": 1999,
                    "currency": "USD"
                },
                "title": "Canon EOS R6 Mirrorless Camera",
                "images": [
                    "https://static.bhphoto.com/images/images2500x2500/1948568_1.jpg"
                ],
                "rating": 4.8,
                "in_stock": true,
                "availability": "In Stock",
                "review_count": 312,
                "original_price": {
                    "amount": 2299,
                    "currency": "USD"
                },
                "discount_percent": 13
            }
        ],
        "filters": {
            "sort": "relevance",
            "brand": null,
            "query": "camera",
            "category": null,
            "max_price": null,
            "min_price": null
        },
        "currency": "USD",
        "pagination": {
            "has_more": true,
            "per_page": 28,
            "total_items": 4229,
            "total_pages": 152,
            "current_page": 1,
            "matched_items": 28,
            "page_item_count": 28
        }
    },
    "meta": {
        "credits": 1,
        "billable": true,
        "endpoint_family": "search"
    },
    "success": true
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Validation Error | A query parameter is missing or invalid. This response is not billable. |
| 422 | No Product List | B&H has no product list for this query, filters and page. When the query or category opens a B&H category page without products (for example query=monitor), error.categories lists that page's categories with id, name, group and url. Repeat the search with one of these ids as category. This response is not billable. |
| 503 | Upstream Unavailable | The upstream service is temporarily unavailable. Please retry shortly. |

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