Skip to content

Create or upsert a product

POST
/v1/products
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.

Idempotency-Key
Any of:
string

Optional. When provided, retrying with the same key returns the original result.

Media typeapplication/json
ProductCreateRequest

Create a new product in the company’s catalog.

object
brand
Any of:
string
<= 255 characters
categories
Categories

Category labels defined on the company. Must match existing categories.

Array<string>
description
Any of:
string
<= 2000 characters
external_product_id
Any of:
string
>= 1 characters <= 255 characters
identifiers
Identifiers

Typed identifiers (gtin/ean13/ean8/sku/pos). Each (type, value) pair must be unique per company across non-deleted products.

Array<object>
<= 20 items
IdentifierInput

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

object
type
required
Type

Identifier type: gtin, ean13, ean8, sku, or pos.

string
value
required
Value
string
>= 1 characters <= 255 characters
image_link
Any of:
string
<= 2048 characters
is_loyalty_program_eligible
Is Loyalty Program Eligible

When true, purchases of this product accrue loyalty points or stamps.

boolean
default: true
loyx_app_active
Loyx App Active

When true, the product is visible in the consumer LoyX app.

boolean
default: true
loyx_business_app_active
Loyx Business App Active

When true, the product is visible in the LoyX Business (staff) app.

boolean
default: true
name
required
Name

Display name shown in the mobile app and digital receipts.

string
>= 1 characters <= 255 characters
page_url
Any of:
string
<= 2048 characters
price
required
PriceInput

Base price in minor units paired with a currency code.

object
currency
Currency

ISO 4217 currency code

string
default: SEK
value
required
Value

Amount in minor units (e.g. öre, cents)

integer
stores
required
Stores

Stores that carry this product — at least one. Each entry may set a per-store price override.

Array<object>
>= 1 items
ProductStoreInput

Store assortment entry: a store that carries the product.

object
price
Any of:
PriceInput

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

object
currency
Currency

ISO 4217 currency code

string
default: SEK
value
required
Value

Amount in minor units (e.g. öre, cents)

integer
store_id
required
Store Id

Internal UUID of a store that carries this product.

string format: uuid
unit
Unit

Unit the product is sold in (ea, kg, g, l, ml, m, pack). Defaults to ea (each).

string
default: ea

A product with this external_product_id existed and was updated.

A new product was created.

Media typeapplication/json
ProductResponse

Catalog-only product response.

Per-store pricing lives in the stores_products schemas (GET /stores/{store_id}/products).

object
_id
required
Id
string format: uuid
brand
Any of:
string
categories
Categories
Array<string>
company_category
Any of:
string
company_display_name
Any of:
string
company_logo_url
Any of:
string
created_at
required
Created At
string format: date-time
description
Any of:
string
external_product_id
Any of:
string
identifiers
Identifiers
Array<object>
IdentifierResponse

Typed product identifier in API responses.

object
type
required
Type
string
value
required
Value
string
image_link
Any of:
string
is_loyalty_program_eligible
required
Is Loyalty Program Eligible
boolean
loyx_app_active
required
Loyx App Active
boolean
loyx_business_app_active
required
Loyx Business App Active
boolean
name
required
Name
string
page_url
Any of:
string
price
required
Any of:
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.

object
currency
Currency

ISO 4217 currency code

string
default: SEK
locale
required
Locale

RFC 5646 locale for formatting (e.g. sv-SE)

string
minor_units
required
Minor Units

Divisor to convert to major units (e.g. 100 for SEK)

integer
value
required
Value

Amount in minor units (e.g. öre, cents)

integer
unit
required
Unit
string
updated_at
required
Updated At
string format: date-time

Example

{
"price": {
"currency": "SEK"
}
}

missing_token, invalid_authorization_header or invalid_token: get a new access token and retry once.

Media typeapplication/json
ErrorResponse

Standard error response format.

object
error
required
ErrorDetail

Error detail structure (Stripe-like format).

object
code
required
Code

Machine-readable error code

string
details
Any of:
Array<object>
FieldErrorDetail

One failing field of a validation error.

object
message
required
Message

Why the value was refused

string
param
required
Param

Dotted path of the field, e.g. items.0.unit_price.value

string
doc_url
Any of:
string
message
required
Message

Human-readable error message

string
param
Any of:
string
type
required
Type

Error type category

string
request_id
Any of:
string

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.

Media typeapplication/json
ErrorResponse

Standard error response format.

object
error
required
ErrorDetail

Error detail structure (Stripe-like format).

object
code
required
Code

Machine-readable error code

string
details
Any of:
Array<object>
FieldErrorDetail

One failing field of a validation error.

object
message
required
Message

Why the value was refused

string
param
required
Param

Dotted path of the field, e.g. items.0.unit_price.value

string
doc_url
Any of:
string
message
required
Message

Human-readable error message

string
param
Any of:
string
type
required
Type

Error type category

string
request_id
Any of:
string

Example generated

{
"error": {
"code": "example",
"details": [
{
"message": "example",
"param": "example"
}
],
"doc_url": "example",
"message": "example",
"param": "example",
"type": "example"
},
"request_id": "example"
}

Validation Error

Media typeapplication/json
ErrorResponse

Standard error response format.

object
error
required
ErrorDetail

Error detail structure (Stripe-like format).

object
code
required
Code

Machine-readable error code

string
details
Any of:
Array<object>
FieldErrorDetail

One failing field of a validation error.

object
message
required
Message

Why the value was refused

string
param
required
Param

Dotted path of the field, e.g. items.0.unit_price.value

string
doc_url
Any of:
string
message
required
Message

Human-readable error message

string
param
Any of:
string
type
required
Type

Error type category

string
request_id
Any of:
string

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.

Media typeapplication/json
ErrorResponse

Standard error response format.

object
error
required
ErrorDetail

Error detail structure (Stripe-like format).

object
code
required
Code

Machine-readable error code

string
details
Any of:
Array<object>
FieldErrorDetail

One failing field of a validation error.

object
message
required
Message

Why the value was refused

string
param
required
Param

Dotted path of the field, e.g. items.0.unit_price.value

string
doc_url
Any of:
string
message
required
Message

Human-readable error message

string
param
Any of:
string
type
required
Type

Error type category

string
request_id
Any of:
string

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.

Media typeapplication/json
ErrorResponse

Standard error response format.

object
error
required
ErrorDetail

Error detail structure (Stripe-like format).

object
code
required
Code

Machine-readable error code

string
details
Any of:
Array<object>
FieldErrorDetail

One failing field of a validation error.

object
message
required
Message

Why the value was refused

string
param
required
Param

Dotted path of the field, e.g. items.0.unit_price.value

string
doc_url
Any of:
string
message
required
Message

Human-readable error message

string
param
Any of:
string
type
required
Type

Error type category

string
request_id
Any of:
string

Example generated

{
"error": {
"code": "example",
"details": [
{
"message": "example",
"param": "example"
}
],
"doc_url": "example",
"message": "example",
"param": "example",
"type": "example"
},
"request_id": "example"
}