# LoyX Partners API reference

B2B API for partner integrations (POS systems, backend services)

Base URL: `https://api.loyx.se/partners`. Every path below is relative to it. OpenAPI 3.1.0, API version 1.0.0.

Machine-readable spec: https://developers.loyx.se/openapi/partners-v1.json

Authentication: send `Authorization: Bearer <access_token>` on every call except `POST /v1/auth/token` and `GET /v1/`. See the authentication guide.

## GET /v1/

**API Information** (Info)

Get API version information.

``documentation`` points at the live Swagger UI where it is served (local
and development, ``docs_urls_for``) and at the public developer docs site
(``PARTNERS_DOCS_URL``) everywhere else, never at a link that 404s.

Responses:

- `200`: Successful Response. Body: object.
- `500`: `internal_server_error` or `database_error` (type `internal_error`): our fault. Retry with backoff; quote `request_id`. Body: ErrorResponse.

## POST /v1/auth/token

**Issue an access token (OAuth2 Client Credentials)** (Auth)

Exchange `client_id` and `client_secret` (via HTTP Basic) for an opaque access token valid for one hour (`expires_in`). Use it as `Authorization: Bearer <token>` against every other Partners endpoint, and fetch a new one on a 401. The token carries the API key's scopes (`scope`). Limited to 30 calls a minute per API key and 60 per caller IP.

Parameters:

- `authorization` (header, string (nullable)): HTTP Basic header: `Basic base64(client_id:client_secret)`.

Request body (`application/x-www-form-urlencoded`, Body_issue_token_v1_auth_token_post):

- `grant_type` (string, required): OAuth2 grant type — must be `client_credentials`.

Responses:

- `200`: The issued access token, its lifetime and its scopes. Body: TokenResponse.
- `400`: Unsupported `grant_type`. Body: ErrorResponse.
- `401`: Missing or invalid client credentials, or a revoked key. Body: ErrorResponse.
- `422`: Validation Error. Body: ErrorResponse.
- `429`: Token requests over the limit; see `Retry-After`. Body: ErrorResponse.
- `500`: `internal_server_error` or `database_error` (type `internal_error`): our fault. Retry with backoff; quote `request_id`. Body: ErrorResponse.
- `503`: The rate limiter is unreachable, so issuance is refused. Body: ErrorResponse.

## POST /v1/memberships/lookup

**Look up a membership by identifier** (Memberships)

Find a single membership in the authenticated company by one of six identifiers. The request body is `{identifier, value}`. `identifier` must be one of `membership_id`, `user_id`, `qr_code`, `mobile_number`, `email`, or `national_id`. `membership_id` and `user_id` match top-level UUID fields; `mobile_number`, `email` and `national_id` match entries in `required_member_fields`. The value format is validated per identifier type (UUID / E.164 / email / string).

**Scanning a member's QR code:** use `qr_code` and send the scanned string exactly as read, with no client-side parsing. Both code generations are accepted — a rotating `lx1_` token (current) and a bare member UUID (legacy) — and the API tells them apart itself, so no client change is needed when the legacy form is retired. A rotating token is short-lived: if it has expired or been superseded the response is `404 qr_code_not_resolvable`, which means *ask the member to refresh their code*, as distinct from `404 membership_not_found`, which means the person is not an active member of your company.

`loyalty_program_type` is `points`, `stamps`, or `null` — for a member on no resolvable program, or on a unit whose presentation has no value in this contract yet.

Request body (`application/json`, MembershipLookupRequest):

- `identifier` (string (one of `membership_id`, `user_id`, `qr_code`, `mobile_number`, `email`, `national_id`), required): Which field to look up by. One of ``membership_id``, ``user_id``, ``qr_code``, ``mobile_number``, ``email``, ``national_id``.
- `value` (string, required): Identifier value. Format depends on ``identifier``. For ``qr_code``, pass the scanned string unchanged — the API tells the two QR generations apart on its own.

Responses:

- `200`: The matching membership, in its polymorphic detail shape. Body: MembershipDetailResponse.
- `401`: `missing_token`, `invalid_authorization_header` or `invalid_token`: get a new access token and retry once. Body: ErrorResponse.
- `403`: `insufficient_scope`: the API key lacks the scope this route needs. Body: ErrorResponse.
- `404`: No membership matches the provided identifier (`membership_not_found`), or the scanned QR token is expired or invalid (`qr_code_not_resolvable`). Body: ErrorResponse.
- `422`: Validation Error. Body: ErrorResponse.
- `429`: `rate_limit_exceeded`: wait `Retry-After` seconds. Body: ErrorResponse.
- `500`: `internal_server_error` or `database_error` (type `internal_error`): our fault. Retry with backoff; quote `request_id`. Body: ErrorResponse.
- `503`: `qr_code` only — the QR token store is temporarily unreachable. Retry; never treat this as an expired code. Body: ErrorResponse.

## GET /v1/memberships/{membership_id}/loyalty

**Get a membership's loyalty state** (Memberships)

Unit-agnostic loyalty read model for one membership: `balance`, `unit` (label + presentation), `program`, the current `cycle`, and `punches` (populated only when `unit.presentation` is `card`; `null` otherwise).

Parameters:

- `membership_id` (path, string, required)

Responses:

- `200`: The membership's current loyalty state. Body: MembershipLoyaltyResponse.
- `401`: `missing_token`, `invalid_authorization_header` or `invalid_token`: get a new access token and retry once. Body: ErrorResponse.
- `403`: `insufficient_scope`: the API key lacks the scope this route needs. Body: ErrorResponse.
- `404`: No membership with the given id in the authenticated company. Body: ErrorResponse.
- `422`: Validation Error. Body: ErrorResponse.
- `429`: `rate_limit_exceeded`: wait `Retry-After` seconds. Body: ErrorResponse.
- `500`: `internal_server_error` or `database_error` (type `internal_error`): our fault. Retry with backoff; quote `request_id`. Body: ErrorResponse.

## GET /v1/memberships/{membership_id}/rewards

**List a member's redeemable rewards** (Rewards)

The rewards the member can redeem now, for the member card at the till: active rewards only, none from a paused campaign, and, when the store is given (`store_id` or `external_store_id`, not both), none that do not run at that store. Cursor-paginated, newest first. Read-only.

Parameters:

- `membership_id` (path, string, required): The membership's internal UUID.
- `store_id` (query, string (nullable)): LoyX id of the store the till is in.
- `external_store_id` (query, string (nullable)): The till's own code for the store, as registered on the LoyX store.
- `limit` (query, integer): Maximum rewards to return (1-200).
- `cursor` (query, string (nullable)): Opaque cursor from the previous page's `next_cursor`.

Responses:

- `200`: Cursor-paginated list of redeemable rewards. Body: RewardListResponse.
- `400`: `store_reference_ambiguous` (both store parameters sent) or `invalid_cursor`. Body: ErrorResponse.
- `401`: `missing_token`, `invalid_authorization_header` or `invalid_token`: get a new access token and retry once. Body: ErrorResponse.
- `403`: `insufficient_scope`: the API key lacks the scope this route needs. Body: ErrorResponse.
- `404`: Membership or store not found. Body: ErrorResponse.
- `422`: Validation Error. Body: ErrorResponse.
- `429`: `rate_limit_exceeded`: wait `Retry-After` seconds. Body: ErrorResponse.
- `500`: `internal_server_error` or `database_error` (type `internal_error`): our fault. Retry with backoff; quote `request_id`. Body: ErrorResponse.

## GET /v1/products

**List products** (Products)

List products with offset pagination. Returns an empty array if no products are defined for the company.

Parameters:

- `limit` (query, integer): Maximum number of products to return (1–200).
- `offset` (query, integer): Number of products to skip.

Responses:

- `200`: Paginated list of products. Body: ProductListResponse.
- `401`: `missing_token`, `invalid_authorization_header` or `invalid_token`: get a new access token and retry once. Body: ErrorResponse.
- `403`: `insufficient_scope`: the API key lacks the scope this route needs. Body: ErrorResponse.
- `422`: Validation Error. Body: ErrorResponse.
- `429`: `rate_limit_exceeded`: wait `Retry-After` seconds. Body: ErrorResponse.
- `500`: `internal_server_error` or `database_error` (type `internal_error`): our fault. Retry with backoff; quote `request_id`. Body: ErrorResponse.

## POST /v1/products

**Create or upsert a product** (Products)

Create a new product in the authenticated company's catalog. Fields such as company logo, display name, and category are resolved server-side from the authenticated company — clients never supply them.

