# Storefront API

> Read a store's catalogue as one of its markets shows it, keep a cart and hand it to the store's own checkout.

Every call goes to `https://kaizenaflow.com/api/storefront/v1/{store}/…`, `{store}` the store's slug. The OpenAPI 3.1 document of the same routes is [`/api/storefront/v1/openapi.json`](https://kaizenaflow.com/api/storefront/v1/openapi.json).

A token is public by design and opens only what any visitor of its market sees; prices, stock and quantity rules are the storefront's own. Nothing is ordered or paid through this API.

## Authentication {#authentication}

Send a storefront token (`kfs_…`, made for one market in the store's Apps and API settings) in the `X-Storefront-Token` header on every call. It opens only what any visitor of its market sees, so it may sit in a site's own code. [Rate limits](https://docs.kaizenaflow.com/reference/rate-limits) says how many calls a minute it may make (1,200).

## [Catalogue](https://docs.kaizenaflow.com/reference/storefront-api/catalogue) {#catalogue}

Products, a product's page and the categories, as the token's market shows them.

| Operation | What it does |
|---|---|
| [`GET /products`](https://docs.kaizenaflow.com/reference/storefront-api/catalogue#products) | Products as the token's market lists them: `category`, `tag`, `sort` and `limit` (at most 48). |
| [`GET /products/{handle}`](https://docs.kaizenaflow.com/reference/storefront-api/catalogue#product) | One product's page: its variants with their prices, stock and quantity rules. |
| [`GET /categories`](https://docs.kaizenaflow.com/reference/storefront-api/catalogue#categories) | The store's product categories and tags. |

## [Carts](https://docs.kaizenaflow.com/reference/storefront-api/carts) {#carts}

A cart's price now, a cart the store keeps, and the hand-over to the store's own checkout.

| Operation | What it does |
|---|---|
| [`POST /cart`](https://docs.kaizenaflow.com/reference/storefront-api/carts#cart) | What lines kept on your site cost now, without keeping a cart: `{ lines: [{ variantId, quantity }] }`. |
| [`POST /checkout`](https://docs.kaizenaflow.com/reference/storefront-api/carts#checkout) | Makes a cart of the lines given and answers the one-time address of the store's checkout. |
| [`POST /carts`](https://docs.kaizenaflow.com/reference/storefront-api/carts#carts) | Makes a cart the store keeps: `{ lines? }`. Answers its key (`cart`), which only you hold: keep it secret. |
| [`GET /carts/{cart}`](https://docs.kaizenaflow.com/reference/storefront-api/carts#cart-read) | What the cart holds and costs now: each line's price, `available`, `fitted` and status, and a subtotal. |
| [`POST /carts/{cart}/lines`](https://docs.kaizenaflow.com/reference/storefront-api/carts#cart-add) | Adds units of a variant: `{ variantId, quantity }`, put right by the variant's quantity rule and cut to what is available. |
| [`PATCH /carts/{cart}/lines/{variantId}`](https://docs.kaizenaflow.com/reference/storefront-api/carts#cart-set) | Sets a line to exactly `{ quantity }`; 0 removes it. A quantity the rule does not allow is refused. |
| [`DELETE /carts/{cart}/lines/{variantId}`](https://docs.kaizenaflow.com/reference/storefront-api/carts#cart-remove) | Removes a line. |
| [`POST /carts/{cart}/checkout`](https://docs.kaizenaflow.com/reference/storefront-api/carts#cart-checkout) | Hands the cart to the store's checkout: a one-time address for fifteen minutes. The key opens nothing after this. |

---

https://docs.kaizenaflow.com/reference/storefront-api · made from the API contract 1.57
