Docs/API reference/API overview
API overview
The partner-facing HTTP surface for storing signed actions and reading public loyalty activity.
API URL#
Examples use production-style URLs. Local development defaults to port 8788.
Production: https://api.loyfin.com
Local: http://127.0.0.1:8788Upcoming release: the @loyfin/server TypeScript SDK is implemented but not yet published to npm. It will wrap session APIs, produce EIP-712 typed data for your own signer, and verify Loyfin webhook signatures without accepting private keys. Use the JavaScript fetch or curl examples for production integrations today.
Preview the upcoming SDK
# Upcoming release — not yet published to npm
# Use the JavaScript fetch or curl examples today.
# npm install @loyfin/serverimport { Loyfin, issuanceTypedData } from "@loyfin/server";
const loyfin = new Loyfin({ apiKey: process.env.LOYFIN_API_KEY });
const typedData = issuanceTypedData(issuance);
const signature = await issuerSigner.signTypedData(typedData);
const { issuance: session, duplicate } = await loyfin.issuances.create({
issuance,
signature,
to: verifiedWallet
});
// Show session.checkoutUrl when the recipient still needs to sign.import { Loyfin, redemptionTypedData } from "@loyfin/server";
const loyfin = new Loyfin({ apiKey: process.env.LOYFIN_API_KEY });
const typedData = redemptionTypedData(redemption);
const signature = await issuerSigner.signTypedData(typedData);
const { redemption: session, duplicate } = await loyfin.redemptions.create({
redemption,
signature,
from: verifiedWallet
});
// Show session.checkoutUrl when the holder still needs to sign.Pagination#
List endpoints use cursor pagination. Send limit from 1 to 100 and pass page.nextCursor as cursor for the next page.
{
"items": [],
"page": {
"limit": 25,
"nextCursor": null,
"hasMore": false
}
}Status values#
requires_wallet_authorizationAwaiting wallet authorizationpendingCreatedsubmittedSubmittedminedCompletedrejectedRejectedcancelledCancelledexpiredExpiredHTTP endpoints#
/issuancesCreate a brand-signed issuance checkout session.
Auth: API key or issuer JWT/sessionReturns: { ok, duplicate, issuance }/issuancesList completed issuance events.
Auth: publicQuery: cursor, limit, chainId, issuer, to, loyaltyId, token, operationHashReturns: Page<Issuance>/issuances/:idRead issuance checkout state. A claim token is required for wallet-authorized sessions.
Auth: publicQuery: claimReturns: { issuance: IssuanceSession }/issuances/:idAttach the recipient wallet signature.
Auth: Opaque claim tokenReturns: { ok, issuance }/redemptionsCreate a brand-signed redemption checkout session.
Auth: API key or issuer JWT/sessionReturns: { ok, duplicate, redemption }/redemptionsList completed burn events.
Auth: publicQuery: cursor, limit, chainId, issuer, from, loyaltyId, token, operationHashReturns: Page<Redemption>/redemptions/:idRead redemption checkout state. A claim token is required for wallet-authorized sessions.
Auth: publicQuery: claimReturns: { redemption: RedemptionSession }/redemptions/:idAttach the holder wallet signature.
Auth: Opaque claim tokenReturns: { ok, redemption }/operationsList signed issuance/redemption actions.
Auth: publicQuery: cursor, limit, chainId, kind, status, issuer, loyaltyId, operationHashReturns: Page<SignedOperation>/operations/:idRead one signed operation.
Auth: publicReturns: { operation: SignedOperation }/tokensList indexed loyalty programs.
Auth: publicQuery: cursor, limit, chainId, issuer, loyaltyId, qReturns: Page<LoyaltyToken>/tokens/:idRead one indexed loyalty program.
Auth: publicReturns: { token: LoyaltyToken }/issuersList issuer-level aggregates.
Auth: publicQuery: cursor, limit, chainId, qReturns: Page<Issuer>/issuers/:addressRead one issuer aggregate.
Auth: publicQuery: chainIdReturns: { issuer: Issuer }/transfersList completed transfer events.
Auth: publicQuery: cursor, limit, chainId, from, to, token, issuerReturns: Page<Transfer>/balances/:addressList program-level balances for a wallet.
Auth: publicQuery: cursor, limit, chainId, token, tokens, issuerReturns: Page<ProgramBalance>/balances/:address/batchesList expiry-bucket balances for a wallet.
Auth: publicQuery: cursor, limit, chainId, token, tokens, issuerReturns: Page<BatchBalance>/auth/sessionCreate or link an issuer account and provision its user-owned issuer wallet.
Auth: Privy access tokenReturns: Account and issuer wallet/users/me/issuer-walletRead the account’s issuer wallet.
Auth: Privy access tokenReturns: Wallet ID and address/users/me, /users/me/settingsRead or update the authenticated account.
Auth: Privy access tokenReturns: Account response/users/me/api-key, /users/me/api-key/rotateInspect or rotate the account API key.
Auth: Privy access tokenReturns: API-key metadata; new secret shown once/users/me/webhooks/*Manage up to five account webhook endpoints, rotate secrets, and inspect deliveries.
Auth: Privy access tokenReturns: Webhook settings and deliveries/openapi.jsonOpenAPI 3.1 import document.
Auth: publicReturns: OpenAPI/statusService state, environment, database flag, webhook metadata.
Auth: publicReturns: { ok, service, version, environment, ... }/healthBasic uptime check.
Auth: publicReturns: { ok, service, version }