**Upsert on `external_product_id`.** When the body carries an `external_product_id` that a product of this company already has, that product is updated instead and the response is `200` (a new product is `201`). On update only the fields you send are changed (omitted optional fields keep their stored value), `stores` replaces the assortment, and `image_link` is ignored (it is set at create only). A soft-deleted product with the key is restored. Concurrent upserts of one key converge on one product. Without `external_product_id` every call creates a new product.

Parameters:

- `Idempotency-Key` (header, string (nullable)): Optional. When provided, retrying with the same key returns the original result.

Request body (`application/json`, ProductCreateRequest):

- `brand` (string (nullable)): Manufacturer or brand name.
- `categories` (array of string): Category labels defined on the company. Must match existing categories.
- `description` (string (nullable)): Long-form product description.
- `external_product_id` (string (nullable)): Your own product key (till/POS/ERP article id). Unique per company. When set, `POST /products` upserts on it: an existing product with this key is updated instead of a duplicate being created. Sale lines that carry an unknown key create a minimal product with it.
- `identifiers` (array of IdentifierInput (product)): Typed identifiers (gtin/ean13/ean8/sku/pos). Each (type, value) pair must be unique per company across non-deleted products.
  - `type` (string, required): Identifier type: gtin, ean13, ean8, sku, or pos.
  - `value` (string, required)
- `image_link` (string (nullable)): Public URL of the product's primary image.
- `is_loyalty_program_eligible` (boolean, default `true`): When true, purchases of this product accrue loyalty points or stamps.
- `loyx_app_active` (boolean, default `true`): When true, the product is visible in the consumer LoyX app.
- `loyx_business_app_active` (boolean, default `true`): When true, the product is visible in the LoyX Business (staff) app.
- `name` (string, required): Display name shown in the mobile app and digital receipts.
- `page_url` (string (nullable)): Public URL of the product's web page.
- `price` (PriceInput (product), required): Base price in minor units paired with a currency code.
  - `currency` (string, default `SEK`): ISO 4217 currency code
  - `value` (integer, required): Amount in minor units (e.g. öre, cents)
- `stores` (array of ProductStoreInput, required): Stores that carry this product — at least one. Each entry may set a per-store price override.
  - `price` (PriceInput (product) (nullable)): Optional per-store price override. When omitted, the store uses the product's base price. Currency must match the base price.
    - `currency` (string, default `SEK`): ISO 4217 currency code
    - `value` (integer, required): Amount in minor units (e.g. öre, cents)
  - `store_id` (string, required): Internal UUID of a store that carries this product.
- `unit` (string, default `ea`): Unit the product is sold in (ea, kg, g, l, ml, m, pack). Defaults to `ea` (each).

Responses:

- `200`: A product with this external_product_id existed and was updated.
- `201`: A new product was created. Body: ProductResponse.
- `401`: `missing_token`, `invalid_authorization_header` or `invalid_token`: get a new access token and retry once. Body: ErrorResponse.
- `403`: `insufficient_scope`: the API key lacks the scope this route needs. Body: ErrorResponse.
- `422`: Validation Error. Body: ErrorResponse.
- `429`: `rate_limit_exceeded`: wait `Retry-After` seconds. Body: ErrorResponse.
- `500`: `internal_server_error` or `database_error` (type `internal_error`): our fault. Retry with backoff; quote `request_id`. Body: ErrorResponse.

## POST /v1/products/bulk

**Bulk upsert products** (Products)

Create or update up to 100 products in one call, each matched on its required `external_product_id` with the same rules as `POST /products`. Items are processed independently and in order: a failing item does not roll back the others, and the response carries one result per item (`created`, `updated` or `failed` with the error). The call is safe to retry — resend the whole request or only the failed items. A key repeated within one request fails from its second occurrence (`duplicate_in_request`).

Always `207 Multi-Status`, even when every item succeeded: read each item's `status`. With an `Idempotency-Key`, a resend of the same body within 24 h returns the first result without running again; the same key with a different body is `409 idempotency_key_reused`, and a resend while the first call is still running is `409 idempotency_request_in_progress`.

Parameters:

- `Idempotency-Key` (header, string (nullable)): Optional. A resend with the same key and body within 24 h returns the original result instead of running again.

Request body (`application/json`, ProductBulkUpsertRequest):

- `products` (array of ProductBulkUpsertItem, required): 1–100 products. Each is upserted independently; one failing item does not roll back the others. A key may appear only once per request.
  - `brand` (string (nullable)): Manufacturer or brand name.
  - `categories` (array of string): Category labels defined on the company. Must match existing categories.
  - `description` (string (nullable)): Long-form product description.
  - `external_product_id` (string, required): Your product key — the upsert match key. Required in a bulk call.
  - `identifiers` (array of IdentifierInput (product)): Typed identifiers (gtin/ean13/ean8/sku/pos). Each (type, value) pair must be unique per company across non-deleted products.
    - `type` (string, required): Identifier type: gtin, ean13, ean8, sku, or pos.
    - `value` (string, required)
  - `image_link` (string (nullable)): Public URL of the product's primary image.
  - `is_loyalty_program_eligible` (boolean, default `true`): When true, purchases of this product accrue loyalty points or stamps.
  - `loyx_app_active` (boolean, default `true`): When true, the product is visible in the consumer LoyX app.
  - `loyx_business_app_active` (boolean, default `true`): When true, the product is visible in the LoyX Business (staff) app.
  - `name` (string, required): Display name shown in the mobile app and digital receipts.
  - `page_url` (string (nullable)): Public URL of the product's web page.
  - `price` (PriceInput (product), required): Base price in minor units paired with a currency code.
    - `currency` (string, default `SEK`): ISO 4217 currency code
    - `value` (integer, required): Amount in minor units (e.g. öre, cents)
  - `stores` (array of ProductStoreInput, required): Stores that carry this product — at least one. Each entry may set a per-store price override.
    - `price` (PriceInput (product) (nullable)): Optional per-store price override. When omitted, the store uses the product's base price. Currency must match the base price.
    - `store_id` (string, required): Internal UUID of a store that carries this product.
  - `unit` (string, default `ea`): Unit the product is sold in (ea, kg, g, l, ml, m, pack). Defaults to `ea` (each).

Responses:

- `207`: One result per item, in request order, plus counts. Body: ProductBulkUpsertResponse.
- `401`: `missing_token`, `invalid_authorization_header` or `invalid_token`: get a new access token and retry once. Body: ErrorResponse.
- `403`: `insufficient_scope`: the API key lacks the scope this route needs. Body: ErrorResponse.
- `409`: Idempotency-Key reused with another body, or still in progress. Body: ErrorResponse.
- `422`: Validation Error. Body: ErrorResponse.
- `429`: `rate_limit_exceeded`: wait `Retry-After` seconds. Body: ErrorResponse.
- `500`: `internal_server_error` or `database_error` (type `internal_error`): our fault. Retry with backoff; quote `request_id`. Body: ErrorResponse.

## GET /v1/products/{product_id}

**Get product by ID** (Products)

Retrieve a single product by its internal UUID.

Parameters:

- `product_id` (path, string, required): The product's internal UUID.

Responses:

- `200`: The requested product. Body: ProductResponse.
- `401`: `missing_token`, `invalid_authorization_header` or `invalid_token`: get a new access token and retry once. Body: ErrorResponse.
- `403`: `insufficient_scope`: the API key lacks the scope this route needs. Body: ErrorResponse.
- `404`: Product not found. Body: ErrorResponse.
- `422`: Validation Error. Body: ErrorResponse.
- `429`: `rate_limit_exceeded`: wait `Retry-After` seconds. Body: ErrorResponse.
- `500`: `internal_server_error` or `database_error` (type `internal_error`): our fault. Retry with backoff; quote `request_id`. Body: ErrorResponse.

## PATCH /v1/products/{product_id}

**Update product by ID** (Products)

Partially update a product. Only include the fields you want to change. Omitted fields are left unchanged. Set a field to `null` to clear it.

Parameters:

- `product_id` (path, string, required): The product's internal UUID.
- `Idempotency-Key` (header, string (nullable)): Optional. When provided, retrying with the same key returns the original result.

Request body (`application/json`, ProductUpdateRequest):

- `brand` (string (nullable)): Updated manufacturer or brand name.
- `categories` (array of string (nullable)): Full replacement of the category list.
- `description` (string (nullable)): Updated long-form description.
- `external_product_id` (string (nullable)): Set or change your product key. Cannot be cleared. 409 `external_product_id_conflict` when another product of the company (including a deleted one) already has it.
- `identifiers` (array of IdentifierInput (product) (nullable)): Full replacement of the typed identifier list (gtin/ean13/ean8/sku/pos). Send `[]` to clear all identifiers.
  - `type` (string, required): Identifier type: gtin, ean13, ean8, sku, or pos.
  - `value` (string, required)
