Connect a register, booking tool, website or your own code to a shop's loyalty program: add members, record visits, use rewards, and hear about everything that happens through webhooks. Everything is JSON over https.
The shop's owner creates a key on Integrations in their dashboard. It's shown once; send it on every request. A key only ever reaches its own shop.
curl https://crushitloyalty.com/api/v1/me \ -H "Authorization: Bearer lk_live_…"
Errors come back as { "error": "…" } with 401 (bad key), 404 (not found), 422 (not allowed, with the reason) or 429 (too many requests: slow down and retry). Card limits and fraud guards apply to the API like the counter.
Which shop this API key belongs to.
Returns: { "business": { "id", "name", "slug" } }
Members, newest first (up to 200), or the one with this mobile number.
Returns: { "members": [Member] }
Add a member, or get the card they already have. Consent only when the customer gave it in your system.
Body: { "phone": "+18135550142", "firstName": "Maria", "email"?, "smsConsent"?: false, "emailConsent"?: false, "ageConfirmed"?: false }
Returns: { "created": true, "member": Member }
One member.
Returns: { "member": Member }
Update name, email or tags. A new email address clears email consent.
Body: { "firstName"?, "lastName"?, "email"?, "addTags"?: ["vip"], "removeTags"?: [] }
Returns: { "member": Member }
One card and its member.
Returns: { "card": Member }
Record a visit (the card's limits and fraud guards apply). Send an idempotencyKey so a retry never counts twice.
Body: { "stamps"?: 1, "amount"?: 12.5, "idempotencyKey"?: "order-1042" }
Returns: { "duplicate": false, "delta": 1, "milestones": [], "card": Member }
Rewards waiting to be used.
Returns: { "rewards": [{ "id", "tierId", "name", "issuedAt", "expiresAt" }] }
Use a reward: a stamp card's reward id (from /rewards) or a points card's tier id.
Body: { "rewardId"? | "tierId"?, "choice"?, "idempotencyKey"? }
Returns: { "duplicate": false, "reward": "Free coffee", "card": Member }
The shop's coupons and how often each was used.
Returns: { "coupons": [{ "code", "name", "maxUses", "expiresAt", "active", "uses" }] }
Check a code and record its use (once per customer when a card is given).
Body: { "code": "SUMMER5", "serial"? }
Returns: { "ok": true, "coupon": "$5 off" }
Subscribe an https address to one event.
Body: { "target_url": "https://…", "event": "visit.recorded" }
Returns: { "id" }
Unsubscribe.
Returns: { "ok": true }
Recent real examples of an event (or a made-up one).
Returns: [payload]
Most answers and events carry the member and their card:
{
"serial": "3f2a9c0e1b7d4a6c8e5f1a2b",
"balance": 4,
"lifetimeEarned": 14,
"completions": 1,
"memberId": "…",
"firstName": "Maria",
"lastName": "Lopez",
"phone": "+18135550142",
"email": "maria@example.com",
"smsConsent": true,
"emailConsent": false
}Add an https address on Integrations (or with POST /api/v1/hooks) and pick the events you want. Each one is a POST with { "id", "event", "data" }. Failed deliveries are retried with growing gaps, 6 tries in all.
| member.joined | A customer joined (any way: join page, counter, text, API). |
| member.updated | A customer's name, email, phone or tags changed. |
| visit.recorded | A visit was recorded (stamps or points earned). |
| balance.adjusted | Staff or the API added or took away stamps or points by hand. |
| reward.earned | A customer earned a reward. |
| reward.redeemed | A customer used a reward. |
| wallet.added | A card was saved to Apple Wallet or Google Wallet. |
| wallet.removed | A card was removed from Apple Wallet or Google Wallet. |
| feedback.received | A customer tapped thumbs up or down after a visit. |
| referral.completed | An invited friend made their first visit and both got their thank-you. |
| coupon.used | A coupon code was used at the counter. |
| gift_card.sold | A gift card was sold at the counter. |
The same API key also connects Claude, ChatGPT and other assistants that speak MCP: point them at https://crushitloyalty.com/api/mcp. They can read the shop's numbers and customers and record visits; nothing that sends messages or moves money.
Add or take away stamps or points by hand. The reason is required; the customer sees it.
Body: { "delta": 2, "reason": "Make-good for a late order" }
Returns: { "delta": 2, "milestones": [], "card": Member }
Visits, rewards and changes, newest first.
Returns: { "history": [{ "kind", "delta", "reward", "reason", "location", "at" }] }
| membership.started |
| A paid membership started (or a free trial began). |
| membership.canceled | A membership ended. |
| membership.payment_failed | A membership payment didn't go through. |
| membership.payment | A membership payment came in (online or at the counter). |
| review.received | A new Google review arrived (Reputation add-on). |
| review.negative | A new review at or below the alert level arrived (Reputation add-on). |
Every delivery has X-Loyalty-Signature: t=<unix time>,v1=<hex>, where v1 is the HMAC-SHA256 of <t>.<raw body> with the endpoint's secret (shown when you add it). Refuse old timestamps.
import { createHmac, timingSafeEqual } from "node:crypto";
function verify(rawBody, header, secret) {
const { t, v1 } = Object.fromEntries(header.split(",").map((p) => p.split("=")));
if (Math.abs(Date.now() / 1000 - Number(t)) > 300) return false;
const expected = createHmac("sha256", secret).update(`${t}.${rawBody}`).digest("hex");
return timingSafeEqual(Buffer.from(expected), Buffer.from(v1));
}