From zero to your first API call in under 5 minutes.
Step 02
After signing in, your test key appears in the dashboard. It looks like this:
sk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxTest keys start with sk_test_. Live keys start with sk_live_.
Step 03
A campaign defines what a member earns — points, a tangible reward (coupon, gift card, free item), or both. We'll start with a simple Spend & Earn points campaign, then activate it.
# Step 1: Create a Spend & Earn campaign (1 point per R1 spent)
curl -X POST "https://loyalty-engine-production-e5cb.up.railway.app/v1/tenants/$TENANT_ID/campaigns" \
-H "X-API-Key: sk_test_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Spend & Earn",
"earningRule": {
"type": "SPEND_PERCENTAGE",
"percentage": 1
}
}'
# Step 2: Activate it (campaigns start in DRAFT state)
curl -X POST "https://loyalty-engine-production-e5cb.up.railway.app/v1/tenants/$TENANT_ID/campaigns/$CAMPAIGN_ID/activate" \
-H "X-API-Key: sk_test_YOUR_KEY"Campaigns must be in ACTIVE state to fire. All ten rule types are in the Campaigns guide.
Step 04
Call /evaluate at checkout. The engine awards points and issues any rewards from matching campaigns. Members are auto-created on first call — no pre-registration needed.
curl -X POST "https://loyalty-engine-production-e5cb.up.railway.app/v1/tenants/$TENANT_ID/transactions/evaluate" \
-H "X-API-Key: sk_test_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"transactionRef": "receipt_001",
"memberRef": "customer_27821234567",
"amount": 15000
}'
# Response:
# {
# "pointsAwarded": 150,
# "pointsBalance": 150,
# "memberCreated": true,
# "campaigns": [{ "campaignName": "Spend & Earn", "pointsEarned": 150, "rewardIds": [] }]
# }amount is in cents — R150.00 = 15000. memberRef is your customer's ID. Each campaign returns a rewardIds array — empty here, but populated when a campaign issues a coupon, gift card, or free item. Resolve them via GET /members/:id/rewards.
Step 05
Fetch the member to confirm points were awarded and see their full profile.
curl "https://loyalty-engine-production-e5cb.up.railway.app/v1/tenants/$TENANT_ID/members?ref=customer_27821234567" \
-H "X-API-Key: sk_test_YOUR_KEY"