- `is_loyalty_program_eligible` (boolean (nullable)): Whether purchases of this product accrue loyalty points or stamps.
- `loyx_app_active` (boolean (nullable)): Visibility toggle for the consumer LoyX app.
- `loyx_business_app_active` (boolean (nullable)): Visibility toggle for the LoyX Business (staff) app.
- `name` (string (nullable)): Updated display name.
- `page_url` (string (nullable)): Updated public URL of the product page.
- `price` (PriceInput (product) (nullable)): Updated base price.
  - `currency` (string, default `SEK`): ISO 4217 currency code
  - `value` (integer, required): Amount in minor units (e.g. öre, cents)
- `stores` (array of ProductStoreInput (nullable)): Full replacement of the store assortment. When sent, stores not listed are delisted and new stores are added. Omit to leave the assortment unchanged.
  - `price` (PriceInput (product) (nullable)): Optional per-store price override. When omitted, the store uses the product's base price. Currency must match the base price.
    - `currency` (string, default `SEK`): ISO 4217 currency code
    - `value` (integer, required): Amount in minor units (e.g. öre, cents)
  - `store_id` (string, required): Internal UUID of a store that carries this product.
- `unit` (string (nullable)): Updated unit (ea, kg, g, l, ml, m, pack).

Responses:

- `200`: The updated product. Body: ProductResponse.
- `401`: `missing_token`, `invalid_authorization_header` or `invalid_token`: get a new access token and retry once. Body: ErrorResponse.
- `403`: `insufficient_scope`: the API key lacks the scope this route needs. Body: ErrorResponse.
- `404`: Product not found. Body: ErrorResponse.
- `409`: Another product already has this external_product_id. Body: ErrorResponse.
- `422`: Validation Error. Body: ErrorResponse.
- `429`: `rate_limit_exceeded`: wait `Retry-After` seconds. Body: ErrorResponse.
- `500`: `internal_server_error` or `database_error` (type `internal_error`): our fault. Retry with backoff; quote `request_id`. Body: ErrorResponse.

## DELETE /v1/products/{product_id}

**Delete product by ID** (Products)

Soft-delete a product. The product is marked as deleted but not permanently removed.

Parameters:

- `product_id` (path, string, required): The product's internal UUID.

Responses:

- `204`: Product deleted successfully.
- `401`: `missing_token`, `invalid_authorization_header` or `invalid_token`: get a new access token and retry once. Body: ErrorResponse.
- `403`: `insufficient_scope`: the API key lacks the scope this route needs. Body: ErrorResponse.
- `404`: Product not found. Body: ErrorResponse.
- `422`: Validation Error. Body: ErrorResponse.
- `429`: `rate_limit_exceeded`: wait `Retry-After` seconds. Body: ErrorResponse.
- `500`: `internal_server_error` or `database_error` (type `internal_error`): our fault. Retry with backoff; quote `request_id`. Body: ErrorResponse.

## GET /v1/products/{product_id}/stores

**List stores carrying a product** (Products)

List the stores whose assortment includes this product, with the per-store price override (when set) and the effective price.

Parameters:

- `product_id` (path, string, required): The product's internal UUID.

Responses:

- `200`: Stores carrying the product. Body: ProductStoresListResponse.
- `401`: `missing_token`, `invalid_authorization_header` or `invalid_token`: get a new access token and retry once. Body: ErrorResponse.
- `403`: `insufficient_scope`: the API key lacks the scope this route needs. Body: ErrorResponse.
- `404`: Product not found. Body: ErrorResponse.
- `422`: Validation Error. Body: ErrorResponse.
- `429`: `rate_limit_exceeded`: wait `Retry-After` seconds. Body: ErrorResponse.
- `500`: `internal_server_error` or `database_error` (type `internal_error`): our fault. Retry with backoff; quote `request_id`. Body: ErrorResponse.

## GET /v1/stores

**List stores** (Stores)

List stores with offset pagination. Filter by status and/or type to narrow results.

Parameters:

- `limit` (query, integer): Maximum number of stores to return (1–200).
- `offset` (query, integer): Number of stores to skip.
- `status` (query, string (nullable)): Filter by store status (e.g. `active`, `inactive`).
- `type` (query, string (nullable)): Filter by store type (e.g. `physical`, `online`, `warehouse`).

Responses:

- `200`: Paginated list of stores. Body: StoreListResponse.
- `401`: `missing_token`, `invalid_authorization_header` or `invalid_token`: get a new access token and retry once. Body: ErrorResponse.
- `403`: `insufficient_scope`: the API key lacks the scope this route needs. Body: ErrorResponse.
- `422`: Validation Error. Body: ErrorResponse.
- `429`: `rate_limit_exceeded`: wait `Retry-After` seconds. Body: ErrorResponse.
- `500`: `internal_server_error` or `database_error` (type `internal_error`): our fault. Retry with backoff; quote `request_id`. Body: ErrorResponse.

## POST /v1/stores

**Create a store** (Stores)

Create a new store for the authenticated company.

Parameters:

- `Idempotency-Key` (header, string (nullable)): Optional. When provided, retrying with the same key returns the original result.

Request body (`application/json`, StoreCreateRequest):

- `address` (AddressInput (nullable))
  - `city` (string, required)
  - `country` (string, required)
  - `postal_code` (string, required)
  - `region` (string (nullable))
  - `street1` (string, required)
  - `street2` (string (nullable))
- `contact` (StoreContactInput (nullable))
  - `email` (string (nullable))
  - `phone` (string (nullable))
  - `website` (string (nullable))
- `external_ids` (object)
- `external_store_id` (string, required)
- `geo` (GeoLocationInput (nullable))
  - `latitude` (number, required)
  - `longitude` (number, required)
- `icon` (StoreMediaInput (nullable))
  - `content_type` (string, default `image/png`)
  - `url` (string, required)
- `logo` (StoreMediaInput (nullable))
  - `content_type` (string, default `image/png`)
  - `url` (string, required)
- `name` (string, required)
- `org_number` (string (nullable))
- `status` (string, default `active`)
- `tags` (array of string)
- `timezone` (string, required)
- `type` (string, default `physical`)
- `vat_number` (string (nullable))

Responses:

- `201`: The created store. Body: StoreResponse.
- `401`: `missing_token`, `invalid_authorization_header` or `invalid_token`: get a new access token and retry once. Body: ErrorResponse.
- `403`: `insufficient_scope`: the API key lacks the scope this route needs. Body: ErrorResponse.
- `409`: A store with this external ID already exists. Body: ErrorResponse.
- `422`: Validation Error. Body: ErrorResponse.
- `429`: `rate_limit_exceeded`: wait `Retry-After` seconds. Body: ErrorResponse.
- `500`: `internal_server_error` or `database_error` (type `internal_error`): our fault. Retry with backoff; quote `request_id`. Body: ErrorResponse.

## GET /v1/stores/external/{external_store_id}

**Get store by external ID** (Stores)

Retrieve a single store by the company's own external identifier (e.g. POS code).

Parameters:

- `external_store_id` (path, string, required): The company's external identifier for the store.

Responses:

- `200`: The requested store. Body: StoreResponse.
- `401`: `missing_token`, `invalid_authorization_header` or `invalid_token`: get a new access token and retry once. Body: ErrorResponse.
- `403`: `insufficient_scope`: the API key lacks the scope this route needs. Body: ErrorResponse.
- `404`: Store not found. Body: ErrorResponse.
- `422`: Validation Error. Body: ErrorResponse.
- `429`: `rate_limit_exceeded`: wait `Retry-After` seconds. Body: ErrorResponse.
- `500`: `internal_server_error` or `database_error` (type `internal_error`): our fault. Retry with backoff; quote `request_id`. Body: ErrorResponse.

## PATCH /v1/stores/external/{external_store_id}

**Update store by external ID** (Stores)

Partially update a store addressed by the company's own external identifier. Same semantics as `PATCH /stores/{store_id}`.

Parameters:

- `external_store_id` (path, string, required): The company's external identifier for the store.
- `Idempotency-Key` (header, string (nullable)): Optional. When provided, retrying with the same key returns the original result.

Request body (`application/json`, StoreUpdateRequest):

