Skip to content

Look up a membership by identifier

POST
/v1/memberships/lookup
curl --request POST \
--url https://api.loyx.se/partners/v1/memberships/lookup \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "identifier": "membership_id", "value": "example" }'

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.

Media typeapplication/json
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.

object
identifier
required
Identifier

Which field to look up by. One of membership_id, user_id, qr_code, mobile_number, email, national_id.

string
Allowed values: membership_id user_id qr_code mobile_number email national_id
value
required
Value

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.

string
>= 1 characters <= 255 characters

The matching membership, in its polymorphic detail shape.

Media typeapplication/json
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.

object
balance
required
Balance

Program-agnostic primary value: points balance for points, stamp count in the current cycle for stamps.

integer
celebration
required
Celebration

Whether a reward-earned UI should be shown

boolean
created_at
required
Created At
string format: date-time
cycle
required
Cycle

Current cycle number (starts at 1)

integer
cycle_length
Any of:
integer
full_name
required
Full Name

Member’s full name

string
loyalty_program_type
required
Any of:
string
membership_id
required
Membership Id

Membership id

string format: uuid
stamps_dates
Any of:
Array<string>
status
required
MembershipStatus

Membership status

string
Allowed values: active inactive archived
unit
Any of:
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.

object
currency
Any of:
string
label
required
Label

Human label for the unit (e.g. points, stamps).

string
locale
Any of:
string
minor_units
Any of:
integer
presentation
required
Presentation

How the unit is presented: counter, card, or currency.

string
updated_at
required
Updated At
string format: date-time
user_id
required
User Id

Owning user id

string format: uuid

Example

{
"status": "active"
}

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"
}

No membership matches the provided identifier (membership_not_found), or the scanned QR token is expired or invalid (qr_code_not_resolvable).

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"
}

qr_code only — the QR token store is temporarily unreachable. Retry; never treat this as an expired code.

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"
}