Get a membership's loyalty state
const url = 'https://api.loyx.se/partners/v1/memberships/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/loyalty';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://api.loyx.se/partners/v1/memberships/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/loyalty \ --header 'Authorization: Bearer <token>'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).
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Responses
Section titled “Responses”The membership’s current loyalty state.
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”.
object
Current balance in the program’s unit.
The loyalty program backing this membership.
object
Loyalty program id.
Loyalty program name.
The program’s unit label and presentation.
Example generated
{ "balance": 1, "cycle": { "length": 1, "progress_pct": 1, "seq": 1, "started_at": "2026-04-15T12:00:00Z" }, "program": { "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "name": "example" }, "punches": [ "2026-04-15T12:00:00Z" ], "unit": { "currency": "example", "label": "example", "locale": "example", "minor_units": 1, "presentation": "example" }}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"}No membership with the given id in the authenticated company.
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"}