- `address` (AddressInput (nullable))
  - `city` (string, required)
  - `country` (string, required)
  - `postal_code` (string, required)
  - `region` (string (nullable))
  - `street1` (string, required)
  - `street2` (string (nullable))
- `contact` (StoreContactInput (nullable))
  - `email` (string (nullable))
  - `phone` (string (nullable))
  - `website` (string (nullable))
- `external_ids` (object (nullable))
- `external_store_id` (string (nullable))
- `geo` (GeoLocationInput (nullable))
  - `latitude` (number, required)
  - `longitude` (number, required)
- `icon` (StoreMediaInput (nullable))
  - `content_type` (string, default `image/png`)
  - `url` (string, required)
- `logo` (StoreMediaInput (nullable))
  - `content_type` (string, default `image/png`)
  - `url` (string, required)
- `name` (string (nullable))
- `org_number` (string (nullable))
- `status` (string (nullable))
- `tags` (array of string (nullable))
- `timezone` (string (nullable))
- `type` (string (nullable))
- `vat_number` (string (nullable))

Responses:

- `200`: The updated store. Body: StoreResponse.
- `401`: `missing_token`, `invalid_authorization_header` or `invalid_token`: get a new access token and retry once. Body: ErrorResponse.
- `403`: `insufficient_scope`: the API key lacks the scope this route needs. Body: ErrorResponse.
- `404`: Store not found. Body: ErrorResponse.
- `422`: Validation Error. Body: ErrorResponse.
- `429`: `rate_limit_exceeded`: wait `Retry-After` seconds. Body: ErrorResponse.
- `500`: `internal_server_error` or `database_error` (type `internal_error`): our fault. Retry with backoff; quote `request_id`. Body: ErrorResponse.

## DELETE /v1/stores/external/{external_store_id}

**Delete store by external ID** (Stores)

Soft-delete a store addressed by the company's own external identifier.

Parameters:

- `external_store_id` (path, string, required): The company's external identifier for the store.

Responses:

- `204`: Store deleted successfully.
- `401`: `missing_token`, `invalid_authorization_header` or `invalid_token`: get a new access token and retry once. Body: ErrorResponse.
- `403`: `insufficient_scope`: the API key lacks the scope this route needs. Body: ErrorResponse.
- `404`: Store not found. Body: ErrorResponse.
- `422`: Validation Error. Body: ErrorResponse.
- `429`: `rate_limit_exceeded`: wait `Retry-After` seconds. Body: ErrorResponse.
- `500`: `internal_server_error` or `database_error` (type `internal_error`): our fault. Retry with backoff; quote `request_id`. Body: ErrorResponse.

## GET /v1/stores/{store_id}

**Get store by ID** (Stores)

Retrieve a single store by its internal UUID.

Parameters:

- `store_id` (path, string, required): The store's internal UUID.

Responses:

- `200`: The requested store. Body: StoreResponse.
- `401`: `missing_token`, `invalid_authorization_header` or `invalid_token`: get a new access token and retry once. Body: ErrorResponse.
- `403`: `insufficient_scope`: the API key lacks the scope this route needs. Body: ErrorResponse.
- `404`: Store not found. Body: ErrorResponse.
- `422`: Validation Error. Body: ErrorResponse.
- `429`: `rate_limit_exceeded`: wait `Retry-After` seconds. Body: ErrorResponse.
- `500`: `internal_server_error` or `database_error` (type `internal_error`): our fault. Retry with backoff; quote `request_id`. Body: ErrorResponse.

## PATCH /v1/stores/{store_id}

**Update store by ID** (Stores)

Partially update a store. Only include the fields you want to change. Omitted fields are left unchanged. Set a field to `null` to clear it.

Parameters:

- `store_id` (path, string, required): The store's internal UUID.
- `Idempotency-Key` (header, string (nullable)): Optional. When provided, retrying with the same key returns the original result.

Request body (`application/json`, StoreUpdateRequest):

- `address` (AddressInput (nullable))
  - `city` (string, required)
  - `country` (string, required)
  - `postal_code` (string, required)
  - `region` (string (nullable))
  - `street1` (string, required)
  - `street2` (string (nullable))
- `contact` (StoreContactInput (nullable))
  - `email` (string (nullable))
  - `phone` (string (nullable))
  - `website` (string (nullable))
- `external_ids` (object (nullable))
- `external_store_id` (string (nullable))
- `geo` (GeoLocationInput (nullable))
  - `latitude` (number, required)
  - `longitude` (number, required)
- `icon` (StoreMediaInput (nullable))
  - `content_type` (string, default `image/png`)
  - `url` (string, required)
- `logo` (StoreMediaInput (nullable))
  - `content_type` (string, default `image/png`)
  - `url` (string, required)
- `name` (string (nullable))
- `org_number` (string (nullable))
- `status` (string (nullable))
- `tags` (array of string (nullable))
- `timezone` (string (nullable))
- `type` (string (nullable))
- `vat_number` (string (nullable))

Responses:

- `200`: The updated store. Body: StoreResponse.
- `401`: `missing_token`, `invalid_authorization_header` or `invalid_token`: get a new access token and retry once. Body: ErrorResponse.
- `403`: `insufficient_scope`: the API key lacks the scope this route needs. Body: ErrorResponse.
- `404`: Store not found. Body: ErrorResponse.
- `422`: Validation Error. Body: ErrorResponse.
- `429`: `rate_limit_exceeded`: wait `Retry-After` seconds. Body: ErrorResponse.
- `500`: `internal_server_error` or `database_error` (type `internal_error`): our fault. Retry with backoff; quote `request_id`. Body: ErrorResponse.

## DELETE /v1/stores/{store_id}

**Delete store by ID** (Stores)

Soft-delete a store. The store is marked as deleted but not permanently removed.

Parameters:

- `store_id` (path, string, required): The store's internal UUID.

Responses:

- `204`: Store deleted successfully.
- `401`: `missing_token`, `invalid_authorization_header` or `invalid_token`: get a new access token and retry once. Body: ErrorResponse.
- `403`: `insufficient_scope`: the API key lacks the scope this route needs. Body: ErrorResponse.
- `404`: Store not found. Body: ErrorResponse.
- `422`: Validation Error. Body: ErrorResponse.
- `429`: `rate_limit_exceeded`: wait `Retry-After` seconds. Body: ErrorResponse.
- `500`: `internal_server_error` or `database_error` (type `internal_error`): our fault. Retry with backoff; quote `request_id`. Body: ErrorResponse.

## GET /v1/stores/{store_id}/products

**List a store's products** (Store Products)

List the products carried at a store with cursor pagination. Each item includes the per-store effective price. Pass `next_cursor` from the previous response as `cursor` for the next page.

Parameters:

- `store_id` (path, string, required): The store's internal UUID.
- `limit` (query, integer): Maximum number of products to return.
- `cursor` (query, string (nullable)): Opaque pagination token from a previous response.

Responses:

- `200`: Paginated list of the store's products. Body: StoreProductListResponse.
- `401`: `missing_token`, `invalid_authorization_header` or `invalid_token`: get a new access token and retry once. Body: ErrorResponse.
- `403`: `insufficient_scope`: the API key lacks the scope this route needs. Body: ErrorResponse.
- `404`: Store not found. Body: ErrorResponse.
- `422`: Validation Error. Body: ErrorResponse.
- `429`: `rate_limit_exceeded`: wait `Retry-After` seconds. Body: ErrorResponse.
- `500`: `internal_server_error` or `database_error` (type `internal_error`): our fault. Retry with backoff; quote `request_id`. Body: ErrorResponse.

## GET /v1/transactions

**List transactions** (Transactions)

List transactions for the authenticated company with offset pagination. Filter by status to narrow results. Returns an empty array if no transactions match.

Parameters:

- `limit` (query, integer): Maximum number of transactions to return (1–200).
- `offset` (query, integer): Number of transactions to skip.
- `status` (query, string (nullable)): Filter by transaction status (e.g. `pending`, `resolved`).

Responses:

- `200`: Paginated list of transactions. Body: TransactionListResponse.
- `401`: `missing_token`, `invalid_authorization_header` or `invalid_token`: get a new access token and retry once. Body: ErrorResponse.
- `403`: `insufficient_scope`: the API key lacks the scope this route needs. Body: ErrorResponse.
- `422`: Validation Error. Body: ErrorResponse.
- `429`: `rate_limit_exceeded`: wait `Retry-After` seconds. Body: ErrorResponse.
- `500`: `internal_server_error` or `database_error` (type `internal_error`): our fault. Retry with backoff; quote `request_id`. Body: ErrorResponse.

