# LoyX Partners API

> Connect a till, web shop or back office to LoyX loyalty.

Source: https://developers.loyx.se/

LoyX runs loyalty programs for retail brands. Members carry one LoyX app for every brand they join. The Partners API lets your system take part at the moment that matters: the sale.

With it you can:

- **Find a member** from the QR code in their LoyX app, or from a phone number, email or member id.
- **Show their card**: balance, program, current cycle and the rewards they can use.
- **Record the sale**, so the member earns points or stamps.
- **Keep products and stores in sync** with what your system already knows.

## How it works

1. The brand gives you a **client id and secret** for its account.
2. You exchange them for a short-lived **access token**.
3. You call the API with `Authorization: Bearer <token>`. Every call acts on that one brand.

```bash
curl -X POST https://api.loyx.se/partners/v1/memberships/lookup \
  -H "Authorization: Bearer $LOYX_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"identifier": "qr_code", "value": "lx1_EXAMPLE_TOKEN"}'
```

The base URL is `https://api.loyx.se/partners`. All paths start with `/v1`.

## Where to start

- [Authentication](/guides/authentication/): get a token.
- [Till integration walkthrough](/guides/till-walkthrough/): the whole flow, from scan to receipt.
- [API reference](/api/): every endpoint and field, generated from the same spec the server uses.

## Rules you can rely on

- **Money is an integer in minor units** with a currency. `4500` with `SEK` is 45.00 kr. See [Money](/guides/money/).
- **A retry never books a sale twice.** Your receipt id is the duplicate key. See [Idempotency](/guides/idempotency/).
- **Errors are typed** and carry a `request_id` you can quote to support. See [Errors](/guides/errors/).
- **Points are calculated after the sale**, not in the sale response. Read the member card to see the new balance.
- **Ignore fields and enum values you do not know.** We add fields without a new version. We never remove or rename them inside `v1`.

## Live and preview

Pages under **Preview** describe features we are building, such as joining at the till, reserving rewards and webhooks. They are not live, and their shape may change. Build only against what is in the [API reference](/api/).
