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

## Access

**Base URL:** `https://api.beta.paywithlocus.com/api/wrapped/parse-marksandspencer-com-api-9b89f630/`
**Auth:** `Authorization: Bearer <LOCUS_API_KEY>`

## 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/parse-marksandspencer-com-api-9b89f630/get_category_products \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -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/parse-marksandspencer-com-api-9b89f630/get_food_catalogue_categories \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -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/parse-marksandspencer-com-api-9b89f630/get_product_details \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -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/parse-marksandspencer-com-api-9b89f630/search_food_products \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"page":"<integer>","query":"<string>"}'
```