## POST /v1/transactions

**Create a transaction** (Transactions)

Create a new transaction for the authenticated company. Line totals and basket totals are derived server-side from the submitted items; client-sent totals are ignored.

**Duplicates.** Send the till's own id as `external.external_transaction_id` on every sale; an `Idempotency-Key` header is optional and honoured as well. Posting again under the same id or key with the same content (a network retry) books nothing new and answers `200` with the original transaction and the header `Idempotent-Replayed: true`. The same id with different content answers `409` `external_transaction_id_conflict`; a key reused for a different sale answers `409` `idempotency_key_reused`. Content means the type, currency, `external` fields and the lines' and discounts' values; `member` and `metadata` are not compared.

Parameters:

- `Idempotency-Key` (header, string (nullable)): Optional. Retrying with the same key returns the original transaction (`200`, `Idempotent-Replayed: true`); the same key with a different body is `409`.

Request body (`application/json`, TransactionCreateRequest):

- `country_code` (string, default `SE`)
- `currency` (string, default `SEK`)
- `discounts` (array of TransactionDiscountInput)
  - `amount` (PriceInput (transaction), required)
    - `currency` (string, default `SEK`)
    - `value` (integer, required)
  - `description` (string, default ``)
  - `personal_offer_id` (string (nullable)): Stored as the transaction's `offer_id`: the v2 Offer this discount came from, for sale attribution only. Not an entitlement id — entitlements are not redeemed on this surface.
  - `type` (string, required)
- `external` (ExternalFieldsInput, required)
  - `cashier_id` (string (nullable))
  - `cashier_name` (string (nullable))
  - `control_unit_code` (string (nullable))
  - `external_store_id` (string (nullable))
  - `external_transaction_id` (string (nullable))
  - `pos_serial` (string (nullable))
  - `pos_system` (string (nullable))
  - `purchased_at` (string (nullable))
  - `receipt_number` (string (nullable))
- `items` (array of ItemInput)
  - `description` (string (nullable))
  - `discounts` (array of DiscountInput)
    - `amount` (PriceInput (transaction), required)
    - `description` (string, default ``)
    - `personal_offer_id` (string (nullable)): Stored as the transaction's `offer_id`: the v2 Offer this discount came from, for sale attribution only. Not an entitlement id — entitlements are not redeemed on this surface.
    - `type` (string, required)
  - `external_product_id` (string (nullable))
  - `identifiers` (array of IdentifierInput (transaction))
    - `type` (string, required)
    - `value` (string, required)
  - `loyalty_eligible` (boolean, default `true`)
  - `product_id` (string (nullable))
  - `product_name` (string (nullable))
  - `quantity` (QuantityInput, required)
    - `unit` (string, default `ea`)
    - `value` (integer, required)
  - `sequence_number` (integer, default `0`)
  - `tax_rate` (integer, default `0`)
  - `unit_price` (PriceInput (transaction), required)
    - `currency` (string, default `SEK`)
    - `value` (integer, required)
- `locale` (string, default `sv-SE`)
- `member` (array of MemberIdentifierInput)
  - `identifier` (string, required)
  - `value` (string, required)
- `metadata` (object)
- `origin` (string, default `pos`)
- `store_id` (string (nullable))
- `totals` (TransactionTotalsInput (nullable)): The `sale` shape — send instead of `items` when the POS knows only what the member paid. Mutually exclusive with `items`.
  - `currency` (string (nullable)): ISO 4217 code. Defaults to the transaction currency.
  - `paid_minor` (integer, required): What the member paid, in minor units (öre). Use when the POS has no line items; the API records one synthetic, non-eligible line so amount-based programs can earn.
- `transaction_type` (string, default `purchase`)
- `user_id` (string (nullable))

Responses:

- `200`: Replay: this `external_transaction_id` was already booked with the same content. The body is the original transaction; the response carries `Idempotent-Replayed: true`.
- `201`: The created transaction, including computed totals and loyalty outcome. Body: TransactionResponse.
- `401`: `missing_token`, `invalid_authorization_header` or `invalid_token`: get a new access token and retry once. Body: ErrorResponse.
- `403`: `insufficient_scope`: the API key lacks the scope this route needs. Body: ErrorResponse.
- `409`: `external_transaction_id_conflict`: this `external_transaction_id` is already booked with different content; `idempotency_key_reused`: this `Idempotency-Key` was used for a different sale. Body: ErrorResponse.
- `422`: Validation Error. Body: ErrorResponse.
- `429`: `rate_limit_exceeded`: wait `Retry-After` seconds. Body: ErrorResponse.
- `500`: `internal_server_error` or `database_error` (type `internal_error`): our fault. Retry with backoff; quote `request_id`. Body: ErrorResponse.

## GET /v1/transactions/{transaction_id}

**Get transaction detail** (Transactions)

Retrieve a single transaction by its internal UUID.

Parameters:

- `transaction_id` (path, string, required): The transaction's internal UUID.

Responses:

- `200`: The requested transaction. Body: TransactionResponse.
- `401`: `missing_token`, `invalid_authorization_header` or `invalid_token`: get a new access token and retry once. Body: ErrorResponse.
- `403`: `insufficient_scope`: the API key lacks the scope this route needs. Body: ErrorResponse.
- `404`: Transaction not found. Body: ErrorResponse.
- `422`: Validation Error. Body: ErrorResponse.
- `429`: `rate_limit_exceeded`: wait `Retry-After` seconds. Body: ErrorResponse.
- `500`: `internal_server_error` or `database_error` (type `internal_error`): our fault. Retry with backoff; quote `request_id`. Body: ErrorResponse.

## Schemas

### AddressInput

Nordic-compatible address input.

- `city` (string, required)
- `country` (string, required)
- `postal_code` (string, required)
- `region` (string (nullable))
- `street1` (string, required)
- `street2` (string (nullable))

### AddressResponse

Address in response.

- `city` (string, required)
- `country` (string, required)
- `postal_code` (string, required)
- `region` (string (nullable))
- `street1` (string, required)
- `street2` (string (nullable))

### Body_issue_token_v1_auth_token_post

- `grant_type` (string, required): OAuth2 grant type — must be `client_credentials`.

### BulkItemError

Why one bulk item was not written.

- `code` (string, required): Machine-readable error code, as on single-item calls.
- `message` (string, required): Human-readable explanation; do not parse it.
- `param` (string (nullable)): The offending field, prefixed with the item's position (`products.<i>.`).

### CursorPaginationMeta

Pagination metadata for cursor-based list responses.

- `has_more` (boolean, required): Whether more items exist
- `limit` (integer, required): Maximum items per page
- `next_cursor` (string (nullable)): Opaque cursor token for the next page

### DiscountInput

Per-item discount in a create request.

- `amount` (PriceInput (transaction), required)
- `description` (string, default ``)
- `personal_offer_id` (string (nullable)): Stored as the transaction's `offer_id`: the v2 Offer this discount came from, for sale attribution only. Not an entitlement id — entitlements are not redeemed on this surface.
- `type` (string, required)

### DiscountResponse

Discount in response (line-level or basket-level).

- `amount` (PriceSchema, required)
- `description` (string, default ``)
- `personal_offer_id` (string (nullable)): The transaction's `offer_id`: the v2 Offer the discount came from, echoed under this surface's field name.
- `type` (string, required)

### ErrorDetail

Error detail structure (Stripe-like format).

- `code` (string, required): Machine-readable error code
- `details` (array of FieldErrorDetail (nullable)): On `invalid_fields` (422) only: one entry per failing field
- `doc_url` (string (nullable)): Link to the errors guide
- `message` (string, required): Human-readable error message
- `param` (string (nullable)): Parameter that caused the error
- `type` (string, required): Error type category

### ErrorResponse

Standard error response format.

- `error` (ErrorDetail, required)
- `request_id` (string (nullable)): Request ID for support

### ExternalFieldsInput

External POS fields — all optional, stored as-received.

- `cashier_id` (string (nullable))
- `cashier_name` (string (nullable))
- `control_unit_code` (string (nullable))
- `external_store_id` (string (nullable))
- `external_transaction_id` (string (nullable))
- `pos_serial` (string (nullable))
- `pos_system` (string (nullable))
- `purchased_at` (string (nullable))
- `receipt_number` (string (nullable))

### FieldErrorDetail

One failing field of a validation error.

- `message` (string, required): Why the value was refused
- `param` (string, required): Dotted path of the field, e.g. `items.0.unit_price.value`

### GeoLocationInput

GPS coordinate input.

- `latitude` (number, required)
- `longitude` (number, required)

