REST API — v1

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
Get your key: Settings → API → Generate key. Requires Growth or Pro plan.

Rate Limits

PlanLimitHeaders
Growth60 / minuteX-RateLimit-Limit, X-RateLimit-Remaining
Pro300 / minuteX-RateLimit-Limit, X-RateLimit-Remaining
Trial / BasicAPI not available — upgrade to Growth or Pro

Error Codes

CodeMeaning
200Success
201Created — resource was successfully created
400Bad request — missing or invalid parameter
401Unauthorized — missing or invalid API key
403Forbidden — plan does not include this feature
404Not found
409Conflict — e.g. customer already enrolled, campaign already sent
429Rate limit exceeded — check Retry-After header

Business

GET/api/business

Get business profile

Returns your business profile, address, plan, and active loyalty program details.

Request
curl -H "X-Api-Key: YOUR_KEY" https://loyaltyloop.in/api/business
Response
{"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}}}
PATCH/api/business

Update business profile

Update any combination of profile fields. Returns the updated business object.

Body parameters
NameTypeRequiredDescription
business_namestringoptionalBusiness display name
business_typestringoptionalType of business
phonestringoptionalContact phone
addressstringoptionalStreet address
citystringoptionalCity
statestringoptionalState
pincodestringoptionalPostal code
gstinstringoptionalGST number
Request
curl -X PATCH -H "X-Api-Key: YOUR_KEY" -H "Content-Type: application/json" \
     -d '{"phone":"9999999999","city":"Mumbai"}' \
     https://loyaltyloop.in/api/business
Response
{"data":{"id":1,"business_name":"Sunrise Cafe","phone":"9999999999","city":"Mumbai",...}}
GET/api/program

Get loyalty program

Returns the active loyalty program configuration.

Request
curl -H "X-Api-Key: YOUR_KEY" https://loyaltyloop.in/api/program
Response
{"data":{"id":3,"program_name":"Sunrise Stamps","stamps_required":8,"reward_description":"Free coffee","birthday_bonus_stamps":2,"is_active":true}}
PATCH/api/program

Update loyalty program

Update stamps required, reward description, or birthday bonus.

Body parameters
NameTypeRequiredDescription
program_namestringoptionalProgramme display name
stamps_requiredintegeroptionalStamps needed for a reward (2–50)
reward_descriptionstringoptionalWhat the customer receives
terms_conditionsstringoptionalProgramme T&Cs
birthday_bonus_stampsintegeroptionalExtra stamps on birthday (1–10)
Request
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
Response
{"data":{"id":3,"program_name":"Sunrise Stamps","stamps_required":10,"reward_description":"Free slice of cake",...}}

Customers

GET/api/customers

List customers

Paginated, searchable list of loyalty members.

Query parameters
NameTypeDescription
pageintegerPage number (default: 1)
per_pageintegerMax 100, default 20
qstringSearch by name, email, or phone
Request
curl -H "X-Api-Key: YOUR_KEY" "https://loyaltyloop.in/api/customers?page=1&per_page=20&q=priya"
Response
{"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}}
GET/api/customers/{id}

Get customer

Single customer with last 20 transactions including branch info.

Request
curl -H "X-Api-Key: YOUR_KEY" https://loyaltyloop.in/api/customers/12
Response
{"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"}]}}
POST/api/customers

Enrol a customer

Register a new customer. Returns their QR code and card URL.

Body parameters
NameTypeRequiredDescription
namestringrequiredCustomer full name
phonestringoptionalMobile number (phone or email required)
emailstringoptionalEmail address (phone or email required)
birthdaystringoptionalDate of birth in YYYY-MM-DD format
Request
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
Response
{"data":{"id":249,"qr_code":"a3f9c2d14b8e1f2a","card_url":"https://loyaltyloop.in/card/a3f9c2d14b8e1f2a"}}
DELETE/api/customers/{id}

Delete customer

Permanently removes the customer and all their stamps and transactions.

Request
curl -X DELETE -H "X-Api-Key: YOUR_KEY" https://loyaltyloop.in/api/customers/12
Response
{"data":{"deleted":true,"id":12}}

Stamps

POST/api/stamps/add

Add 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.

