# Grainger Scraper — item numbers to prices, specs (`xhrdev/grainger-scraper`) Actor

Look up Grainger item numbers past DataDome and get today's web price, brand, model, tech specs, weight and the discontinued flag. No browser. Powered by xhr.dev.

- **URL**: https://apify.com/xhrdev/grainger-scraper.md
- **Developed by:** [xhrdev](https://apify.com/xhrdev) (community)
- **Categories:** E-commerce
- **Stats:** 3 total users, 2 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$15.00 / 1,000 product looked ups

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

**Look up [Grainger](https://www.grainger.com) item numbers past DataDome and get today's price.** Hand it the item numbers you already hold — the codes Grainger prints as "Item #" — and it returns web price, unit of measure, brand, model, full technical specifications, shipping weight, category path, images and the discontinued flag.

This is built as a **lookup**, not a crawl, because that is how people actually use Grainger: you have a bill of materials or a parts list, and you want current pricing and specs against it.

No browser is launched. The DataDome challenge is solved as plain HTTP by [xhr.dev](https://xhr.dev), so a lookup costs a few hundred milliseconds of compute instead of the several seconds and gigabyte of RAM a stealth browser needs.

### Quickstart

Paste this into the input and press **Run**.

```json
{
  "itemIds": [
    "48TK84",
    "1YHL8"
  ]
}
```

### Item numbers only — no keyword search

**Search and category URLs are rejected**, deliberately. Grainger builds its result grids in the browser, so the HTML an HTTP scraper receives contains **no products at all**. An Actor that accepted those URLs would fetch them successfully, parse nothing, and return you empty pages that look like a bug.

Rather than do that, they are refused at the start of the run with an explanation. If you need to go from keyword to item number, do the discovery step elsewhere and bring the numbers here.

### Input

| Field | Type | Default | Description |
| --- | --- | --- | --- |
| `itemIds` | string\[] | `["48TK84"]` | The item numbers to look up — the code Grainger prints as "Item #". This is the main way to use this Actor. |
| `startUrls` | array | `[]` | Grainger `/product/` URLs, if you hold links rather than numbers. Search and category URLs are not accepted (see below). |
| `maxItems` | integer | `200` | Stop once this many products have been scraped. |
| `proxyConfiguration` | object | Apify RESIDENTIAL | Which proxy to route through. Leave it on residential — see [Proxies](#proxies-read-this-before-changing-anything). |
| `maxRetries` | integer | `3` | Attempts per page before giving up on it, 1–5. Each attempt takes a fresh proxy session. |
| `timeoutSecs` | integer | `120` | How long one page — challenge, solve and all — may take before the attempt fails. 10–300. |
| `maxConcurrency` | integer | `4` | Pages worked on at once, 1–10. |

Nothing is required — the defaults run a real search out of the box.

### Output

One dataset item per product. Fields the page does not carry are omitted rather than returned as `null`.

| Field | Type | Description |
| --- | --- | --- |
| `sku` | string | The Grainger item number you asked for. |
| `name` | string | Full product name. |
| `url` | string | Product page URL. |
| `brand` | string | Manufacturer, e.g. `3M`. |
| `model` | string | Manufacturer model number. |
| `productId` | string | Grainger internal product ID. |
| `description` | string | Short product description. |
| `price` | number | Current public web price. **Omitted** when Grainger shows no public price — discontinued items and quote-only lines. Check for its absence rather than assuming zero. |
| `currency` | string | Always `USD`. |
| `priceLabel` | string | What kind of price it is, e.g. `Web Price`. |
| `unitOfMeasure` | string | What the price buys — `each`, `pk`, `cs`. **Read this before comparing prices.** |
| `isDiscontinued` | boolean | Whether Grainger has discontinued the item. |
| `shippingWeight` | string | Shipping weight as printed, e.g. `0.11 lbs`. |
| `category` | string | Full category path, e.g. `Safety / Eye Protection and Accessories / Safety Glasses`. |
| `specifications` | object | The technical spec table as key/value pairs. Contents vary by product type. |
| `images` | string\[] | Product image URLs. |

#### Example record

Taken verbatim from a live run. Long text and image lists are trimmed here for readability; the real record carries them in full.

```json
{
  "sku": "48TK84",
  "name": "3M Safety Glasses: Clear Lens Color, Frameless, Scotchgard™ Anti-Fog, Black/Green Frame Color",
  "url": "https://www.grainger.com/product/48TK84",
  "brand": "3M",
  "model": "S1201SGAF-KT",
  "productId": "46181802",
  "description": "3M, Clear Lens Color, Safety Glasses",
  "price": 28.91,
  "currency": "USD",
  "priceLabel": "Web Price",
  "unitOfMeasure": "each",
  "isDiscontinued": false,
  "shippingWeight": "0.11 lbs",
  "category": "Safety / Eye Protection and Accessories / Safety Glasses",
  "specifications": {
    "Item": "48TK84",
    "Lens Color": "Clear",
    "Frame Color": "Black/Green",
    "Lens Properties": "Advanced Anti-Fog",
    "Catalog Page": "1585",
    "Brand": "3M"
  },
  "images": [
    "https://static.grainger.com/rp/s/is/image/Grainger/48TK84_AS02"
  ]
}
```

#### A discontinued item, which carries no price

```json
{
  "sku": "1YHL8",
  "name": "Locknut Plier: 2 3/8 in Jaw Lg, 7/8 in Jaw Wd, 1 1/2 in Max Jaw Opening, 8 1/2 in Overall Lg",
  "url": "https://www.grainger.com/product/1YHL8",
  "brand": "CHANNELLOCK",
  "model": "960",
  "productId": "27112115",
  "description": "2 3/8 in Jaw Lg, Locknut Plier",
  "currency": "USD",
  "isDiscontinued": true,
  "shippingWeight": "0.33 lbs",
  "specifications": {
    "Item": "1YHL8",
    "Catalog Page": "N/A",
    "Brand": "CHANNELLOCK",
    "Product Description": "Notched jaws in locknut pliers provide a firm grip to tighten and loosen conduit locknuts and caps. Serrations in the jaws debur the outside of conduit, and sharp edges on the nose ream the inside of conduit. The pliers' long, slim nose reaches deep into electrical boxes and other tight spaces to grab wire and pull fish tape."
  },
  "images": [
    "https://static.grainger.com/rp/s/is/image/Grainger/1YHL8_AS01"
  ]
}
```

### Pricing

**$15.00 per 1,000 lookups** (`product-detail`, $0.015 each), charged only on products actually delivered. An item number that fails to resolve is not charged.

A discontinued item **is** charged: the page parsed and you got a real answer — name, brand, model, specs and `isDiscontinued: true` — which is usually exactly what you needed to know. It simply carries no price.

A 500-part bill of materials priced end to end costs about **$7.50**, plus Apify platform costs — mostly residential proxy traffic, on the order of $0.25–0.75 for a run that size.

### Proxies: read this before changing anything

Set this to Apify **RESIDENTIAL** and leave it there. It is not a style preference, and it is the single most common reason a run comes back empty.

DataDome decides *which* challenge to serve based on the exit IP. We measured this from Apify against twelve DataDome-protected sites, same code, minutes apart:

| Exit IP | Challenge served | Result |
| --- | --- | --- |
| Datacenter (Apify default, or no proxy) | The hard captcha | **3 of 12 sites passed** |
| Residential | Interstitial, or no challenge at all | **12 of 12 sites passed**, 2–5s each |

A datacenter address does not make Grainger slower. It changes the problem into a different, much harder one. Every attempt already pins a fresh residential session automatically, so a burnt exit node gets a genuinely new IP rather than a retry down the same dead pipe.

If a run fails wholesale, check the proxy group before anything else.

### Run it from the API or CLI

Replace `<TOKEN>` with your Apify API token.

Run and get the results back in one call:

```bash
curl -X POST "https://api.apify.com/v2/acts/xhrdev~grainger-scraper/run-sync-get-dataset-items?token=<TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"itemIds":["48TK84","1YHL8"]}'
```

Start a run without waiting:

```bash
curl -X POST "https://api.apify.com/v2/acts/xhrdev~grainger-scraper/runs?token=<TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"itemIds":["48TK84","1YHL8"]}'
```

With the Apify CLI:

```bash
apify call xhrdev/grainger-scraper --input '{"itemIds":["48TK84","1YHL8"]}'
```

#### Fetching results

Every run writes to a dataset. Change `format` for JSON, CSV, or Excel:

```bash
## JSON
curl "https://api.apify.com/v2/datasets/<DATASET_ID>/items?token=<TOKEN>&clean=true&format=json"

## CSV
curl "https://api.apify.com/v2/datasets/<DATASET_ID>/items?token=<TOKEN>&clean=true&format=csv"

## Page through a large dataset
curl "https://api.apify.com/v2/datasets/<DATASET_ID>/items?token=<TOKEN>&offset=1000&limit=1000"
```

`<DATASET_ID>` comes back as `defaultDatasetId` on the run object.

### Limits and failure behaviour

**100 pages per run, hard.** Not configurable. It is a guard against an oversized input list turning into a bill and a hammering of Grainger. For more than that, split the work across runs.

**Failures never enter the dataset.** A page that could not be fetched is not written as a half-empty row — that would corrupt the clean table you are paying for. Instead every run writes a `RUN_SUMMARY` record to the key-value store:

```json
{
  "site": "grainger",
  "itemsScraped": 2,
  "pagesFetched": 2,
  "pagesFailed": 0,
  "failures": [],
  "solverHost": "https://trial.xhr.dev"
}
```

Read it at `https://api.apify.com/v2/key-value-stores/<STORE_ID>/records/RUN_SUMMARY`. `failures` holds up to 50 entries, each with the URL and why it failed.

**A run that scrapes nothing and failed at least one page exits as failed**, rather than reporting success over an empty dataset. If everything failed, the message points at the proxy group first, because that is nearly always the cause.

**Spend cap.** Set `maxTotalChargeUsd` on the run. The Actor stops fetching once it is reached, mid-run, rather than overshooting.

### Questions

**A run came back empty. Why?**
Check the proxy group first — a datacenter exit is the cause the overwhelming majority of the time. Then read `RUN_SUMMARY` in the key-value store for the per-page reasons.

**Is this affiliated with Grainger?**
No. This is an independent tool with no affiliation with, endorsement by, or connection to Grainger or any bot-protection vendor. Names and trademarks belong to their owners.

**How does it get past the challenge without a browser?**
It is solved as HTTP, by [xhr.dev](https://xhr.dev). No Chrome is launched, which is why a page costs a few hundred milliseconds of compute instead of the several seconds and ~1 GB of RAM a stealth browser needs.

**Can I use the solver directly, on a site that isn't Grainger?**
Yes — that is [DataDome Unblocker](https://apify.com/xhrdev/datadome-unblocker), which takes any URL and hands back the HTML and the clearance cookies. There is also [Akamai Unblocker](https://apify.com/xhrdev/akamai-unblocker) for Akamai Bot Manager.

**Can I run this on my own infrastructure?**
Yes. The solver these Actors call is a self-hosted Docker container, sold on a flat fee with no per-request pricing. See [xhr.dev](https://xhr.dev).

**A record came back with no `price`.**
Grainger shows no public web price for it. That is usually a discontinued line — check `isDiscontinued` — or a quote-only item. The rest of the record is still complete.

**The price looks wrong compared to what I see on the site.**
Check `unitOfMeasure` and `priceLabel` first. Grainger prices some items per pack or per case rather than each, and contract pricing shown to a logged-in account differs from the public web price. This Actor returns the public web price.

### Related Actors

- **[DataDome Unblocker](https://apify.com/xhrdev/datadome-unblocker)** — any URL behind DataDome, returns HTML plus clearance cookies.
- **[Akamai Unblocker](https://apify.com/xhrdev/akamai-unblocker)** — the same, for Akamai Bot Manager.
- **[leboncoin Scraper](https://apify.com/xhrdev/leboncoin-scraper)** — French classified ads.
- **[Etsy Scraper](https://apify.com/xhrdev/etsy-scraper)** — handmade marketplace listings.
- **[Anthropologie Scraper](https://apify.com/xhrdev/anthropologie-scraper)** — apparel and homeware.

***

Built by [xhr.dev](https://xhr.dev). Independent tool, not affiliated with Grainger or any bot-protection vendor. Scrape only what you are permitted to access, and check the site's terms before you run anything at scale.

# Actor input Schema

## `itemIds` (type: `array`):

The item numbers to look up — the code Grainger prints as "Item #", e.g. 48TK84. This is the main way to use this Actor: you already hold the numbers, and you want today's price and specs against them.

## `startUrls` (type: `array`):

Grainger product URLs, if you hold links rather than item numbers. Search and category URLs are not accepted: Grainger builds those result grids in the browser, so the HTML contains no products and accepting them would return empty pages.

## `maxItems` (type: `integer`):

Stop once this many products have been scraped.

## `proxyConfiguration` (type: `object`):

Leave this on RESIDENTIAL. It is not a preference: the exit address decides which challenge DataDome serves, and datacenter ranges draw its most aggressive one. This Actor is built and verified around a residential exit, and a fresh session is pinned for every attempt automatically.

## `maxRetries` (type: `integer`):

How many times to try a page before giving up on it. Each attempt takes a fresh proxy session, so a dead exit node or a burnt IP gets a genuinely new chance.

## `timeoutSecs` (type: `integer`):

How long one page — challenge, solve and all — may take before it counts as a failed attempt.

## `maxConcurrency` (type: `integer`):

How many pages to work on at once. The solve path is HTTP-only and cheap, so this can go higher than a browser scraper would allow, but be a considerate guest on someone else's site.

## Actor input object example

```json
{
  "itemIds": [
    "48TK84"
  ],
  "startUrls": [],
  "maxItems": 200,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  },
  "maxRetries": 3,
  "timeoutSecs": 120,
  "maxConcurrency": 4
}
```

# Actor output Schema

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

No description

## `runSummary` (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 = {
    "itemIds": [
        "48TK84"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("xhrdev/grainger-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 = { "itemIds": ["48TK84"] }

# Run the Actor and wait for it to finish
run = client.actor("xhrdev/grainger-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 '{
  "itemIds": [
    "48TK84"
  ]
}' |
apify call xhrdev/grainger-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,xhrdev/grainger-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/Ab7w8i7hORqvmceWQ/builds/vrabQxJEMs0aeXKmU/openapi.json
