# Sainsburys — 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.

> 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. Each call is automatically billed to your wallet in USDC.

## Access

**Base URL:** `https://api.paywithlocus.com/api/wrapped/parse-sainsburys-co-uk-api-e05fdd89/`
**Auth:** `Authorization: Bearer <LOCUS_API_KEY>`

## 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.paywithlocus.com/api/wrapped/parse-sainsburys-co-uk-api-e05fdd89/get_category_list \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -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.paywithlocus.com/api/wrapped/parse-sainsburys-co-uk-api-e05fdd89/get_category_tree \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -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.paywithlocus.com/api/wrapped/parse-sainsburys-co-uk-api-e05fdd89/get_product_details \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -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.paywithlocus.com/api/wrapped/parse-sainsburys-co-uk-api-e05fdd89/get_products_by_category \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -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.paywithlocus.com/api/wrapped/parse-sainsburys-co-uk-api-e05fdd89/get_trending_searches \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -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.paywithlocus.com/api/wrapped/parse-sainsburys-co-uk-api-e05fdd89/search_products \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"page":"<integer>","page_size":"<integer>","query":"<string>"}'
```