Body parameters
NameTypeRequiredDescription
qr_codestringrequiredCustomer QR code from their loyalty card
countintegeroptionalStamps to add (1–10, default: 1)
branch_idintegeroptionalBranch that issued the stamp — for multi-location tracking
Request
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
Response
{"data":{"customer_id":12,"stamps_added":1,"current_stamps":6,"goal":8,"reward_earned":false,"pending_rewards":1,"branch_id":2}}

Rewards

POST/api/rewards/redeem

Redeem a reward

Redeems one pending reward for a customer by QR code.

Body parameters
NameTypeRequiredDescription
qr_codestringrequiredCustomer QR code
Request
curl -X POST -H "X-Api-Key: YOUR_KEY" -H "Content-Type: application/json" \
     -d '{"qr_code":"a3f9c2d14b8e1f2a"}' \
     https://loyaltyloop.in/api/rewards/redeem
Response
{"data":{"redeemed":true,"reward":"Free coffee","pending_rewards":0,"total_redeemed":3}}
GET/api/rewards

List pending rewards

Customers who currently have rewards ready to redeem.

Request
curl -H "X-Api-Key: YOUR_KEY" https://loyaltyloop.in/api/rewards
Response
{"data":[{"id":12,"name":"Priya Sharma","phone":"9876543210","pending_rewards":2,"qr_code":"a3f9c2d14b8e1f2a"}],"meta":{"total":8,"page":1,"per_page":20}}

Transactions

GET/api/transactions

List transactions

Paginated transaction history with branch info. Filter by type, customer, branch, or date range.

Query parameters
NameTypeDescription
pageintegerPage number (default: 1)
per_pageintegerMax 100, default 50
typestringFilter: stamp_add or reward_redeem
customer_idintegerFilter by customer ID
branch_idintegerFilter by branch ID
date_fromstringStart date (YYYY-MM-DD)
date_tostringEnd date (YYYY-MM-DD)
Request
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"
Response
{"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

GET/api/stats

Summary stats

Key business metrics at a glance.

Request
curl -H "X-Api-Key: YOUR_KEY" https://loyaltyloop.in/api/stats
Response
{"data":{"total_customers":248,"total_stamps":1834,"total_rewards":92,"pending_rewards":14,"active_7d":38,"active_30d":67,"stamps_today":12}}
GET/api/analytics

Detailed analytics

Daily stamp and customer trends, top customers, redemption rate, and per-branch performance breakdown.

Query parameters
NameTypeDescription
rangeintegerDays to include: 7–90 (default: 30)
Request
curl -H "X-Api-Key: YOUR_KEY" "https://loyaltyloop.in/api/analytics?range=30"
Response
{"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

GET/api/campaigns

List campaigns

Returns all email campaigns for your business.

Request
curl -H "X-Api-Key: YOUR_KEY" https://loyaltyloop.in/api/campaigns
Response
{"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"}]}
POST/api/campaigns

Create campaign

Creates a campaign in draft status. Send it separately.

Body parameters
NameTypeRequiredDescription
namestringrequiredInternal campaign name
subjectstringrequiredEmail subject line
messagestringrequiredEmail body (plain text, newlines supported)
segment_filterstringoptionalall | active_30d | near_reward | inactive_60d (default: all)
Request
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
Response
{"data":{"id":4,"status":"draft"}}
POST/api/campaigns/{id}/send

Send campaign

Sends a draft campaign to all matching customers. Cannot be undone.

Request
curl -X POST -H "X-Api-Key: YOUR_KEY" https://loyaltyloop.in/api/campaigns/4/send
Response
{"data":{"sent":true,"recipients":67}}
DELETE/api/campaigns/{id}

Delete campaign

Deletes a draft campaign. Sent campaigns cannot be deleted.

Request
curl -X DELETE -H "X-Api-Key: YOUR_KEY" https://loyaltyloop.in/api/campaigns/4
Response
{"data":{"deleted":true}}

Scratch Cards Paid plans only

GET/api/scratch-cards

List campaigns

Returns all scratch card campaigns with issue and win counts.

