loyaltyl∞p.in Developer API
Full programmatic access to your loyalty platform — manage customers, stamps, rewards, campaigns, branches, scratch cards, and analytics from any app or POS system.
Authentication
Pass your API key on every request using either header:
X-Api-Key: YOUR_API_KEY # or Authorization: Bearer YOUR_API_KEY
Rate Limits
| Plan | Limit | Headers |
|---|---|---|
| Growth | 60 / minute | X-RateLimit-Limit, X-RateLimit-Remaining |
| Pro | 300 / minute | X-RateLimit-Limit, X-RateLimit-Remaining |
| Trial / Basic | API not available — upgrade to Growth or Pro | |
Error Codes
| Code | Meaning |
|---|---|
| 200 | Success |
| 201 | Created — resource was successfully created |
| 400 | Bad request — missing or invalid parameter |
| 401 | Unauthorized — missing or invalid API key |
| 403 | Forbidden — plan does not include this feature |
| 404 | Not found |
| 409 | Conflict — e.g. customer already enrolled, campaign already sent |
| 429 | Rate limit exceeded — check Retry-After header |
Business
/api/businessGet business profile
Returns your business profile, address, plan, and active loyalty program details.
curl -H "X-Api-Key: YOUR_KEY" https://loyaltyloop.in/api/business
{"data":{"id":1,"business_name":"Sunrise Cafe","business_type":"Cafe / Coffee Shop","phone":"9876543210","address":"12 MG Road","city":"Bengaluru","state":"Karnataka","plan":"professional","join_url":"https://loyaltyloop.in/join/a3f9c2","program":{"program_name":"Sunrise Stamps","stamps_required":8,"reward_description":"Free coffee","birthday_bonus_stamps":2}}}/api/businessUpdate business profile
Update any combination of profile fields. Returns the updated business object.
| Name | Type | Required | Description |
|---|---|---|---|
| business_name | string | optional | Business display name |
| business_type | string | optional | Type of business |
| phone | string | optional | Contact phone |
| address | string | optional | Street address |
| city | string | optional | City |
| state | string | optional | State |
| pincode | string | optional | Postal code |
| gstin | string | optional | GST number |
curl -X PATCH -H "X-Api-Key: YOUR_KEY" -H "Content-Type: application/json" \
-d '{"phone":"9999999999","city":"Mumbai"}' \
https://loyaltyloop.in/api/business{"data":{"id":1,"business_name":"Sunrise Cafe","phone":"9999999999","city":"Mumbai",...}}/api/programGet loyalty program
Returns the active loyalty program configuration.
curl -H "X-Api-Key: YOUR_KEY" https://loyaltyloop.in/api/program
{"data":{"id":3,"program_name":"Sunrise Stamps","stamps_required":8,"reward_description":"Free coffee","birthday_bonus_stamps":2,"is_active":true}}/api/programUpdate loyalty program
Update stamps required, reward description, or birthday bonus.
| Name | Type | Required | Description |
|---|---|---|---|
| program_name | string | optional | Programme display name |
| stamps_required | integer | optional | Stamps needed for a reward (2–50) |
| reward_description | string | optional | What the customer receives |
| terms_conditions | string | optional | Programme T&Cs |
| birthday_bonus_stamps | integer | optional | Extra stamps on birthday (1–10) |
curl -X PATCH -H "X-Api-Key: YOUR_KEY" -H "Content-Type: application/json" \
-d '{"stamps_required":10,"reward_description":"Free slice of cake"}' \
https://loyaltyloop.in/api/program{"data":{"id":3,"program_name":"Sunrise Stamps","stamps_required":10,"reward_description":"Free slice of cake",...}}Customers
/api/customersList customers
Paginated, searchable list of loyalty members.
| Name | Type | Description |
|---|---|---|
| page | integer | Page number (default: 1) |
| per_page | integer | Max 100, default 20 |
| q | string | Search by name, email, or phone |
curl -H "X-Api-Key: YOUR_KEY" "https://loyaltyloop.in/api/customers?page=1&per_page=20&q=priya"
{"data":[{"id":12,"name":"Priya Sharma","email":"priya@example.com","phone":"9876543210","current_stamps":5,"pending_rewards":1,"total_visits":14,"rewards_redeemed":2,"joined_at":"2025-11-04 10:22:00","last_visit":"2026-05-30 15:44:00","stamps_required":8}],"meta":{"total":248,"page":1,"per_page":20,"pages":13}}/api/customers/{id}Get customer
Single customer with last 20 transactions including branch info.
curl -H "X-Api-Key: YOUR_KEY" https://loyaltyloop.in/api/customers/12
{"data":{"id":12,"name":"Priya Sharma","current_stamps":5,"pending_rewards":1,"total_visits":14,"stamps_required":8,"recent_activity":[{"transaction_type":"stamp_add","stamps_added":1,"branch_id":2,"branch_name":"Koramangala","created_at":"2026-05-30 15:44:00"}]}}/api/customersEnrol a customer
Register a new customer. Returns their QR code and card URL.
| Name | Type | Required | Description |
|---|---|---|---|
| name | string | required | Customer full name |
| phone | string | optional | Mobile number (phone or email required) |
| string | optional | Email address (phone or email required) | |
| birthday | string | optional | Date of birth in YYYY-MM-DD format |
curl -X POST -H "X-Api-Key: YOUR_KEY" -H "Content-Type: application/json" \
-d '{"name":"Rahul Mehta","phone":"9123456780"}' \
https://loyaltyloop.in/api/customers{"data":{"id":249,"qr_code":"a3f9c2d14b8e1f2a","card_url":"https://loyaltyloop.in/card/a3f9c2d14b8e1f2a"}}/api/customers/{id}Delete customer
Permanently removes the customer and all their stamps and transactions.
curl -X DELETE -H "X-Api-Key: YOUR_KEY" https://loyaltyloop.in/api/customers/12
{"data":{"deleted":true,"id":12}}Stamps
/api/stamps/addAdd stamps
Add one or more stamps to a customer by QR code. Pass branch_id to record which location gave the stamp (use GET /branches/nearest to resolve from GPS). If the stamp goal is met, the card resets and reward_earned is true.
| Name | Type | Required | Description |
|---|---|---|---|
| qr_code | string | required | Customer QR code from their loyalty card |
| count | integer | optional | Stamps to add (1–10, default: 1) |
| branch_id | integer | optional | Branch that issued the stamp — for multi-location tracking |
curl -X POST -H "X-Api-Key: YOUR_KEY" -H "Content-Type: application/json" \
-d '{"qr_code":"a3f9c2d14b8e1f2a","count":1,"branch_id":2}' \
https://loyaltyloop.in/api/stamps/add{"data":{"customer_id":12,"stamps_added":1,"current_stamps":6,"goal":8,"reward_earned":false,"pending_rewards":1,"branch_id":2}}Rewards
/api/rewards/redeemRedeem a reward
Redeems one pending reward for a customer by QR code.
| Name | Type | Required | Description |
|---|---|---|---|
| qr_code | string | required | Customer QR code |
curl -X POST -H "X-Api-Key: YOUR_KEY" -H "Content-Type: application/json" \
-d '{"qr_code":"a3f9c2d14b8e1f2a"}' \
https://loyaltyloop.in/api/rewards/redeem{"data":{"redeemed":true,"reward":"Free coffee","pending_rewards":0,"total_redeemed":3}}/api/rewardsList pending rewards
Customers who currently have rewards ready to redeem.
curl -H "X-Api-Key: YOUR_KEY" https://loyaltyloop.in/api/rewards
{"data":[{"id":12,"name":"Priya Sharma","phone":"9876543210","pending_rewards":2,"qr_code":"a3f9c2d14b8e1f2a"}],"meta":{"total":8,"page":1,"per_page":20}}Transactions
/api/transactionsList transactions
Paginated transaction history with branch info. Filter by type, customer, branch, or date range.
| Name | Type | Description |
|---|---|---|
| page | integer | Page number (default: 1) |
| per_page | integer | Max 100, default 50 |
| type | string | Filter: stamp_add or reward_redeem |
| customer_id | integer | Filter by customer ID |
| branch_id | integer | Filter by branch ID |
| date_from | string | Start date (YYYY-MM-DD) |
| date_to | string | End date (YYYY-MM-DD) |
curl -H "X-Api-Key: YOUR_KEY" \ "https://loyaltyloop.in/api/transactions?type=stamp_add&branch_id=2&date_from=2026-06-01&date_to=2026-06-30"
{"data":[{"id":501,"customer_id":12,"customer_name":"Priya Sharma","transaction_type":"stamp_add","branch_id":2,"branch_name":"Koramangala","stamps_added":1,"redemption_confirmed":null,"created_at":"2026-06-01 15:44:00"}],"meta":{"total":134,"page":1,"per_page":50,"pages":3}}Analytics
/api/statsSummary stats
Key business metrics at a glance.
curl -H "X-Api-Key: YOUR_KEY" https://loyaltyloop.in/api/stats
{"data":{"total_customers":248,"total_stamps":1834,"total_rewards":92,"pending_rewards":14,"active_7d":38,"active_30d":67,"stamps_today":12}}/api/analyticsDetailed analytics
Daily stamp and customer trends, top customers, redemption rate, and per-branch performance breakdown.
| Name | Type | Description |
|---|---|---|
| range | integer | Days to include: 7–90 (default: 30) |
curl -H "X-Api-Key: YOUR_KEY" "https://loyaltyloop.in/api/analytics?range=30"
{"data":{"range_days":30,"stamps_per_day":[{"date":"2026-06-01","stamps":14},...],"new_customers_per_day":[{"date":"2026-06-01","count":3},...],"top_customers":[{"id":12,"name":"Priya Sharma","total_visits":42}],"redemption_rate_pct":87.5,"total_stamps":1834,"total_rewards":92,"branch_performance":[{"id":2,"name":"Koramangala","city":"Bengaluru","stamps":420,"unique_customers":38,"rewards":21,"last_active":"2026-06-01 18:30:00"},{"id":3,"name":"Indiranagar","city":"Bengaluru","stamps":310,"unique_customers":27,"rewards":15,"last_active":"2026-06-01 17:00:00"}],"unassigned_stamps":104}}Campaigns Paid plans only
/api/campaignsList campaigns
Returns all email campaigns for your business.
curl -H "X-Api-Key: YOUR_KEY" https://loyaltyloop.in/api/campaigns
{"data":[{"id":3,"name":"Summer Special","subject":"Double stamps this weekend!","segment_filter":"active_30d","status":"sent","total_recipients":67,"sent_at":"2026-06-01 10:00:00"}]}/api/campaignsCreate campaign
Creates a campaign in draft status. Send it separately.
| Name | Type | Required | Description |
|---|---|---|---|
| name | string | required | Internal campaign name |
| subject | string | required | Email subject line |
| message | string | required | Email body (plain text, newlines supported) |
| segment_filter | string | optional | all | active_30d | near_reward | inactive_60d (default: all) |
curl -X POST -H "X-Api-Key: YOUR_KEY" -H "Content-Type: application/json" \
-d '{"name":"June Promo","subject":"Double stamps this week!","message":"Visit us this week for double stamps.","segment_filter":"active_30d"}' \
https://loyaltyloop.in/api/campaigns{"data":{"id":4,"status":"draft"}}/api/campaigns/{id}/sendSend campaign
Sends a draft campaign to all matching customers. Cannot be undone.
curl -X POST -H "X-Api-Key: YOUR_KEY" https://loyaltyloop.in/api/campaigns/4/send
{"data":{"sent":true,"recipients":67}}/api/campaigns/{id}Delete campaign
Deletes a draft campaign. Sent campaigns cannot be deleted.
curl -X DELETE -H "X-Api-Key: YOUR_KEY" https://loyaltyloop.in/api/campaigns/4
{"data":{"deleted":true}}Scratch Cards Paid plans only
/api/scratch-cardsList campaigns
Returns all scratch card campaigns with issue and win counts.
curl -H "X-Api-Key: YOUR_KEY" https://loyaltyloop.in/api/scratch-cards
{"data":[{"id":1,"name":"Summer Spin","description":"Win free drinks!","is_active":1,"total_issued":48,"total_won":12,"expires_at":"2026-08-31","card_count":48}]}/api/scratch-cardsCreate campaign
Creates a new scratch card campaign with weighted prizes.
| Name | Type | Required | Description |
|---|---|---|---|
| name | string | required | Campaign name |
| description | string | optional | Shown on the card |
| expires_at | string | optional | Campaign expiry date (YYYY-MM-DD) |
| prizes | array | required | Array of prize objects: {label, probability, is_winner} |
curl -X POST -H "X-Api-Key: YOUR_KEY" -H "Content-Type: application/json" \
-d '{"name":"Summer Spin","prizes":[{"label":"Free Coffee","probability":10,"is_winner":true},{"label":"10% Off","probability":30,"is_winner":true},{"label":"Better luck next time","probability":60,"is_winner":false}]}' \
https://loyaltyloop.in/api/scratch-cards{"data":{"id":2,"name":"Summer Spin","is_active":true}}/api/scratch-cards/{id}/issueIssue a card
Issues a scratch card from a campaign to a customer. Returns the card token and shareable URL.
| Name | Type | Required | Description |
|---|---|---|---|
| customer_id | integer | optional | Customer to link the card to (for email notification) |
| expires_days | integer | optional | Card validity in days (default: 30) |
curl -X POST -H "X-Api-Key: YOUR_KEY" -H "Content-Type: application/json" \
-d '{"customer_id":12,"expires_days":14}' \
https://loyaltyloop.in/api/scratch-cards/2/issue{"data":{"id":73,"token":"4f2a9c1e...","card_url":"https://loyaltyloop.in/scratch/4f2a9c1e...","expires_at":"2026-06-16","customer_id":12}}/api/scratch-cards/{id}/togglePause / activate campaign
Toggles a campaign between active and paused.
curl -X POST -H "X-Api-Key: YOUR_KEY" https://loyaltyloop.in/api/scratch-cards/2/toggle
{"data":{"id":2,"is_active":false}}/api/scratch-cards/redeemMark card redeemed
Marks a scratched (revealed) card as physically redeemed by staff. Customer must have opened the card URL first.
| Name | Type | Required | Description |
|---|---|---|---|
| token | string | required | The card token from the issue response |
curl -X POST -H "X-Api-Key: YOUR_KEY" -H "Content-Type: application/json" \
-d '{"token":"4f2a9c1e..."}' \
https://loyaltyloop.in/api/scratch-cards/redeem{"data":{"redeemed":true,"prize_label":"Free Coffee","is_winner":true}}Team Paid plans only
/api/teamList team members
Returns all users attached to your business.
curl -H "X-Api-Key: YOUR_KEY" https://loyaltyloop.in/api/team
{"data":[{"id":1,"name":"Arjun Mehta","email":"arjun@sunrise.com","role":"owner","is_active":1},{"id":7,"name":"Neha Staff","email":"neha@sunrise.com","role":"staff","is_active":1}]}/api/teamAdd staff member
Creates a staff account and emails login credentials. The staff member must change their password on first login.
| Name | Type | Required | Description |
|---|---|---|---|
| name | string | required | Staff member full name |
| string | required | Email address for login |
curl -X POST -H "X-Api-Key: YOUR_KEY" -H "Content-Type: application/json" \
-d '{"name":"Neha Singh","email":"neha@sunrise.com"}' \
https://loyaltyloop.in/api/team{"data":{"id":8,"name":"Neha Singh","email":"neha@sunrise.com","role":"staff","temp_password":"b3f9a2c1d4e5"}}/api/team/{id}Remove staff member
Permanently removes a staff account from your business.
curl -X DELETE -H "X-Api-Key: YOUR_KEY" https://loyaltyloop.in/api/team/8
{"data":{"deleted":true,"id":8}}Branches
Use branches to track stamps per location. The GPS workflow: call GET /branches/nearest with the device GPS to resolve a branch_id, then pass it to POST /stamps/add.
/api/branchesList branches
Returns all branch locations including GPS coordinates.
curl -H "X-Api-Key: YOUR_KEY" https://loyaltyloop.in/api/branches
{"data":[{"id":2,"name":"Koramangala","address":"47 5th Block","city":"Bengaluru","state":"Karnataka","phone":"9876543210","latitude":12.9352,"longitude":77.6245,"is_active":1,"created_at":"2026-01-15 09:00:00"}]}/api/branches/nearestFind nearest branch
Returns the closest active branch to the given GPS coordinates using the Haversine formula. Use this before adding a stamp to auto-detect which branch the customer is at.
| Name | Type | Description |
|---|---|---|
| lat | float | Device latitude (required) |
| lng | float | Device longitude (required) |
curl -H "X-Api-Key: YOUR_KEY" "https://loyaltyloop.in/api/branches/nearest?lat=12.9352&lng=77.6245"
{"data":{"branch_id":2,"name":"Koramangala","address":"47 5th Block","city":"Bengaluru","latitude":12.9352,"longitude":77.6245,"distance_km":0.084,"distance_m":84}}/api/branchesCreate branch
Adds a new branch location. Plan limits apply (Growth: 3, Pro: unlimited).
| Name | Type | Required | Description |
|---|---|---|---|
| name | string | required | Branch display name |
| address | string | optional | Street address |
| city | string | optional | City |
| state | string | optional | State |
| phone | string | optional | Branch phone number |
| latitude | float | optional | GPS latitude — enables nearest-branch lookup |
| longitude | float | optional | GPS longitude |
curl -X POST -H "X-Api-Key: YOUR_KEY" -H "Content-Type: application/json" \
-d '{"name":"Indiranagar","city":"Bengaluru","latitude":12.9784,"longitude":77.6408}' \
https://loyaltyloop.in/api/branches{"data":{"id":3,"name":"Indiranagar","city":"Bengaluru","latitude":12.9784,"longitude":77.6408,"is_active":1,"created_at":"2026-06-02 10:00:00"}}/api/branches/{id}Update branch
Updates any fields of an existing branch.
| Name | Type | Required | Description |
|---|---|---|---|
| name | string | optional | Branch display name |
| address | string | optional | Street address |
| city | string | optional | City |
| state | string | optional | State |
| phone | string | optional | Branch phone |
| latitude | float | optional | GPS latitude (pass null to clear) |
| longitude | float | optional | GPS longitude (pass null to clear) |
curl -X PATCH -H "X-Api-Key: YOUR_KEY" -H "Content-Type: application/json" \
-d '{"latitude":12.9784,"longitude":77.6408}' \
https://loyaltyloop.in/api/branches/3{"data":{"id":3,"name":"Indiranagar","latitude":12.9784,"longitude":77.6408,...}}/api/branches/{id}Delete branch
Deletes a branch. Fails if any transactions have been recorded at this branch.
curl -X DELETE -H "X-Api-Key: YOUR_KEY" https://loyaltyloop.in/api/branches/3
{"data":{"deleted":true,"id":3}}