COS stock per size
Live online stock of one COS product in one market: every size with its SKU, stock quantity and level (in_stock, low_on_stock, out_of_stock). A light read (~1 KB from the site) for watching stock. Also served at /cos/v1/availability.
Every response includes credits_used: the credits this call cost.
Part of the COS API: 13 endpoints with prices, use cases and example responses.
Parameters
| name | type | description |
|---|---|---|
url | string | A cos.com product link (its locale sets the market and language), the product's uri (name-colour-<10-digit article>), or a 10-digit article number. Example: https://www.cos.com/de-ch/women/womenswear/knitwear/cardigans/cashmere/product/brushed-cashmere-crew-neck-cardigan-blue-1341040003 |
sku | string | 10-digit article number (one colour of a product), instead of url, e.g. 1341040003. |
market | string | Market: us (default), ca, gb, ie, de, at, ch, fr, es, it, nl, dk, no, se, pl, eu, eue, au, ww, or a site locale such as de-ch. Prices, currency and stock follow the market. country is accepted as the same thing. |
Every endpoint also takes fresh, raw, fields (see lean responses and caching).
Example
curl "https://api.api.sh/cos/v1/stock?url=https%3A%2F%2Fwww.cos.com%2Fde-ch%2Fwomen%2Fwomenswear%2Fknitwear%2Fcardigans%2Fcashmere%2Fproduct%2Fbrushed-cashmere-crew-neck-cardigan-blue-1341040003" \
-H "x-api-key: $APISH_KEY" import os, requests
res = requests.get(
"https://api.api.sh/cos/v1/stock",
params={"url": "https://www.cos.com/de-ch/women/womenswear/knitwear/cardigans/cashmere/product/brushed-cashmere-crew-neck-cardigan-blue-1341040003"},
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/cos/v1/stock");
url.searchParams.set("url", "https://www.cos.com/de-ch/women/womenswear/knitwear/cardigans/cashmere/product/brushed-cashmere-crew-neck-cardigan-blue-1341040003");
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).
Example response (real call, trimmed: lists cut to 2 items, long text shortened, raw left out)
{"market": "ch","sku": "1341040003","uri": "brushed-cashmere-crew-neck-cardigan-blue-1341040003","in_stock": true,"sizes": [{"id": "24982-88679","name": "XS","sku": "1341040003002","stock_quantity": null,"stock_level": "yes","stock": "in_stock","in_stock": true},{"id": "24982-88680","name": "S","sku": "1341040003003","stock_quantity": null,"stock_level": "yes","stock": "in_stock","in_stock": true},"… 3 more"],"cached": false,"credits_used": 1}