Points, tiers, rewards, and gift cards through one clean API. Idempotent by design, tenant-isolated, metered per plan — integrate in an afternoon, run it for years.
Open dashboard → Quickstart API reference PricingConfigurable points-per-dollar, tier thresholds and multipliers. Automatic tier upgrades the moment a customer crosses a threshold.
Issue, redeem, refund, disable. Exact integer-cents math, no over-redemption, automatic depletion state.
Every earn, redeem and gift-card transaction takes an idempotencyKey. Retries replay the original result — never a double charge.
Every points movement is written to an immutable per-customer ledger with balance snapshots. Paginated API included.
Define redeemable rewards with point costs; redeem by reward or raw points and get the dollar discount back.
customer.tier_changed and gift_card.depleted, signed with HMAC-SHA256 (X-Loyara-Signature).
curl -X POST https://yagno-loyara.fly.dev/api/auth/signup \
-H "Content-Type: application/json" \
-d '{"email":"you@business.com","password":"s3cure-pass","companyName":"Blue Fork Cafe"}'
curl -X POST https://yagno-loyara.fly.dev/api/keys \
-H "Authorization: Bearer <JWT from signup>" \
-d '{"name":"production"}' -H "Content-Type: application/json"
curl -X POST https://yagno-loyara.fly.dev/v1/customers \
-H "Authorization: Bearer sk_loyara_..." -H "Content-Type: application/json" \
-d '{"phone":"+16045551234","name":"Priya"}'
curl -X POST https://yagno-loyara.fly.dev/v1/earn \
-H "Authorization: Bearer sk_loyara_..." -H "Content-Type: application/json" \
-d '{"phone":"+16045551234","amountSpent":42.50,"orderRef":"ORD-1042","idempotencyKey":"ORD-1042-earn"}'
Dashboard routes use your JWT. All /v1 routes authenticate with Authorization: Bearer sk_loyara_…. Errors always return {"error":{"code","message"}}.
| Endpoint | Description |
|---|---|
POST/api/auth/signup | Create account → JWT. Starts a 14-day trial. |
POST/api/auth/login | Login → JWT (7 days). |
GET/api/auth/me | Current account, plan and trial state. |
POSTGETDEL/api/keys | Create (returns full key once), list, revoke API keys. |
GET/api/usage | This month's metered counters + plan limits. |
POST/api/billing/checkout · /portal · /webhook | Stripe subscription lifecycle (simulated mode without a key). |
GETPUT/v1/program | Loyalty config: pointsPerDollar, redemptionValue, tiers (ascending minPoints). |
POST/v1/customers | Upsert by externalId / phone / email. |
GET/v1/customers/:id · ?phone=|email=|externalId= | Fetch or search customers. |
GET/v1/customers/:id/ledger | Paginated points audit trail. |
POST/v1/earn | points = floor(amountSpent × pointsPerDollar × tierMultiplier). Idempotent. |
POST/v1/redeem | Redeem points or a reward → dollar discountValue. 422 if balance short. |
POST/v1/adjust | Manual ± balance adjustment with a note. |
POSTGETPUTDEL/v1/rewards | Rewards catalog CRUD. |
POST/v1/gift-cards | Issue a card → GC-XXXX-XXXX-XXXX. |
GET/v1/gift-cards/:code | Balance & status. |
POST/v1/gift-cards/:code/redeem · /refund · /disable | Redeem (rejects over-balance), refund (never beyond spent), freeze. |
POSTGETDEL/v1/webhooks | Manage signed outbound webhooks. |
GET/api/health | Liveness + DB state. |
Every plan starts with a 14-day free trial — no credit card. A metered event is one earn, redeem, or gift-card transaction.