Create or upsert a product
const url = 'https://api.loyx.se/partners/v1/products';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"brand":"example","categories":["example"],"description":"example","external_product_id":"example","identifiers":[{"type":"example","value":"example"}],"image_link":"example","is_loyalty_program_eligible":true,"loyx_app_active":true,"loyx_business_app_active":true,"name":"example","page_url":"example","price":{"currency":"SEK","value":1},"stores":[{"price":{"currency":"SEK","value":1},"store_id":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}],"unit":"ea"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.loyx.se/partners/v1/products \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "brand": "example", "categories": [ "example" ], "description": "example", "external_product_id": "example", "identifiers": [ { "type": "example", "value": "example" } ], "image_link": "example", "is_loyalty_program_eligible": true, "loyx_app_active": true, "loyx_business_app_active": true, "name": "example", "page_url": "example", "price": { "currency": "SEK", "value": 1 }, "stores": [ { "price": { "currency": "SEK", "value": 1 }, "store_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" } ], "unit": "ea" }'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.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”Create a new product in the company’s catalog.
object
Category labels defined on the company. Must match existing categories.
Typed identifiers (gtin/ean13/ean8/sku/pos). Each (type, value) pair must be unique per company across non-deleted products.
Typed product identifier (gtin / ean13 / ean8 / sku / pos).
object
Identifier type: gtin, ean13, ean8, sku, or pos.
When true, purchases of this product accrue loyalty points or stamps.
When true, the product is visible in the consumer LoyX app.
When true, the product is visible in the LoyX Business (staff) app.
Display name shown in the mobile app and digital receipts.
Base price in minor units paired with a currency code.
object
ISO 4217 currency code
Amount in minor units (e.g. öre, cents)
Stores that carry this product — at least one. Each entry may set a per-store price override.
Store assortment entry: a store that carries the product.
object
Monetary amount in minor units + currency code (request input).
object
ISO 4217 currency code
Amount in minor units (e.g. öre, cents)
Internal UUID of a store that carries this product.
Unit the product is sold in (ea, kg, g, l, ml, m, pack). Defaults to ea (each).
Responses
Section titled “Responses”A product with this external_product_id existed and was updated.
A new product was created.
Catalog-only product response.
Per-store pricing lives in the stores_products schemas
(GET /stores/{store_id}/products).
object
Typed product identifier in API responses.
object
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.
object
ISO 4217 currency code
RFC 5646 locale for formatting (e.g. sv-SE)
Divisor to convert to major units (e.g. 100 for SEK)
Amount in minor units (e.g. öre, cents)
Example
{ "price": { "currency": "SEK" }}missing_token, invalid_authorization_header or invalid_token: get a new access token and retry once.
Standard error response format.
object
Error detail structure (Stripe-like format).
object
Machine-readable error code
One failing field of a validation error.
object
Why the value was refused
Dotted path of the field, e.g. items.0.unit_price.value
Human-readable error message
Error type category
Example generated
{ "error": { "code": "example", "details": [ { "message": "example", "param": "example" } ], "doc_url": "example", "message": "example", "param": "example", "type": "example" }, "request_id": "example"}insufficient_scope: the API key lacks the scope this route needs.
Standard error response format.
object
Error detail structure (Stripe-like format).
object
Machine-readable error code
One failing field of a validation error.
object
Why the value was refused
Dotted path of the field, e.g. items.0.unit_price.value
Human-readable error message
Error type category
Example generated
{ "error": { "code": "example", "details": [ { "message": "example", "param": "example" } ], "doc_url": "example", "message": "example", "param": "example", "type": "example" }, "request_id": "example"}Validation Error
Standard error response format.
object
Error detail structure (Stripe-like format).
object
Machine-readable error code
One failing field of a validation error.
object
Why the value was refused
Dotted path of the field, e.g. items.0.unit_price.value
Human-readable error message
Error type category
Example generated
{ "error": { "code": "example", "details": [ { "message": "example", "param": "example" } ], "doc_url": "example", "message": "example", "param": "example", "type": "example" }, "request_id": "example"}rate_limit_exceeded: wait Retry-After seconds.
Standard error response format.
object
Error detail structure (Stripe-like format).
object
Machine-readable error code
One failing field of a validation error.
object
Why the value was refused
Dotted path of the field, e.g. items.0.unit_price.value
Human-readable error message
Error type category
Example generated
{ "error": { "code": "example", "details": [ { "message": "example", "param": "example" } ], "doc_url": "example", "message": "example", "param": "example", "type": "example" }, "request_id": "example"}internal_server_error or database_error (type internal_error): our fault. Retry with backoff; quote request_id.
Standard error response format.
object
Error detail structure (Stripe-like format).
object
Machine-readable error code
One failing field of a validation error.
object
Why the value was refused
Dotted path of the field, e.g. items.0.unit_price.value
Human-readable error message
Error type category
Example generated
{ "error": { "code": "example", "details": [ { "message": "example", "param": "example" } ], "doc_url": "example", "message": "example", "param": "example", "type": "example" }, "request_id": "example"}