H&M product search
Products on H&M for keywords in one market (locale such as en_us, en_gb, de_de, fr_fr, sv_se), with sort, department and facet filters (one or several combined). Each product: article id, name, brand, price, regular price and sale flag, colour (name, hex, colour groups), category, availability, new-arrival flag, markers, sizes with stock levels, other colours, link, images and raw. Also the departments and facets (each with its filter values and counts) for narrowing the search. Pass next_page back as page; null on the last page.
Every response includes credits_used: the credits this call cost.
Parameters
| name | type | description |
|---|---|---|
qrequired | string | Keywords, e.g. shirt. Example: shirt |
locale | string | Market and language as in hm.com links: en_us (default), en_gb, de_de, fr_fr, sv_se, ... Example: en_us |
sort | relevance | newest | price_asc | price_desc | relevance (default), newest, price_asc, price_desc. |
department | string | A department id from departments, e.g. men_all, ladies_all. |
filter | string | A facet value from facets (its value), e.g. colorWithNames:black_000000. Repeat filter (or join values with ||) to combine up to 10 facets, e.g. filter=colorWithNames:black_000000&filter=fits:Loose fit. |
page_size | integer | Products per page (1-100, default 36). |
page | integer | Page number. Pass next_page from the previous response. |
Every endpoint also takes fresh, raw, fields (see lean responses and caching).
Example
curl "https://api.api.sh/hm/v1/search?q=shirt" \
-H "x-api-key: $APISH_KEY" import os, requests
res = requests.get(
"https://api.api.sh/hm/v1/search",
params={"q": "shirt"},
headers={"x-api-key": os.environ["APISH_KEY"]},
timeout=120,
)
res.raise_for_status()
data = res.json() const url = new URL("https://api.api.sh/hm/v1/search");
url.searchParams.set("q", "shirt");
const res = await fetch(url, { headers: { "x-api-key": process.env.APISH_KEY } });
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const data = await res.json(); Response
A JSON object with the fields described above, plus raw (the source's own data), cached, fetched_at and credits_used. Errors return {"success": false, "error": "…"} with the HTTP status (see errors). A lookup that ran but found nothing (404) costs the price above; refused calls and errors on our side are free (what's charged).