# Loblaws Search API Documentation

<p><strong>Loblaws Search API</strong> searches Loblaws and PC Express products of one store. Each item has the product id, article number, brand, title, image, link, price, was price, unit price, availability and PC Optimum fields where present.</p><p>A <code>store_id</code> is required because prices and stock depend on the store. Find ids with the stores endpoint. The answer echoes facets and sorts from the source. <code>price_min</code> and <code>price_max</code> apply to the products of the requested page. <code>sort</code> orders the products of the requested page. No page is relabelled as filtered. The source has no per-item category field, so no category filter is offered. About 48 items per page. Costs 1 credit per successful request. Empty results and failed requests are free.</p>

- **Documentation:** [https://scrappa.co/docs/loblaws-api/loblaws_search](https://scrappa.co/docs/loblaws-api/loblaws_search)
- **API group:** Loblaws API
- **Endpoint:** `GET https://scrappa.co/api/loblaws/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 text, 1 to 120 characters, for example milk. |
| `store_id` | string | Yes | Public store id, for example 1099. Find ids with the stores endpoint. |
| `banner` | string | No | loblaw or nofrills (default loblaw). |
| `language` | string | No | en or fr (default en). |
| `page` | integer | No | One-based page number, 1 to 400. |
| `price_min` | number | No | Keep items at or above this price. Applies to the products of the requested page. |
| `price_max` | number | No | Keep items at or below this price. Applies to the products of the requested page. |
| `sort` | string | No | price_asc, price_desc or title_asc. Applies to the products of the requested page. |

## Example response

```json
{
    "data": {
        "from": 1,
        "page": 1,
        "items": [
            {
                "id": "20160571_EA",
                "uom": "EA",
                "link": "https://www.loblaws.ca/3-25-homogenized-milk/p/20160571_EA",
                "brand": "PC",
                "price": 7.44,
                "title": "3.25% Homogenized Milk",
                "images": [
                    "https://digital.loblaws.ca/PCX/20160571_EA/en/1/20160571_en_front_1200.png"
                ],
                "on_sale": false,
                "currency": "CAD",
                "position": 1,
                "was_price": 7.44,
                "unit_price": 0.19,
                "description": "Fresh homogenized milk",
                "availability": null,
                "display_price": "$7.44",
                "regular_price": 7.44,
                "article_number": "20160571",
                "package_sizing": "4 l, $0.19/100ml",
                "unit_price_unit": "100ml"
            }
        ],
        "query": "milk",
        "sorts": [
            {
                "code": "recommended",
                "label": "Recommended"
            }
        ],
        "banner": "loblaw",
        "facets": [],
        "language": "en",
        "per_page": 48,
        "store_id": "1099",
        "pagination": {
            "is_last": false,
            "has_more": true,
            "page_size": 48,
            "page_number": 1,
            "total_results": 130
        },
        "has_next_page": true,
        "total_results": 130
    },
    "success": true
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Validation Error | A required parameter or a value is invalid. This response is not billable. |
| 503 | Upstream Unavailable | Loblaws could not be reached. This response is not billable. 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)
