# H\&M (`datasaurus/hm-products`) Actor

Scrape products from H\&M websites. All countries and languages. Fast and efficient.

- **URL**: https://apify.com/datasaurus/hm-products.md
- **Developed by:** [datasaurus](https://apify.com/datasaurus) (community)
- **Categories:** E-commerce
- **Features:** Limited permissions
- **Stats:** 56 total users, 6 monthly users, 98.8% runs succeeded, 3 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 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

## H\&M Products Scraper

Extract structured **H\&M product data, prices, colours, sizes, images and stock availability** across H\&M website countries and languages.

Start from a website homepage or category URL, and combine multiple URLs—including different country websites—in one run. The Actor collects detailed product information and supports configurable scraping limits and product deduplication.

Checkout our other scrapers: [Zara](https://apify.com/datasaurus/zara) | [ASOS](https://apify.com/datasaurus/asos) | [Boohoo](https://apify.com/datasaurus/boohoo) | [Stradivarius](https://apify.com/datasaurus/stradivarius) | [Pull\&Bear](https://apify.com/datasaurus/pullandbear) | [MassimoDutti](https://apify.com/datasaurus/massimodutti) | [Bershka](https://apify.com/datasaurus/bershka) | [Oysho](https://apify.com/datasaurus/oysho) | [ZaraHome](https://apify.com/datasaurus/zarahome) | [Boots](https://apify.com/datasaurus/boots) | [Sephora](https://apify.com/datasaurus/sephora) | [Argos](https://apify.com/datasaurus/agros)

### What data can be extracted?

| Data | Available information |
|---|---|
| Product | Product name, ID, brand and product page URL |
| Pricing | Prices, formatted prices and discount information where available |
| Availability | Product availability, coming-soon status and size-level stock data |
| Variants | Colours, colour codes, swatches, sizes and SKUs |
| Product details | Descriptions and category information |
| Images | Product images, model images and colour-swatch images |

Available fields depend on the product and information returned by H\&M.

### Use cases

- **Catalogue analysis** — research products, categories and variants.
- **Price monitoring** — compare prices and discounts over time.
- **Availability monitoring** — track product and size availability.
- **Competitor research** — compare assortment and product information.
- **International comparison** — analyse H\&M products across regional websites.

### Supported URLs

| Scope | Example |
|---|---|
| Website | `https://www2.hm.com/en_gb/index.html` |
| Category | `https://www2.hm.com/en_gb/home/seasonal-trending/bestsellers.html` |

Use regional URLs to select the country and language. Multiple start URLs can be supplied in one run.

#### Country and language examples

| Country | Language | Website URL |
|---|---|---|
| United Kingdom | English | `https://www2.hm.com/en_gb/index.html` |
| United States | English | `https://www2.hm.com/en_us/index.html` |
| Germany | German | `https://www2.hm.com/de_de/index.html` |
| France | French | `https://www2.hm.com/fr_fr/index.html` |

These illustrate regional URL formats rather than the full country list. Combine regional homepage or category URLs in `start_urls` to collect data from multiple markets in one run. Product ranges, prices and availability can differ between markets.

### Input example

```json
{
  "start_urls": [
    {"url": "https://www2.hm.com/en_gb/index.html"},
    {"url": "https://www2.hm.com/en_gb/home/seasonal-trending/bestsellers.html"}
  ],
  "deduplicate_across_all_start_urls": true,
  "max_categories": 1,
  "max_pages": 1
}
```

This example uses small limits for an initial test. See the **Input** tab for all configuration options and limit behaviour.

### Output

Results are returned as **structured JSON**, preserving nested pricing, availability, image and variant data. A shortened example record:

```json
{
  "id": "0974175002",
  "productName": "Cotton storage basket",
  "brandName": "H&M",
  "url": "https://www2.hm.com/en_gb/productpage.0974175002.html",
  "prices": [
    {
      "priceType": "whitePrice",
      "price": 19.99,
      "minPrice": 19.99,
      "maxPrice": 19.99,
      "formattedPrice": "£19.99"
    }
  ],
  "availability": {
    "stockState": "Available",
    "comingSoon": false
  },
  "colorName": "Light beige",
  "sizes": [
    {"id": "001", "label": "NOSIZE", "stock": 2}
  ],
  "mainCatCode": "home_storageorganizing_baskets"
}
```

The example illustrates the output structure; prices and availability are sample values.

### AI agents and integrations

Connect chat clients such as **Claude and ChatGPT** to Apify through the [Apify MCP server](https://docs.apify.com/integrations/mcp) to discover and run eligible Actors from a conversation.

Structured records let agents work directly with product names, prices, colours, sizes and availability.

Example requests:

> Collect products from this H\&M category and return their names, prices and availability.

> Collect product data from these regional H\&M URLs for price and assortment comparison.

An [H\&M n8n node](https://www.npmjs.com/package/n8n-nodes-hm) is also available.

#### Official integration guides

- [AI integrations](https://docs.apify.com/integrations/ai) — connect Apify data collection with AI applications and agent frameworks.
- [Apify MCP server](https://docs.apify.com/integrations/mcp) — learn how agents discover and run eligible Actors, including setup, authentication and eligibility requirements.
- [n8n integration](https://docs.apify.com/integrations/n8n) — run Actors and retrieve their results in n8n workflows using the Apify integration.

MCP availability depends on the Actor's pricing and permissions; see the MCP guide for current requirements.

### Notes

- **Deduplication:** Enable `deduplicate_across_all_start_urls` to reduce repeated products across overlapping categories. Concurrent scraping can occasionally leave duplicates.
- **Proxies:** The Actor is configured to use datacentre proxies to help reduce IP blocking and keep request costs low.
- **Blocked requests:** H\&M may block requests with a `403` response, preventing a run from starting or completing. Rerunning may resolve the issue, but repeated blocking can persist.
- **Output format:** JSON is recommended for preserving the nested data structure.

### Support

For bugs, additional fields or supported URL requests, use the Actor's **Issues** tab. New to Apify? See the [platform documentation](https://docs.apify.com/platform).

[Browse all Datasaurus scrapers](https://apify.com/datasaurus).

# Actor input Schema

## `start_urls` (type: `array`):

Website: e.g.
https://www2.hm.com/en_gb/index.html
-see Information tab for a list of country websites-
Category page: e.g.
https://www2.hm.com/en_gb/home/seasonal-trending/bestsellers.html

## `max_categories` (type: `integer`):

Select the number of category product pages to scrape per url. This works with main page urls only.

## `max_pages` (type: `integer`):

Select the maximum number of pages to scrape per start url.

## Actor input object example

```json
{
  "start_urls": [
    {
      "url": "https://www2.hm.com/en_gb/index.html"
    },
    {
      "url": "https://www2.hm.com/en_gb/home/seasonal-trending/bestsellers.html"
    }
  ],
  "max_categories": 2,
  "max_pages": 1
}
```

# 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 = {
    "start_urls": [
        {
            "url": "https://www2.hm.com/en_gb/index.html"
        },
        {
            "url": "https://www2.hm.com/en_gb/home/seasonal-trending/bestsellers.html"
        }
    ],
    "max_pages": 1
};

// Run the Actor and wait for it to finish
const run = await client.actor("datasaurus/hm-products").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 = {
    "start_urls": [
        { "url": "https://www2.hm.com/en_gb/index.html" },
        { "url": "https://www2.hm.com/en_gb/home/seasonal-trending/bestsellers.html" },
    ],
    "max_pages": 1,
}

# Run the Actor and wait for it to finish
run = client.actor("datasaurus/hm-products").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 '{
  "start_urls": [
    {
      "url": "https://www2.hm.com/en_gb/index.html"
    },
    {
      "url": "https://www2.hm.com/en_gb/home/seasonal-trending/bestsellers.html"
    }
  ],
  "max_pages": 1
}' |
apify call datasaurus/hm-products --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,datasaurus/hm-products"
        }
    }
}
```

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/QjsNF0lJZwXqcSr74/builds/NGuPvQG7SV4VdMAvb/openapi.json