### GeoLocationResponse

Geo location in response.

- `latitude` (number, required)
- `longitude` (number, required)

### IdentifierInput-Output

Product identifier (gtin, sku, etc.).

- `type` (string, required)
- `value` (string, required)

### IdentifierResponse

Typed product identifier in API responses.

- `type` (string, required)
- `value` (string, required)

### ItemInput

Line item in a transaction create request. total_discount and total_amount are computed by the domain model from unit_price, quantity, and discounts — not accepted in input.

- `description` (string (nullable))
- `discounts` (array of DiscountInput)
- `external_product_id` (string (nullable))
- `identifiers` (array of IdentifierInput (transaction))
- `loyalty_eligible` (boolean, default `true`)
- `product_id` (string (nullable))
- `product_name` (string (nullable))
- `quantity` (QuantityInput, required)
- `sequence_number` (integer, default `0`)
- `tax_rate` (integer, default `0`)
- `unit_price` (PriceInput (transaction), required)

### ItemResponse

Line item in a transaction response — includes computed fields.

- `description` (string (nullable))
- `discounts` (array of DiscountResponse)
- `external_product_id` (string (nullable))
- `identifiers` (array of IdentifierInput-Output)
- `loyalty_eligible` (boolean, required)
- `product_id` (string (nullable))
- `product_name` (string (nullable))
- `quantity` (QuantityInput, required)
- `sequence_number` (integer, required)
- `tax_rate` (integer, required)
- `total_amount` (PriceSchema, required)
- `total_discount` (PriceSchema, required)
- `unit_price` (PriceSchema, required)

### LoyaltyCycleResponse

The membership's current loyalty cycle.

- `length` (integer (nullable), required): Cycle length in the program's unit, or null when unbounded.
- `progress_pct` (integer (nullable), required): How full the current cycle is, 0-100, or null when the cycle is unbounded.
- `seq` (integer, required): Current cycle sequence number.
- `started_at` (string, required): When the current cycle started (UTC).

### LoyaltyProgramResponse

The loyalty program backing this membership.

- `id` (string, required): Loyalty program id.
- `name` (string, required): Loyalty program name.

### LoyaltyResponse

Loyalty block in responses. Pre-populated with empty keys, filled by the loyalty engine after processing.

- `cycle` (integer (nullable))
- `exchange_rate_used` (object (nullable))
- `points_deducted` (integer (nullable))
- `points_earned` (integer, default `0`)
- `post_balance` (integer, default `0`)
- `pre_balance` (integer, default `0`)
- `processed_at` (string (nullable))
- `refund_processed_at` (string (nullable))
- `refund_type` (string (nullable))
- `stamps_earned` (integer, default `0`)

### LoyaltyUnitResponse

The program's unit — what the balance number counts and how it renders. For a `currency` unit (cashback) the balance is money in minor units, so the unit also says which currency and how to format it, the same `minor_units` + `locale` pair every price on this API carries. All three are null for `counter` and `card`, whose balance is a plain count.

- `currency` (string (nullable)): ISO 4217 code of a `currency` unit; null for `counter` and `card`.
- `label` (string, required): Human label for the unit (e.g. `points`, `stamps`).
- `locale` (string (nullable)): RFC 5646 locale to format a `currency` balance (e.g. `sv-SE`); null otherwise.
- `minor_units` (integer (nullable)): Divisor from the balance to major units (e.g. 100 for SEK) for a `currency` unit; null otherwise.
- `presentation` (string, required): How the unit is presented: `counter`, `card`, or `currency`.

### MemberIdentifierInput

Member identifier (user_id, membership_id, mobile_number, email, social_security_number).

- `identifier` (string, required)
- `value` (string, required)

### MembershipDetailResponse

Detail response for a membership — flat across loyalty program types. ``balance`` is the ledger's projection, unconditional: points balance for a points program, stamp count in the current cycle for a stamps program. ``stamps_dates`` is populated only for a stamp card.

- `balance` (integer, required): Program-agnostic primary value: points balance for `points`, stamp count in the current cycle for `stamps`.
- `celebration` (boolean, required): Whether a reward-earned UI should be shown
- `created_at` (string, required)
- `cycle` (integer, required): Current cycle number (starts at 1)
- `cycle_length` (integer (nullable)): Size of the current cycle in the program's unit (e.g. 10 for a 10-stamp card), so a till can show `balance` of `cycle_length`. Null when the cycle is unbounded or there is no program.
- `full_name` (string, required): Member's full name
- `loyalty_program_type` (string (nullable), required): `points` or `stamps`, derived from the loyalty program's unit presentation — a card is `stamps`, a counter is `points`. Null when the member is on no resolvable program (not enrolled, or the program is gone), or when the unit's presentation has no value in this contract yet; never an error.
- `membership_id` (string, required): Membership id
- `stamps_dates` (array of string (nullable)): Timestamps of stamps in the current cycle; null for points programs.
- `status` (MembershipStatus, required): Membership status
- `unit` (LoyaltyUnitResponse (nullable)): What `balance` counts and how to show it (label, presentation, and for a `currency` unit the currency, `minor_units` and `locale`). Null when the member is on no resolvable program.
- `updated_at` (string, required)
- `user_id` (string, required): Owning user id

### MembershipLookupRequest

Body for ``POST /memberships/lookup`` — discriminator + value. ``membership_id`` and ``user_id`` match top-level Membership fields. ``qr_code`` is the raw string scanned off a member's QR code, in either generation: a ``lx1_`` rotating token (v2) or a bare ``user_id`` UUID (legacy v1). ``mobile_number``, ``email``, and ``national_id`` match entries in ``required_member_fields``.

- `identifier` (string (one of `membership_id`, `user_id`, `qr_code`, `mobile_number`, `email`, `national_id`), required): Which field to look up by. One of ``membership_id``, ``user_id``, ``qr_code``, ``mobile_number``, ``email``, ``national_id``.
- `value` (string, required): Identifier value. Format depends on ``identifier``. For ``qr_code``, pass the scanned string unchanged — the API tells the two QR generations apart on its own.

### MembershipLoyaltyResponse

Unit-agnostic loyalty state for one membership. ``punches`` is populated only when ``unit.presentation`` is `card` — for a `counter` or `currency` program it is `null`, never an empty list, since an empty list would mean "a card with no punches yet" rather than "not a card".

- `balance` (integer, required): Current balance in the program's unit.
- `cycle` (LoyaltyCycleResponse, required): The membership's current cycle.
- `program` (LoyaltyProgramResponse, required)
- `punches` (array of string (nullable), required): Punch moments for a `card` presentation; `null` for `counter`/`currency`.
- `unit` (LoyaltyUnitResponse, required): The program's unit label and presentation.

### PaginationMeta

Pagination metadata for list responses.

- `has_more` (boolean, required): Whether more items exist
- `limit` (integer, required): Maximum items per page
- `offset` (integer, required): Number of items skipped
- `total` (integer, required): Total number of items

### PriceSchema

Monetary amount in minor units + currency code + formatting metadata (response). Includes minor_units (divisor to convert to major units) and locale (RFC 5646) so the client can display prices without hardcoding rules.

- `currency` (string, default `SEK`): ISO 4217 currency code
- `locale` (string, required): RFC 5646 locale for formatting (e.g. sv-SE)
- `minor_units` (integer, required): Divisor to convert to major units (e.g. 100 for SEK)
- `value` (integer, required): Amount in minor units (e.g. öre, cents)

### ProductBulkUpsertItem

One product in a bulk upsert. Same body as create, but the key is required. Without `external_product_id` a retried bulk call would create duplicates, so the bulk endpoint only accepts keyed items.

- `brand` (string (nullable)): Manufacturer or brand name.
- `categories` (array of string): Category labels defined on the company. Must match existing categories.
- `description` (string (nullable)): Long-form product description.
- `external_product_id` (string, required): Your product key — the upsert match key. Required in a bulk call.
- `identifiers` (array of IdentifierInput (product)): Typed identifiers (gtin/ean13/ean8/sku/pos). Each (type, value) pair must be unique per company across non-deleted products.
- `image_link` (string (nullable)): Public URL of the product's primary image.
- `is_loyalty_program_eligible` (boolean, default `true`): When true, purchases of this product accrue loyalty points or stamps.
- `loyx_app_active` (boolean, default `true`): When true, the product is visible in the consumer LoyX app.
- `loyx_business_app_active` (boolean, default `true`): When true, the product is visible in the LoyX Business (staff) app.
- `name` (string, required): Display name shown in the mobile app and digital receipts.
- `page_url` (string (nullable)): Public URL of the product's web page.
- `price` (PriceInput (product), required): Base price in minor units paired with a currency code.
- `stores` (array of ProductStoreInput, required): Stores that carry this product — at least one. Each entry may set a per-store price override.
- `unit` (string, default `ea`): Unit the product is sold in (ea, kg, g, l, ml, m, pack). Defaults to `ea` (each).

