# Albert Heijn Product Search Scraper (`stealth_mode/ah-product-search-scraper`) Actor

Scrape Albert Heijn (ah.nl) product listings, including prices, discounts, Nutri-Score, brands, and availability, by URL or keyword search. Ideal for price monitoring, grocery market research, and e-commerce analytics.

- **URL**: https://apify.com/stealth_mode/ah-product-search-scraper.md
- **Developed by:** [Stealth mode](https://apify.com/stealth_mode) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.50 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Albert Heijn Product Search Scraper: Extract Grocery Data from ah.nl

***

### What Is Albert Heijn (ah.nl)?

Albert Heijn is the largest supermarket chain in the Netherlands, and its website ah.nl is the online channel where shoppers browse, search and order groceries across categories such as bakery, dairy, beverages and household goods. Each category page lists dozens of products with prices, promotions and availability information. For anyone who needs to track this data over time, copying it by hand is slow and error-prone. The **Albert Heijn Product Search Scraper** automates collection from product listing pages and returns structured records that are ready for analysis.

***

### Overview

The scraper reads product search and category listing pages on ah.nl and converts each product card into a structured record. It is designed for:

- **Price analysts** monitoring weekly price changes and promotions
- **Retail researchers** comparing assortments across categories
- **Nutrition and health researchers** analyzing Nutri-Score distributions
- **E-commerce developers** building comparison tools or product feeds

The main strengths are flexible input (direct category URLs or keyword search), control over the number of items per page, optional proxy support for stable collection, and the option to keep raw source data for auditing.

***

### Input Format

The scraper accepts a JSON configuration with two possible modes. You can use either mode, but **do not combine them in the same run**. When `urls` is filled, the search filters are disabled.

#### Mode 1: Scrape by URLs

```json
{
  "urls": [
    "https://www.ah.nl/producten/1355/bakkerij"
  ],
  "ignore_url_failures": true,
  "max_items_per_url": 20
}
```

#### Mode 2: Scrape by Search Filters

```json
{
  "keyword": "ah",
  "sort_by": "price",
  "page": 1,
  "max_items_per_url": 200
}
```

#### Field Reference

| Field | Description |
|---|---|
| `urls` | List of Albert Heijn product listing URLs. Leave empty when using keyword search. |
| `keyword` | Search term used to find products, such as `"melk"` or `"brood"` |
| `sort_by` | Sort order: `""` (relevance), `"price"` (low to high), `"-price"` (high to low), or `"nutriscore"` |
| `page` | Page number to start scraping from (default is usually `1`) |
| `max_items_per_url` | Maximum number of products collected per URL or search. Prefilled at `20`. |
| `ignore_url_failures` | If `true`, the run continues when some URLs fail. Prefilled as `true`. |
| `include_raw_data` | If `true`, adds unprocessed website data to the output. Default is `false`. |

> **Tip:** Use `max_items_per_url` to control run cost and time. Start with a small value like `20` to test your setup before scaling up.

***

### Output Format

Each product returns one record. The fields below are grouped by purpose.

#### Identification

| Field | Meaning |
|---|---|
| `id` | Unique Albert Heijn product identifier |
| `title` | Product name as displayed on the listing |
| `brand` | Brand name, if shown |
| `product_url` | Direct link to the product page |
| `sales_unit_size` | Package size or quantity (e.g., `500 g`, `6 stuks`) |
| `shop_type` | Shop channel type for the product |

#### Pricing

| Field | Meaning |
|---|---|
| `price` | Current selling price (numeric) |
| `was_price` | Previous price before the current offer, if any |
| `currency` | Currency code, typically `EUR` |
| `list_price` | Standard list price |
| `discount` | Discount details as an object (amount, type, validity) |
| `promotion_labels` | Array of promotion badges shown on the product (e.g., "2 for 3") |

#### Nutrition & Quality

| Field | Meaning |
|---|---|
| `nutri_score` | Nutri-Score grade (A to E) indicating nutritional quality |
| `highlight` | Highlighted attribute or marketing label shown on the product |

#### Availability

| Field | Meaning |
|---|---|
| `available_in_store` | Whether the product is available in physical stores |
| `is_orderable` | Whether the product can be ordered online |
| `max_units` | Maximum quantity per order |
| `availability_label` | Human-readable availability status |

#### Product Classification

| Field | Meaning |
|---|---|
| `is_sponsored` | Whether the placement is paid or sponsored |
| `is_sample` | Whether the item is a sample product |
| `is_medicine` | Whether the product is classified as medicine |
| `is_medical_device` | Whether the product is classified as a medical device |
| `taxonomy_ids` | Category identifiers linking the product to the site taxonomy |
| `external_shop` | Details if the product is sold through an external shop |

#### Variants & Media

| Field | Meaning |
|---|---|
| `has_variants` | Whether the product has multiple variants |
| `variant` | Details of the selected variant |
| `variants` | List of all available variants |
| `image_count` | Number of product images |
| `image_urls` | Array of product image URLs |

#### Raw Data

| Field | Meaning |
|---|---|
| `raw_data` | Unprocessed source data (only included when `include_raw_data` is `true`) |

#### Sample Output (annotated)

```json
{
  "id": 440336,
  "title": "AH Roasted ham",
  "brand": "AH",
  "product_url": "https://www.ah.nl//producten/product/wi440336/ah-roasted-ham",
  "sales_unit_size": "ca. 110 g",
  "shop_type": "AH",
  "price": 3.49,
  "was_price": 3.49,
  "currency": "EUR",
  "list_price": null,
  "discount": null,
  "promotion_labels": [],
  "nutri_score": "D",
  "available_in_store": true,
  "is_orderable": true,
  "max_units": null,
  "availability_label": null,
  "is_sponsored": false,
  "is_sample": false,
  "is_medicine": false,
  "is_medical_device": false,
  "highlight": null,
  "external_shop": null,
  "taxonomy_ids": [
    5481,
    19914,
    19915
  ],
  "has_variants": true,
  "variant": {
    "label": "los",
    "type": "PRIMARY",
    "__typename": "ProductVariant"
  },
  "variants": [],
  "image_count": 2,
  "image_urls": [
    "https://static.ah.nl/dam/product/AHI_43545239393233353337?revLabel=1&rendition=200x200_WEBP&fileType=binary",
    "https://static.ah.nl/dam/product/AHI_547a347461346c4454662d784a69345f49354c733351?revLabel=1&rendition=200x200_WEBP&fileType=binary"
  ],
  "raw_data": null,
  "from_url": "https://www.ah.nl/zoeken?query=ah"
}
```

> **Note:** Field values depend on what ah.nl displays at the time of scraping. Some fields may be empty for certain products.

***

### How to Use

1. **Find a listing URL** — Open a category page on ah.nl (for example, the bakery section) and copy the URL from the browser address bar.
2. **Configure the input** — Add the URL to the `urls` array and set `max_items_per_url` to control volume.
3. **Enable proxy (optional)** — Use a `RESIDENTIAL` proxy with country `NL` if you encounter blocking or incomplete results.
4. **Run the scraper** — Start the run and check the log for failed URLs.
5. **Export results** — Download the dataset as JSON, CSV or Excel.

**Tips and best practices:**

- Use `sort_by: "price"` or `"-price"` when you need a price-ordered sample.
- Run scheduled collections at consistent times of day, since promotions on ah.nl typically change weekly.
- Keep `include_raw_data` disabled unless you need to audit the source data, as it increases output size.

**Common issues:**

- **Empty results:** Confirm the URL is a product listing page and not a single product page or a homepage.
- **Missing prices or discounts:** Some products show no promotion; treat empty fields as "not offered" rather than as errors.
- **Partial runs:** Keep `ignore_url_failures` enabled so one failing URL does not stop the whole run.

***

### Use Cases & Business Value

- **Price monitoring:** Track how Albert Heijn prices in a category change over time
- **Promotion analysis:** Measure how often products carry discounts and which promotion labels are common
- **Assortment research:** Compare product ranges across categories such as bakery, dairy or snacks
- **Health research:** Study the distribution of Nutri-Score grades across grocery categories
- **Competitive benchmarking:** Compare Albert Heijn prices against other Dutch retailers

Automating collection saves hours of manual work and produces consistent, machine-readable data that fits directly into spreadsheets, databases or BI dashboards.

***

### Conclusion

The **Albert Heijn Product Search Scraper** gives analysts, researchers and developers a practical way to collect structured grocery data from ah.nl. With price, promotion, nutrition and availability fields in a single record, it supports everything from weekly price tracking to academic studies. Start with one category URL, verify the output, and then scale to more listings.

> **Legal note:** Make sure your use of scraped data complies with the ah.nl Terms of Use and applicable EU data protection rules, including the GDPR where personal data is involved. Product and price data should be used responsibly and at a reasonable request rate.

# Actor input Schema

## `urls` (type: `array`):

Add the URLs of the product search list urls you want to scrape. You can paste URLs one by one, or use the Bulk edit section to add a prepared list.

## `ignore_url_failures` (type: `boolean`):

If true, the scraper will continue running even if some URLs fail to be scraped.

## `keyword` (type: `string`):

Enter the keyword to search for items

## `sort_by` (type: `string`):

Sort items by options

## `page` (type: `integer`):

Specify the page number to start scraping from

## `max_items_per_url` (type: `integer`):

The maximum number of items to scrape per URL.

## `include_raw_data` (type: `boolean`):

If true, the scraper will include raw data from website before cleaning in the output.

## Actor input object example

```json
{
  "urls": [
    "https://www.ah.nl/producten/1355/bakkerij"
  ],
  "ignore_url_failures": true,
  "max_items_per_url": 20,
  "include_raw_data": false
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "urls": [
        "https://www.ah.nl/producten/1355/bakkerij"
    ],
    "ignore_url_failures": true,
    "max_items_per_url": 20,
    "include_raw_data": false
};

// Run the Actor and wait for it to finish
const run = await client.actor("stealth_mode/ah-product-search-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "urls": ["https://www.ah.nl/producten/1355/bakkerij"],
    "ignore_url_failures": True,
    "max_items_per_url": 20,
    "include_raw_data": False,
}

# Run the Actor and wait for it to finish
run = client.actor("stealth_mode/ah-product-search-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "urls": [
    "https://www.ah.nl/producten/1355/bakkerij"
  ],
  "ignore_url_failures": true,
  "max_items_per_url": 20,
  "include_raw_data": false
}' |
apify call stealth_mode/ah-product-search-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,stealth_mode/ah-product-search-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/RGlHMTYp974duTmS8/builds/fsd7HkeWdGf3zWYhb/openapi.json
