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

> Marksandspencer provides 4 callable API endpoints through the Parse marketplace.

**Category:** Food & Dining | **Website:** [marksandspencer.com/](https://marksandspencer.com/) | **Docs:** [parse.bot/marketplace/9b89f630-6cfa-43ad-b58d-f63c758c98c6/marksandspencer-com-api](https://parse.bot/marketplace/9b89f630-6cfa-43ad-b58d-f63c758c98c6/marksandspencer-com-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/marksandspencer/`
**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 products

Get a paginated list of products for a specific food category or subcategory. Returns products, subcategory navigation links, filters, and pagination metadata. Subcategory slugs are returned in the subcategories field of a parent category response. Sub-subcategory slugs are returned in the subcategories of a subcategory response. Each page returns up to ~100 products.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `category_slug` | string | Yes | Top-level category slug from get_food_catalogue_categories. |
| `page` | integer | No | Page number for pagination. |
| `sub_subcategory_slug` | string | No | Third-level subcategory slug from the subcategories field of a subcategory response (e.g. 'berries-and-cherries', 'apples'). |
| `subcategory_slug` | string | No | Second-level subcategory slug from the subcategories field of the parent category response (e.g. 'fresh-fruit', 'fresh-vegetables'). |

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

### Get food catalogue categories

Get the top-level food categories from the M&S food catalogue. Returns category names, URLs, and URL slugs that can be used with get_category_products to browse products within each category.

**Estimated cost:** Metered

_No parameters required._

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

### Get product details

Get full details for a specific food product, including nutrition facts, ingredients, allergens, storage instructions, and images. Product ID and slug are extracted from the seoUrl field returned by get_category_products or search_food_products: the slug is the path segment between '/food/' and '/p/', and the ID is the number after 'fdp' in '/p/fdp{id}'.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `product_id` | string | Yes | Numeric product ID from the seoUrl (the number after 'fdp' in '/p/fdp{id}'). |
| `product_slug` | string | Yes | Product SEO slug from the seoUrl path (the segment between '/food/' and '/p/'). Also accepts the full seoUrl path. |

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

### Search food products

Search for food products by keyword. Returns paginated results with product summaries including id, title, weight, brand, labels, and seoUrl for each matching product. Results are ordered by relevance.

**Estimated cost:** Metered

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

```bash
curl -X POST https://api.beta.paywithlocus.com/api/wrapped/credits/marksandspencer/search-food-products \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"page":"<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.