### ProductBulkUpsertRequest

Up to 100 products, each created or updated by its `external_product_id`.

- `products` (array of ProductBulkUpsertItem, required): 1–100 products. Each is upserted independently; one failing item does not roll back the others. A key may appear only once per request.

### ProductBulkUpsertResponse

Per-item results plus counts. Always 207 Multi-Status, even when some items failed.

- `created` (integer, required): How many items created a new product.
- `failed` (integer, required): How many items were not written; see their `error`.
- `results` (array of ProductBulkUpsertResult, required): One result per request item, in request order.
- `updated` (integer, required): How many items updated an existing product.

### ProductBulkUpsertResult

Outcome of one bulk item, in request order.

- `error` (BulkItemError (nullable)): Set only when `status` is `failed`.
- `external_product_id` (string, required): The item's match key, as stored.
- `index` (integer, required): Position of the item in the request `products` array.
- `product` (ProductResponse (nullable)): The stored product; null when `status` is `failed`.
- `status` (string (one of `created`, `updated`, `failed`), required): `created` (new product), `updated` (key matched) or `failed`.

### ProductCreateRequest

Create a new product in the company's catalog.

- `brand` (string (nullable)): Manufacturer or brand name.
- `categories` (array of string): Category labels defined on the company. Must match existing categories.
- `description` (string (nullable)): Long-form product description.
- `external_product_id` (string (nullable)): Your own product key (till/POS/ERP article id). Unique per company. When set, `POST /products` upserts on it: an existing product with this key is updated instead of a duplicate being created. Sale lines that carry an unknown key create a minimal product with it.
- `identifiers` (array of IdentifierInput (product)): Typed identifiers (gtin/ean13/ean8/sku/pos). Each (type, value) pair must be unique per company across non-deleted products.
- `image_link` (string (nullable)): Public URL of the product's primary image.
- `is_loyalty_program_eligible` (boolean, default `true`): When true, purchases of this product accrue loyalty points or stamps.
- `loyx_app_active` (boolean, default `true`): When true, the product is visible in the consumer LoyX app.
- `loyx_business_app_active` (boolean, default `true`): When true, the product is visible in the LoyX Business (staff) app.
- `name` (string, required): Display name shown in the mobile app and digital receipts.
- `page_url` (string (nullable)): Public URL of the product's web page.
- `price` (PriceInput (product), required): Base price in minor units paired with a currency code.
- `stores` (array of ProductStoreInput, required): Stores that carry this product — at least one. Each entry may set a per-store price override.
- `unit` (string, default `ea`): Unit the product is sold in (ea, kg, g, l, ml, m, pack). Defaults to `ea` (each).

### ProductListResponse

Paginated list of products.

- `data` (array of ProductResponse, required)
- `pagination` (PaginationMeta, required)

### ProductResponse

Catalog-only product response. Per-store pricing lives in the stores_products schemas (`GET /stores/{store_id}/products`).

- `_id` (string, required)
- `brand` (string (nullable))
- `categories` (array of string)
- `company_category` (string (nullable))
- `company_display_name` (string (nullable))
- `company_logo_url` (string (nullable))
- `created_at` (string, required)
- `description` (string (nullable))
- `external_product_id` (string (nullable)): Your product key, when one is set.
- `identifiers` (array of IdentifierResponse)
- `image_link` (string (nullable))
- `is_loyalty_program_eligible` (boolean, required)
- `loyx_app_active` (boolean, required)
- `loyx_business_app_active` (boolean, required)
- `name` (string, required)
- `page_url` (string (nullable))
- `price` (PriceSchema (nullable), required)
- `unit` (string, required)
- `updated_at` (string, required)

### ProductStoreEntryResponse

One store that carries the product, with per-store pricing.

- `created_at` (string, required): When the product was added to this store's assortment.
- `effective_price` (PriceSchema (nullable), required): Unit price at this store: the override when set, else the base price. Null when neither is set.
- `price_override` (PriceSchema (nullable)): Per-store price override; null when the base price applies.
- `store_id` (string, required): Internal UUID of the store.
- `store_name` (string (nullable)): Display name of the store.

### ProductStoreInput

Store assortment entry: a store that carries the product.

- `price` (PriceInput (product) (nullable)): Optional per-store price override. When omitted, the store uses the product's base price. Currency must match the base price.
- `store_id` (string, required): Internal UUID of a store that carries this product.

### ProductStoresListResponse

Stores carrying a product — bounded by store count, no pagination.

- `data` (array of ProductStoreEntryResponse, required)

### ProductUpdateRequest

Partial update for an existing product. Only fields explicitly sent in the request body are applied. Fields sent as `null` clear their value, except `price`, `name`, `loyx_app_active`, `loyx_business_app_active` and `is_loyalty_program_eligible`, which cannot be cleared; omitted fields are left unchanged. Immutable fields (company_id, company_logo_url, etc.) are rejected at the service layer.

- `brand` (string (nullable)): Updated manufacturer or brand name.
- `categories` (array of string (nullable)): Full replacement of the category list.
- `description` (string (nullable)): Updated long-form description.
- `external_product_id` (string (nullable)): Set or change your product key. Cannot be cleared. 409 `external_product_id_conflict` when another product of the company (including a deleted one) already has it.
- `identifiers` (array of IdentifierInput (product) (nullable)): Full replacement of the typed identifier list (gtin/ean13/ean8/sku/pos). Send `[]` to clear all identifiers.
- `is_loyalty_program_eligible` (boolean (nullable)): Whether purchases of this product accrue loyalty points or stamps.
- `loyx_app_active` (boolean (nullable)): Visibility toggle for the consumer LoyX app.
- `loyx_business_app_active` (boolean (nullable)): Visibility toggle for the LoyX Business (staff) app.
- `name` (string (nullable)): Updated display name.
- `page_url` (string (nullable)): Updated public URL of the product page.
- `price` (PriceInput (product) (nullable)): Updated base price.
- `stores` (array of ProductStoreInput (nullable)): Full replacement of the store assortment. When sent, stores not listed are delisted and new stores are added. Omit to leave the assortment unchanged.
- `unit` (string (nullable)): Updated unit (ea, kg, g, l, ml, m, pack).

### QuantityInput

Quantity with unit.

- `unit` (string, default `ea`)
- `value` (integer, required)

### RewardBenefitResponse

What the member gets. Which fields are set depends on `kind`.

- `amount` (RewardPriceResponse (nullable)): Fixed amount off, for `amount`.
- `description` (string (nullable)): Fine print; for `text` it is the whole benefit.
- `kind` (string, required): Benefit kind: `percent`, `amount`, `fixed_price`, `free_item`, `text`, `bundle_price`, `bundle_percent` or `multibuy`. Open enum: handle unknown values by showing `description`.
- `pay_quantity` (integer (nullable)): Items paid for in a `multibuy` (buy `quantity`, pay this).
- `per` (string (nullable)): Unit a `fixed_price` applies per.
- `percent` (integer (nullable)): Percent off (1-100) for percent kinds.
- `price` (RewardPriceResponse (nullable)): New price per unit (`fixed_price`) or bundle total (`bundle_price`).
- `quantity` (integer (nullable)): Items in a bundle or multibuy.

### RewardListResponse

Cursor-paginated list of a member's redeemable rewards, newest first.

- `data` (array of RewardResponse, required): Rewards, newest first.
- `pagination` (CursorPaginationMeta, required): Cursor pagination metadata.

### RewardPriceResponse

Money in minor units with the currency and how to format it.

- `currency` (string, required): ISO 4217 currency code.
- `locale` (string, required): RFC 5646 locale for formatting (e.g. `sv-SE`).
- `minor_units` (integer, required): Divisor to convert to major units (e.g. 100 for SEK).
- `value` (integer, required): Amount in minor units (e.g. öre, cents).

### RewardResponse

One reward the member can redeem now, at the store asked about.

