Rewards
Tangible rewards — coupons, gift cards, discount vouchers, and free items — are issued automatically when a campaign fires. Use these endpoints to list, retrieve, and manage rewards for your members. Subscribe to the reward.issued webhook to be notified when a code is ready.
Fulfilment flow
Campaign fires → reward row created (PENDING_FULFILMENT)
→ fulfilment worker generates code → state → ISSUED
→ reward.issued webhook fires
Reward States
PENDING_FULFILMENTReward row created; fulfilment worker has not yet generated the code. Usually resolves within seconds.
ISSUEDCode generated and ready for the member to use. The reward.issued webhook fires on this transition.
EXPIREDReward passed its expiry date or was manually expired via the API.
FAILEDFulfilment worker exhausted all retries. Inspect the reward record for the error detail.
Reward Types
The value envelope shape varies by rewardType:
Endpoints
/tenants/{tenantId}/members/{memberId}/rewardsList all rewards for a member. Filter by state: ISSUED · PENDING_FULFILMENT · EXPIRED · FAILED.
/tenants/{tenantId}/rewardsList all rewards across the tenant. Supports memberId, state, and rewardType filters.
/tenants/{tenantId}/rewards/{rewardId}Retrieve a single reward by ID, including current state, value envelope, and timestamps.
/tenants/{tenantId}/rewards/{rewardId}/redeemMark a reward as redeemed at the point of use. Idempotent — safe to call twice.
/tenants/{tenantId}/rewards/{rewardId}/expireManually expire a reward before its natural expiry date.
List member rewards
curl "https://loyalty-engine-production-e5cb.up.railway.app/v1/tenants/$TENANT_ID/members/$MEMBER_ID/rewards" \
-H "X-API-Key: sk_test_YOUR_KEY"Reward object
{
"id": "rwd_01HX...",
"memberId": "9f4c2e8a-...",
"campaignId": "5a7b3c9d-...",
"state": "ISSUED",
"rewardType": "DISCOUNT_VOUCHER",
"value": {
"discountType": "PERCENTAGE",
"value": 15,
"description": "Happy Birthday — 15% off your next purchase",
"code": "BDAY-A3X9-K2P1"
},
"issuedAt": "2026-01-15T10:30:00.000Z",
"expiresAt": "2026-02-15T23:59:59.000Z",
"redeemedAt": null
}Redeem a reward
curl -X POST "https://loyalty-engine-production-e5cb.up.railway.app/v1/tenants/$TENANT_ID/rewards/$REWARD_ID/redeem" \
-H "X-API-Key: sk_test_YOUR_KEY"
# Response:
# {
# "id": "rwd_01HX...",
# "state": "REDEEMED",
# "redeemedAt": "2026-01-15T14:22:00.000Z"
# }Poll GET /members/:memberId/rewards after calling evaluate() or processEvent() to retrieve issued codes. Or subscribe to reward.issued for a push notification when codes are ready.