# API

> The cart belongs to a single visitor. Merx keeps it out of your templates and behind a JSON API, so the rest of your shop stays cacheable.

Your product and content pages render the same HTML for everybody. The cart does not — it is different for every visitor, and a template that renders it turns that page into a personal one which can no longer be cached or served from a CDN.

Merx keeps the two apart. Pages stay static, and the cart is fetched at runtime from a small JSON API under `/api/shop`.

You don’t have to use it. Every cart operation is available in PHP as well, which is the better fit for a shop that does not cache its pages, or does not want to rely on JavaScript.

## Pages

- [Concept](https://merx2.wagnerwagner.de/guide/api/concept.md): How the Merx API is laid out, how it finds the visitor’s cart and how to shape its responses.
- [Using API with PHP](https://merx2.wagnerwagner.de/guide/api/using-api-with-php.md): Every cart and checkout operation is available in PHP, for shops that render the cart server-side.
- [Custom models](https://merx2.wagnerwagner.de/guide/api/custom-models.md): Add your own fields to what the API returns, without touching Merx.