Request
curl -H "X-Api-Key: YOUR_KEY" https://loyaltyloop.in/api/scratch-cards
Response
{"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}]}
POST/api/scratch-cards

Create campaign

Creates a new scratch card campaign with weighted prizes.

Body parameters
NameTypeRequiredDescription
namestringrequiredCampaign name
descriptionstringoptionalShown on the card
expires_atstringoptionalCampaign expiry date (YYYY-MM-DD)
prizesarrayrequiredArray of prize objects: {label, probability, is_winner}
Request
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
Response
{"data":{"id":2,"name":"Summer Spin","is_active":true}}
POST/api/scratch-cards/{id}/issue

Issue a card

Issues a scratch card from a campaign to a customer. Returns the card token and shareable URL.

Body parameters
NameTypeRequiredDescription
customer_idintegeroptionalCustomer to link the card to (for email notification)
expires_daysintegeroptionalCard validity in days (default: 30)
Request
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
Response
{"data":{"id":73,"token":"4f2a9c1e...","card_url":"https://loyaltyloop.in/scratch/4f2a9c1e...","expires_at":"2026-06-16","customer_id":12}}
POST/api/scratch-cards/{id}/toggle

Pause / activate campaign

Toggles a campaign between active and paused.

Request
curl -X POST -H "X-Api-Key: YOUR_KEY" https://loyaltyloop.in/api/scratch-cards/2/toggle
Response
{"data":{"id":2,"is_active":false}}
POST/api/scratch-cards/redeem

Mark card redeemed

Marks a scratched (revealed) card as physically redeemed by staff. Customer must have opened the card URL first.

Body parameters
NameTypeRequiredDescription
tokenstringrequiredThe card token from the issue response
Request
curl -X POST -H "X-Api-Key: YOUR_KEY" -H "Content-Type: application/json" \
     -d '{"token":"4f2a9c1e..."}' \
     https://loyaltyloop.in/api/scratch-cards/redeem
Response
{"data":{"redeemed":true,"prize_label":"Free Coffee","is_winner":true}}

Team Paid plans only

GET/api/team

List team members

Returns all users attached to your business.

Request
curl -H "X-Api-Key: YOUR_KEY" https://loyaltyloop.in/api/team
Response
{"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}]}
POST/api/team

Add staff member

Creates a staff account and emails login credentials. The staff member must change their password on first login.

Body parameters
NameTypeRequiredDescription
namestringrequiredStaff member full name
emailstringrequiredEmail address for login
Request
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
Response
{"data":{"id":8,"name":"Neha Singh","email":"neha@sunrise.com","role":"staff","temp_password":"b3f9a2c1d4e5"}}
DELETE/api/team/{id}

Remove staff member

Permanently removes a staff account from your business.

Request
curl -X DELETE -H "X-Api-Key: YOUR_KEY" https://loyaltyloop.in/api/team/8
Response
{"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.

GET/api/branches

List branches

Returns all branch locations including GPS coordinates.

Request
curl -H "X-Api-Key: YOUR_KEY" https://loyaltyloop.in/api/branches
Response
{"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"}]}
GET/api/branches/nearest

Find 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.

Query parameters
NameTypeDescription
latfloatDevice latitude (required)
lngfloatDevice longitude (required)
Request
curl -H "X-Api-Key: YOUR_KEY" "https://loyaltyloop.in/api/branches/nearest?lat=12.9352&lng=77.6245"
Response
{"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}}
POST/api/branches

Create branch

Adds a new branch location. Plan limits apply (Growth: 3, Pro: unlimited).

Body parameters
NameTypeRequiredDescription
namestringrequiredBranch display name
addressstringoptionalStreet address
citystringoptionalCity
statestringoptionalState
phonestringoptionalBranch phone number
latitudefloatoptionalGPS latitude — enables nearest-branch lookup
longitudefloatoptionalGPS longitude
Request
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
Response
{"data":{"id":3,"name":"Indiranagar","city":"Bengaluru","latitude":12.9784,"longitude":77.6408,"is_active":1,"created_at":"2026-06-02 10:00:00"}}
PATCH/api/branches/{id}

Update branch

Updates any fields of an existing branch.

Body parameters
NameTypeRequiredDescription
namestringoptionalBranch display name
addressstringoptionalStreet address
citystringoptionalCity
statestringoptionalState
phonestringoptionalBranch phone
latitudefloatoptionalGPS latitude (pass null to clear)
longitudefloatoptionalGPS longitude (pass null to clear)
Request
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
Response
{"data":{"id":3,"name":"Indiranagar","latitude":12.9784,"longitude":77.6408,...}}
DELETE/api/branches/{id}

Delete branch

Deletes a branch. Fails if any transactions have been recorded at this branch.

Request
curl -X DELETE -H "X-Api-Key: YOUR_KEY" https://loyaltyloop.in/api/branches/3
Response
{"data":{"deleted":true,"id":3}}