- `_id` (string, required): The reward's id (the member's entitlement); redemption will take this id.
- `benefit` (RewardBenefitResponse (nullable), required): What the member gets; null when the offer has no deal cell.
- `created_at` (string, required): When the member received it (UTC).
- `max_redemptions` (integer (nullable), required): How many times the reward may be used in total; null for unlimited.
- `membership_id` (string, required): The member holding the reward.
- `offer_id` (string, required): The offer the reward was granted from.
- `terms_and_conditions` (array of string, required): Terms lines to show the cashier.
- `times_redeemed` (integer, required): How many times it has been used so far.
- `title` (string, required): Display title.
- `valid_from` (string (nullable), required): Start of the validity window (UTC).
- `valid_to` (string (nullable), required): End of the validity window (UTC), if any.

### StoreContactInput

Store contact details.

- `email` (string (nullable))
- `phone` (string (nullable))
- `website` (string (nullable))

### StoreContactResponse

Contact info in response.

- `email` (string (nullable))
- `phone` (string (nullable))
- `website` (string (nullable))

### StoreCreateRequest

Request schema for creating a store. address and geo are required for physical/pop_up stores, optional for online/warehouse stores.

- `address` (AddressInput (nullable))
- `contact` (StoreContactInput (nullable))
- `external_ids` (object)
- `external_store_id` (string, required)
- `geo` (GeoLocationInput (nullable))
- `icon` (StoreMediaInput (nullable))
- `logo` (StoreMediaInput (nullable))
- `name` (string, required)
- `org_number` (string (nullable))
- `status` (string, default `active`)
- `tags` (array of string)
- `timezone` (string, required)
- `type` (string, default `physical`)
- `vat_number` (string (nullable))

### StoreListResponse

Paginated list of stores.

- `data` (array of StoreResponse, required)
- `pagination` (PaginationMeta, required)

### StoreMediaInput

Logo/icon URL reference.

- `content_type` (string, default `image/png`)
- `url` (string, required)

### StoreMediaResponse

Media reference in response.

- `content_type` (string, required)
- `url` (string, required)

### StoreProductListResponse

Cursor-paginated list of a store's products.

- `data` (array of StoreProductResponse, required)
- `pagination` (CursorPaginationMeta, required)

### StoreProductResponse

A product as carried at one store.

- `_id` (string, required): Product UUID.
- `brand` (string (nullable))
- `categories` (array of string)
- `effective_price` (PriceSchema (nullable)): Unit price at this store: the override when set, else the base price. Null when neither is set.
- `image_link` (string (nullable))
- `name` (string (nullable))
- `price` (PriceSchema (nullable)): Company-wide base price.
- `price_override` (PriceSchema (nullable)): Per-store price override; null when the base price applies.

### StoreResponse

Full store response — excludes company_id.

- `_id` (string, required)
- `address` (AddressResponse (nullable))
- `contact` (StoreContactResponse (nullable))
- `created_at` (string, required)
- `external_ids` (object)
- `external_store_id` (string (nullable))
- `geo` (GeoLocationResponse (nullable))
- `icon` (StoreMediaResponse (nullable))
- `logo` (StoreMediaResponse (nullable))
- `name` (string, required)
- `org_number` (string (nullable))
- `status` (string, required)
- `tags` (array of string)
- `timezone` (string, required)
- `type` (string, required)
- `updated_at` (string, required)
- `vat_number` (string (nullable))

### StoreUpdateRequest

Request schema for partially updating a store. All fields are optional. Only provided fields are applied.

- `address` (AddressInput (nullable))
- `contact` (StoreContactInput (nullable))
- `external_ids` (object (nullable))
- `external_store_id` (string (nullable))
- `geo` (GeoLocationInput (nullable))
- `icon` (StoreMediaInput (nullable))
- `logo` (StoreMediaInput (nullable))
- `name` (string (nullable))
- `org_number` (string (nullable))
- `status` (string (nullable))
- `tags` (array of string (nullable))
- `timezone` (string (nullable))
- `type` (string (nullable))
- `vat_number` (string (nullable))

### TokenResponse

OAuth2 Client Credentials token response.

- `access_token` (string, required): Opaque bearer token
- `expires_in` (integer, required): Token lifetime in seconds from issuance
- `scope` (string, default ``): The scopes this token carries, space-separated (RFC 6749 §5.1), for example `members:read sales:write`. They are the API key's scopes at issuance; a scope change in the Portal ends the token at once.
- `token_type` (string, default `bearer`): Always 'bearer'

### TotalResponse

Single totals entry. Value is integer minor units. Currency is on the transaction root — not duplicated here.

- `type` (string, required)
- `value` (integer, required)

### TransactionCreateRequest

Request schema for creating a transaction. totals and loyalty are excluded: - totals are derived server-side from items - loyalty is populated by the loyalty engine - status is computed from resolution results

- `country_code` (string, default `SE`)
- `currency` (string, default `SEK`)
- `discounts` (array of TransactionDiscountInput)
- `external` (ExternalFieldsInput, required)
- `items` (array of ItemInput)
- `locale` (string, default `sv-SE`)
- `member` (array of MemberIdentifierInput)
- `metadata` (object)
- `origin` (string, default `pos`)
- `store_id` (string (nullable))
- `totals` (TransactionTotalsInput (nullable)): The `sale` shape — send instead of `items` when the POS knows only what the member paid. Mutually exclusive with `items`.
- `transaction_type` (string, default `purchase`)
- `user_id` (string (nullable))

### TransactionDiscountInput

Basket-level discount in a create request.

- `amount` (PriceInput (transaction), required)
- `description` (string, default ``)
- `personal_offer_id` (string (nullable)): Stored as the transaction's `offer_id`: the v2 Offer this discount came from, for sale attribution only. Not an entitlement id — entitlements are not redeemed on this surface.
- `type` (string, required)

### TransactionListResponse

Paginated list of transaction summaries.

- `data` (array of TransactionSummaryResponse, required)
- `pagination` (PaginationMeta, required)

### TransactionResponse

Full transaction response for detail endpoints.

- `_id` (string, required)
- `company_id` (string, required)
- `country_code` (string, required)
- `created_at` (string, required)
- `currency` (string, required)
- `discounts` (array of DiscountResponse)
- `external` (ExternalFieldsInput, required)
- `items` (array of ItemResponse, required)
- `locale` (string, required)
- `loyalty` (LoyaltyResponse (nullable))
- `member` (array of MemberIdentifierInput, required)
- `membership_id` (string (nullable))
- `metadata` (object)
- `origin` (string (nullable))
- `status` (string, default `unresolved`)
- `store_id` (string (nullable))
- `totals` (array of TotalResponse, required)
- `transaction_type` (string, required)
- `updated_at` (string, required)
- `user_id` (string (nullable))
- `voided_at` (string (nullable))

### TransactionSummaryResponse

Lighter transaction response for list endpoints.

- `_id` (string, required)
- `company_id` (string, required)
- `created_at` (string, required)
- `currency` (string, required)
- `origin` (string (nullable))
- `status` (string, default `unresolved`)
- `totals` (array of TotalResponse, required)
- `transaction_type` (string, required)
- `voided_at` (string (nullable))

### TransactionTotalsInput

What the member paid, when the POS cannot send the basket. The `sale` shape: a register that knows the receipt total but not its line items. `to_model` turns this into exactly one synthetic, non-eligible line so everything downstream — `calculate_and_store_totals`, the ledger engine, the reversal path — sees the ordinary document shape it already handles. Nothing measured on selected lines can earn from it, which is why the line is deliberately not loyalty-eligible. The transaction records **VAT 0, and NET equal to PAID**: a register that cannot send line items cannot send their tax rates either, and the receipt total alone does not say what the split was. Splitting it would mean guessing a rate, which is a worse answer than none for Skatteverket. A transaction that must carry VAT has to send `items`.

- `currency` (string (nullable)): ISO 4217 code. Defaults to the transaction currency.
- `paid_minor` (integer, required): What the member paid, in minor units (öre). Use when the POS has no line items; the API records one synthetic, non-eligible line so amount-based programs can earn.

### IdentifierInput (product)

Typed product identifier (gtin / ean13 / ean8 / sku / pos).

- `type` (string, required): Identifier type: gtin, ean13, ean8, sku, or pos.
- `value` (string, required)

### PriceInput (product)

Monetary amount in minor units + currency code (request input).

- `currency` (string, default `SEK`): ISO 4217 currency code
- `value` (integer, required): Amount in minor units (e.g. öre, cents)

### IdentifierInput (transaction)

Product identifier (gtin, sku, etc.).

- `type` (string, required)
- `value` (string, required)

### PriceInput (transaction)

Monetary amount in minor units + ISO 4217 currency (request input).

- `currency` (string, default `SEK`)
- `value` (integer, required)
