SDK Reference
@proveanything/smartlinks
Namespaces
loyalty
Loyalty programmes: schemes, earning rules tied to interactions, member balances, transaction ledger, and manual adjustments.
createEarningRule
createEarningRule(collectionId: string,
schemeId: string,
body: ) → Promise<>updateEarningRule
updateEarningRule(collectionId: string,
schemeId: string,
ruleId: string,
body: ) → Promise<>removeEarningRule
removeEarningRule(collectionId: string,
schemeId: string,
ruleId: string) → Promise<>listMembers
listMembers(collectionId: string,
schemeId: string,
params: = {}) → Promise<LoyaltyPaginatedResult<>>getMember
getMember(collectionId: string,
schemeId: string,
contactId: string) → Promise<>recordTransaction
Manually award or deduct points for a contact. - points must be a non-zero integer - Positive = award, negative = deduct - Deducting below zero returns HTTP 422 INSUFFICIENT_BALANCE - Supply idempotencyKey to safely retry without double-crediting Points earned via interaction events are awarded automatically by the server — this endpoint is for manual adjustments and admin overrides.
recordTransaction(collectionId: string,
schemeId: string,
contactId: string,
body: ) → Promise<>getMemberHistory
Manually award or deduct points for a contact. - points must be a non-zero integer - Positive = award, negative = deduct - Deducting below zero returns HTTP 422 INSUFFICIENT_BALANCE - Supply idempotencyKey to safely retry without double-crediting Points earned via interaction events are awarded automatically by the server — this endpoint is for manual adjustments and admin overrides.
getMemberHistory(collectionId: string,
schemeId: string,
contactId: string,
params: = {}) → Promise<LoyaltyPaginatedResult<>>publicList
List active schemes for a collection. No authentication required.
publicList(collectionId: string) → Promise<[]>publicGet
Get a single active scheme. No authentication required.
publicGet(collectionId: string,
schemeId: string) → Promise<>publicListEarningRules
List active earning rules for a scheme — useful for showing "how to earn" in a loyalty UI. No authentication required.
publicListEarningRules(collectionId: string,
schemeId: string) → Promise<[]>publicGetMe
Get all active schemes with the caller's membership embedded in each. This is the primary entry point for a loyalty widget — one call gives you everything needed to render a user's loyalty status across all programs in a collection. - Authenticated: member is populated with balance + lifetimePoints (or null if not yet enrolled in that scheme) - Unauthenticated: member is null on all schemes
publicGetMe(collectionId: string) → Promise<LoyaltySchemeWithMembership[]>publicGetMine
Get the authenticated caller's membership (balance + lifetimePoints) on a specific scheme. Requires authentication.
publicGetMine(collectionId: string,
schemeId: string) → Promise<>publicGetMineHistory
Get the authenticated caller's transaction history on a specific scheme. Ordered newest first. Requires authentication.
publicGetMineHistory(collectionId: string,
schemeId: string,
params: = {}) → Promise<LoyaltyPaginatedResult<>>list
list(collectionId: string,
params: { includeDeleted?: boolean } = {}) → Promise<[]>get
get(collectionId: string,
schemeId: string) → Promise<>create
create(collectionId: string,
body: ) → Promise<>update
update(collectionId: string,
schemeId: string,
body: ) → Promise<>remove
remove(collectionId: string,
schemeId: string) → Promise<>listEarningRules
listEarningRules(collectionId: string,
schemeId: string) → Promise<[]>getEarningRule
getEarningRule(collectionId: string,
schemeId: string,
ruleId: string) → Promise<>