# Sainsburys — Wrapped API

> **You are on:** `https://api.beta.paywithlocus.com/api` | [llms.txt](https://beta.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.

> Access Sainsbury's grocery catalogue: search products by keyword, browse the full category hierarchy, retrieve detailed product information, and discover trending searches.

**Category:** Food & Dining | **Website:** [sainsburys.co.uk/](https://sainsburys.co.uk/) | **Docs:** [parse.bot/marketplace/e05fdd89-726d-4867-ba08-8c6f9d23e12a/sainsburys-co-uk-api](https://parse.bot/marketplace/e05fdd89-726d-4867-ba08-8c6f9d23e12a/sainsburys-co-uk-api)

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

## Access

**Base URL:** `https://api.beta.paywithlocus.com/api/wrapped/credits/sainsburys/`
**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 category list

Retrieve top-level grocery categories with their slugs. Returns a flat list of the main department categories.

**Estimated cost:** Metered

_No parameters required._

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

### Get category tree

Retrieve the full grocery category hierarchy tree. Returns nested categories with slugs (s), names (n), and children arrays (c). A single root node representing the entire grocery taxonomy.

**Estimated cost:** Metered

_No parameters required._

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

### Get product details

Retrieve full details for a single product by its product UID (SKU) or SEO slug. Returns extended product data including health classification, attributes (brand), short description, and HFSS restriction info not available in search results. At least one of sku or slug must be provided.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `sku` | string | No | Product UID / SKU (e.g. '357937'). Obtainable from search_products or get_products_by_category results in product_uid field. |
| `slug` | string | No | Product SEO slug from the product URL path (e.g. 'sainsburys-british-filtered-semi-skimmed-milk-2l'). |

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

### Get products by category

Retrieve paginated product listings for a specific category ID. Category IDs are numeric strings found in product category arrays or category tree slugs (after c: prefix). Returns the same product shape as search_products.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `category_id` | string | Yes | Numeric category ID (e.g. '12431', '460391'). Found in product category arrays or category tree slugs after c: prefix. |
| `page` | integer | No | Page number for pagination. |

```bash
curl -X POST https://api.beta.paywithlocus.com/api/wrapped/credits/sainsburys/get-products-by-category \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"category_id":"<string>","page":"<integer>"}'
```

### Get trending searches

Retrieve current trending search terms on the grocery site. Returns an ordered list of popular search keywords that can be used as input to search_products.

**Estimated cost:** Metered

_No parameters required._

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

### Search products

Full-text search over the grocery catalog. Returns paginated product listings with pricing, availability, reviews, and category data. Sorted by favourites first. Each product includes a product_uid usable for get_product_details.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `page` | integer | No | Page number for pagination. |
| `page_size` | integer | No | Number of results per page (max 60). |
| `query` | string | Yes | Search keyword (e.g. 'milk', 'bread', 'chocolate'). |

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

## Next steps

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