```yaml
product: AlterLab
title: "H&M Data API: Extract Structured JSON in 2026"
category: Tutorials
comparison_context: "AlterLab is an alternative to Firecrawl, ScrapingBee, and Bright Data."
last_updated: 2026-07-17
canonical_facts:
  - "Extract publicly listed H&M product data as typed JSON via AlterLab’s structured API. Simple schema, clear cost, no bot work."
source_url: https://alterlab.io/blog/h-m-data-api-extract-structured-json-in-2026
```

This guide covers extracting publicly accessible data. Always review a site's robots.txt and Terms of Service before scraping.

## Why use H&M data?
You may need H&M product data for several practical purposes. AI models can train on up‑to‑date pricing trends. Analytics pipelines can track inventory changes across regions. Competitive intelligence tools can compare listings without manual copy‑paste. All of these use cases rely on clean, typed data that a data API can deliver.

## What data can you extract?
Publicly listed product pages expose a predictable set of fields. Typical extraction targets include:
- title – the product name displayed on the page
- price – the listed price string
- currency – the three‑letter currency code
- sku – the stock‑keeping unit identifier
- availability – in‑stock, out‑of‑stock or limited status
- rating – average customer rating when shown

These fields are consistent across H&M’s storefront layout, making them suitable for downstream processing.

## The extraction approach
Scraping raw HTML with libraries like BeautifulSoup works for simple pages but quickly breaks when H&M updates its markup. A data API removes that fragility. It fetches the page, runs the extraction, and returns validated JSON. You no longer need to maintain CSS selectors or handle layout drift. The service also handles IP rotation, CAPTCHA solving and request throttling behind the scenes.

## Quick start with AlterLab Extract API
Getting started requires only a few steps. Install the SDK, define a schema and call the extract endpoint. Full installation instructions are in the [Getting started guide](/docs/quickstart/installation).

```python title="extract_hm-com.py" {5-12}
import alterlab

client = alterlab.Client("YOUR_API_KEY")

schema = {
  "type": "object",
  "properties": {
    "title": {"type": "string", "description": "The title field"},
    "price": {"type": "string", "description": "The price field"},
    "currency": {"type": "string", "description": "The currency field"},
    "sku": {"type": "string", "description": "The sku field"},
    "availability": {"type": "string", "description": "The availability field"},
    "rating": {"type": "string", "description": "The rating field"}
  }
}

result = client.extract(
    url="https://hm.com/example-page",
    schema=schema,
)
print(result.data)
```

```bash title="Terminal"
curl -X POST https://api.alterlab.io/v1/extract \
  -H "X-API-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://hm.com/example-page",
    "schema": {"properties": {"title": {"type": "string"}, "price": {"type": "string"}, "currency": {"type": "string"}}}
  }'
```

The endpoint returns an estimated cost before execution. Cost is clamped to a minimum of $0.001 and a maximum of $0.50. Pricing details are on the [AlterLab pricing](/pricing) page. When a BYOK key is registered, the orchestration fee is 300 µ¢; otherwise the platform rate of 1000 µ¢ applies.

## Define your schema
The schema parameter tells the API which fields to return and how to type them. AlterLab validates the output against the schema and rejects malformed responses. This guarantees that downstream code can safely access `result.data["price"]` without additional parsing.

## Handle pagination and scale
High‑volume pipelines often need to process many product URLs. Use batch requests to send multiple URLs in a single POST. For asynchronous workflows, enqueue jobs and poll the status endpoint until completion. This pattern scales without hitting rate limits and keeps your balance predictable.

- **99.2%** — Extraction Accuracy
- **1.4s** — Avg Response Time
- **100%** — Typed JSON Output

1. **Define Schema** — 
2. **Call Extract API** — 
3. **Receive Typed JSON** — 

<div data-infographic="try-it" data-url="https://hm.com" data-description="Extract structured e-commerce data from H&M"></div>

## Batch and async usage example
```python title="batch_extract.py" {3-15}
import alterlab
import asyncio

client = alterlab.Client("YOUR_API_KEY")

urls = [
    "https://hm.com/product/1",
    "https://hm.com/product/2",
    "https://hm.com/product/3",
]

async def extract_one(url):
    schema = {
      "type": "object",
      "properties": {
        "title": {"type": "string"},
        "price": {"type": "string"},
        "currency": {"type": "string"},
        "sku": {"type": "string"},
        "availability": {"type": "string"}
      }
    }
    resp = client.extract(url=url, schema=schema)
    return resp.data

async def main():
    results = await asyncio.gather(*[extract_one(u) for u in urls])
    print(results)

asyncio.run(main())
```

## Key takeaways
- Public product data on H&M can be retrieved as typed

## Frequently Asked Questions

### Is there an official H&M data API?

H&M does not publish a public API for product data. AlterLab provides a compliant way to retrieve publicly accessible information as structured JSON.

### What H&M data can I extract with AlterLab?

You can extract title, price, currency, sku, availability and rating from any publicly listed product page using a defined JSON schema.

### How much does H&M data extraction cost?

Cost starts at $0.001 per request, capped at $0.50. Pricing details are on the AlterLab pricing page and depend on request volume and schema complexity.

## Related

- [AlterLab vs SerpAPI: Which Scraping API Is Better in 2026?](<https://alterlab.io/blog/alterlab-vs-serpapi-which-scraping-api-is-better-in-2026>)
- [Sephora Data API: Extract Structured JSON in 2026](<https://alterlab.io/blog/sephora-data-api-extract-structured-json-in-2026>)
- [Zara Data API: Extract Structured JSON in 2026](<https://alterlab.io/blog/zara-data-api-extract-structured-json-in-2026>)