# Ferrite Supply for developers

Ferrite Supply is a demonstration shop that people and AI agents can both order from: six products with prices, live stock and guest orders, over an open API and MCP server.

Call the same operations over plain HTTP, as MCP tools, or from a page through WebMCP. The base URL is `https://shop.ferrite.run`.

## Quickstart

Read something first. This request needs no setup:

```sh
curl -s 'https://shop.ferrite.run/api/catalog'
```

List the six products with their live stock, and the rules an order is priced by. Use it first, to find product codes and prices. Returns each product's code, slug, price in pence, specification and stock, plus delivery charges, the free-delivery threshold and coupons.

Then change something. Send an `idempotency-key` so a retry cannot run twice:

```sh
curl -s -X POST 'https://shop.ferrite.run/api/guest/orders' \
  -H 'content-type: application/json' \
  -H 'idempotency-key: place_guest_order-1' \
  -d '{"delivery":{"city":"London","country":"GB","line1":"1 Sample Street","postcode":"SW1A 2AA","recipient":"Sam Example"},"email":"sam@example.com","items":[{"code":"FS-101","quantity":1}],"shipping_choice":"standard"}'
```

To use Ferrite Supply from an AI assistant, add its MCP server:

```sh
claude mcp add --transport http ferrite-supply https://shop.ferrite.run/mcp
```

## Authentication and API keys

No API key, account or sign-up is needed: the API is keyless, so the first request you send can be a real one.

## Sandbox

The public address is the sandbox. Every caller is a guest, ordering needs no account, and no order is charged or shipped, so you can place one with a made-up name and an example.com address. Reading or changing an order needs the manage token that was returned when it was placed, so keep that token. The stock is shared with other visitors: cancel your order with its manage token when you have finished, and the units go back on sale. The published order `FG-SAMPLE`, with the manage token `sample`, can be read at any time and cannot be changed.

The [sandbox page](/sandbox) is the place to start.

## Endpoints

| Operation | Request | What it does |
| --- | --- | --- |
| `list_products` | `GET /api/catalog` | List the six products with their live stock, and the rules an order is priced by. Use it first, to find product codes and prices. Returns each product's code, slug, price in pence, specification and stock, plus delivery charges, the free-delivery threshold and coupons. |
| `get_product` | `GET /api/products/{id}` | Read one product by its code or its slug. Use it to check the price and the stock just before ordering that product. Returns the product with its price in pence, specification and the units available now. |
| `place_guest_order` | `POST /api/guest/orders` | Place an order as a guest, without an account. Use it once you know the product codes and the delivery address; it reserves stock and charges nothing. Returns the priced order and its manage_token, the only way to read or cancel it later. Repeating the idempotency-key returns the same order. |
| `get_order` | `GET /api/orders/{id}` | Read one order with its manage token. Use it to check the status, the lines, the totals and the delivery address after placing or cancelling. Returns the order. The sample order in the example can always be read. |
| `start_checkout` | `POST /api/orders/{order_id}/checkout` | Open Stripe's own payment page for a placed order. Use it only after the buyer has agreed to pay the order's total. Returns the address of that page. It is refused with stripe_not_configured where the operator has not set up Stripe, as on the public demonstration, and then nothing is charged. |
| `reconcile_order` | `POST /api/orders/{order_id}/reconcile` | Ask Stripe whether the payment for an order has completed. Use it when a buyer has come back from Stripe's payment page and the order is not marked paid yet. Returns the order as it now stands. It is refused with stripe_not_configured where the operator has not set up Stripe. |
| `cancel_order` | `POST /api/orders/{order_id}/cancel` | Cancel an order that has not been paid. Use it when the buyer changes their mind, and after trying out an order on the public demonstration, so that its stock goes back on sale. Returns the cancelled order; cancelling it again changes nothing. |
| `get_order_email` | `GET /api/orders/{id}/email` | Read what happened to an order's confirmation email. Use it when a buyer with a paid order says that no email arrived. Returns its state, the number of attempts and the last error, or null for an order that has not been paid. |
| `retry_email` | `POST /api/orders/{order_id}/email/retry` | Send a paid order's confirmation email again. Use it when get_order_email shows that the last attempt failed. Returns the state after this attempt. The email provider sees one key for the order, so a buyer does not receive two, and an unpaid order is refused with email_not_ready. |
| `account_security` | `GET /api/account/security` | Read how the shop decides who a caller is. Use it when an operation answers authentication_required or admin_required and you want to know why. Returns the caller's session, whether the admin console would admit it, and what a recovery session may not do. |

The [OpenAPI 3.1 document](/openapi.json) describes every parameter and response. The MCP server at `https://shop.ferrite.run/mcp` exposes the same operations as tools with the same names.

## Example requests

### `list_products`

```sh
curl -s 'https://shop.ferrite.run/api/catalog'
```

### `get_product`

```sh
curl -s 'https://shop.ferrite.run/api/products/field-notebook'
```

### `place_guest_order`

```sh
curl -s -X POST 'https://shop.ferrite.run/api/guest/orders' \
  -H 'content-type: application/json' \
  -H 'idempotency-key: place_guest_order-1' \
  -d '{"delivery":{"city":"London","country":"GB","line1":"1 Sample Street","postcode":"SW1A 2AA","recipient":"Sam Example"},"email":"sam@example.com","items":[{"code":"FS-101","quantity":1}],"shipping_choice":"standard"}'
```

### `get_order`

```sh
curl -s 'https://shop.ferrite.run/api/orders/FG-SAMPLE?manage_token=sample'
```

### `start_checkout`

```sh
curl -s -X POST 'https://shop.ferrite.run/api/orders/FG-SAMPLE/checkout' \
  -H 'content-type: application/json' \
  -H 'idempotency-key: start_checkout-1' \
  -d '{"manage_token":"sample"}'
```

### `reconcile_order`

```sh
curl -s -X POST 'https://shop.ferrite.run/api/orders/FG-SAMPLE/reconcile' \
  -H 'content-type: application/json' \
  -H 'idempotency-key: reconcile_order-1' \
  -d '{"manage_token":"sample","session_id":"cs_test_example"}'
```

### `cancel_order`

```sh
curl -s -X POST 'https://shop.ferrite.run/api/orders/FG-SAMPLE/cancel' \
  -H 'content-type: application/json' \
  -H 'idempotency-key: cancel_order-1' \
  -d '{"manage_token":"sample"}'
```

### `get_order_email`

```sh
curl -s 'https://shop.ferrite.run/api/orders/FG-SAMPLE/email?manage_token=sample'
```

## Conventions

- Rate limits: every response carries `RateLimit-Limit`, `RateLimit-Remaining` and `RateLimit-Reset`. A `429` also carries `Retry-After`, in seconds.
- Errors: refusals are RFC 9457 `application/problem+json` with a stable `type`, a `detail` written to be read, and a `hint` when there is a next step.
- Retries: repeat the same `idempotency-key` on a write and you receive the first result again.
- Versioning: this is version 2.1.0. A change that would break a caller is announced with `Deprecation` and `Sunset` headers at least 90 days ahead.
- Markdown: add `.md` to a page path, or send `Accept: text/markdown`.

## Machine-readable descriptions

- [llms.txt](/llms.txt): orientation for agents
- [OpenAPI](/openapi.json): operations and schemas
- [Agent skills](/.well-known/agent-skills/index.json): installable instructions
- [Agentic Resource Discovery](/.well-known/ard.json): the catalogue of everything here
- [Pricing](/pricing.md)

Questions: see the [contact page](/contact).
