# Grainger — Wrapped API

> **You are on:** `https://api.paywithlocus.com/api` | [llms.txt](https://paywithlocus.com/llms.txt) | [docs](https://docs.paywithlocus.com)
>
> Locus runs on multiple environments -- make sure every URL you call matches your expected environment.
> | Environment | Landing | API | Docs |
> |---|---|---|---|
> | Production | paywithlocus.com | api.paywithlocus.com | docs.paywithlocus.com |
> | Beta | beta.paywithlocus.com | api.beta.paywithlocus.com | docs.paywithlocus.com |
> | Stage | stage.paywithlocus.com | api.stage.paywithlocus.com | docs.paywithlocus.com |
>
> If the API URL above doesn't match your expected environment, re-fetch this file from the correct domain.

> Search and browse Grainger's industrial supply catalog to find products across categories and subcategories, then access detailed specifications and pricing information for any item. Quickly locate the exact industrial supplies you need by exploring the full product catalog with organized categories and comprehensive product details.

**Category:** E-commerce | **Website:** [grainger.com/](https://grainger.com/) | **Docs:** [parse.bot/marketplace/77e19856-6408-449e-80aa-621877d58daf/grainger-com-api](https://parse.bot/marketplace/77e19856-6408-449e-80aa-621877d58daf/grainger-com-api)

Pay-per-use API proxy for Locus Pro. Each call burns credits from your workspace balance.

## Access

**Base URL:** `https://api.paywithlocus.com/api/wrapped/credits/grainger/`
**Auth:** `Authorization: Bearer <LOCUS_CREDITS_SECRET_KEY>` (an `lcr_` secret key or a scoped `lcac_` agent credential)
**Required header:** `Idempotency-Key: <fresh UUID per call>`. A retry with the same key replays the stored result without a new charge.
**Response:** the provider response after any endpoint-specific normalization. `X-Locus-Credits-Charged` carries the charge and `X-Locus-Credits-Balance` the remaining balance. Insufficient credits return `402` before the provider is called.
**Pricing:** estimated costs below are USD. Locus debits the credit equivalent at your workspace rate.

Full call contract: https://docs.paywithlocus.com/api-reference/introduction

> Using a Pay With Locus wallet key (`claw_` prefix)? Wallet routes are documented separately: https://docs.paywithlocus.com/wrapped-apis/for-agents

## Endpoints

### Get all top level categories

Get all top-level product categories from Grainger.com. Returns a flat list of category names, URLs, and URL slugs. Use this as the entry point to navigate the catalog hierarchy.

**Estimated cost:** Metered

_No parameters required._

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/credits/grainger/get-all-top-level-categories \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### Get category subcategories

Get subcategories, description, and breadcrumbs for a given category page. Accepts any category URL from get_all_top_level_categories or from subcategory URLs returned by this endpoint. Returns the category name, a text description, breadcrumb trail, and child subcategories with their URLs.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `category_url` | string | Yes | Full URL of the category page (e.g. https://www.grainger.com/category/safety) |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/credits/grainger/get-category-subcategories \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"category_url":"<string>"}'
```

### Get product details

Get full product details including specifications, pricing, and brand information for a specific product page. Returns technical specifications as key-value pairs, pricing, brand, and description.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `product_url` | string | Yes | Full URL of the product page (e.g. https://www.grainger.com/product/ANSELL-Chemical-Resistant-Gloves-60WL39) |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/credits/grainger/get-product-details \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"product_url":"<string>"}'
```

### Get subcategory detail

Get detailed subcategory information including total product count and available filter facets (e.g. Brand, Trade Designation). Filters contain only values with available products in that category. Use subcategory URLs from get_category_subcategories.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `category_url` | string | Yes | Full URL of the subcategory page (e.g. https://www.grainger.com/category/safety/eye-face-protection) |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/credits/grainger/get-subcategory-detail \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"category_url":"<string>"}'
```

### Search products

Search for products on Grainger.com by keyword. Returns product listings with name, SKU, price, and image URL. Some broad search terms redirect to a parent category and return category_url alongside the products array; use more specific terms or part numbers for direct product results.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `query` | string | Yes | Search keyword or part number |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/credits/grainger/search-products \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"query":"<string>"}'
```

## Next steps

- [All wrapped API providers](https://paywithlocus.com/wapi/index.md): pick another provider.
- [Find and call tools](https://paywithlocus.com/agent/tools.md): price ceilings, async results, and errors.
- [Credits and billing](https://paywithlocus.com/agent/billing.md): what a call costs and how to add credits.
- [Agent docs index](https://paywithlocus.com/agent/index.md): every Locus agent page.