Appearance
Referrals
Apply referral codes and inspect the referrals or reward transactions associated with a customer.
Access labels such as Origin + Brand key + Customer are defined in Headers and access. Each endpoint ends in a Try it console; set the host and keys once in its Settings tab or on the overview.
Get all referrals
| Method | URL path | Required access |
|---|---|---|
GET | /api/v1/user/loyalty/referred | Origin + Brand key + Customer |
Request fields: no body, query, or path fields are read by this controller. Context comes from the headers/middleware above.
Example:
bash
curl -X GET "$BASE_URL/api/v1/user/loyalty/referred" \
-H "Origin: $ORIGIN" \
-H "api-key: $API_KEY" \
-H "Authorization: Bearer $CUSTOMER_TOKEN"Response: JSON with success: true and result containing the operation’s service data.
Source: app/v1/controller/loyalty_controller.js:210 → getAllReferrals; routes: routes/v1/loyalty_route.js:244; service: _getAllLoyaltyReferrals (app/v1/service/loyalty_service.js:365).
Post login referral
| Method | URL path | Required access |
|---|---|---|
POST | /api/v1/user/loyalty/refer | Origin + Brand key + Customer |
Request fields:
| Field | Type | Required | Rules / meaning |
|---|---|---|---|
body.payload | object | yes | — |
body.payload.referralCode | string | yes | Whitespace trimmed |
Example:
bash
curl -X POST "$BASE_URL/api/v1/user/loyalty/refer" \
-H "Origin: $ORIGIN" \
-H "api-key: $API_KEY" \
-H "Authorization: Bearer $CUSTOMER_TOKEN" \
-H 'Content-Type: application/json' \
--data-raw '{"payload":{"referralCode":"example"}}'Response: JSON with success: true and result containing the operation’s service data.
Source: app/v1/controller/loyalty_controller.js:228 → postLoginReferral; routes: routes/v1/loyalty_route.js:294; service: _postLoginReferral (app/v1/service/loyalty_service.js:405).
List referral point transactions
Lists the loyalty transactions tied to the current customer's referral record. Fails with Referral not found for the user when the customer has none. For the full points history, use List loyalty point transactions.
| Method | URL path | Required access |
|---|---|---|
GET | /api/v1/user/loyalty/referral-transactions | Origin + Brand key + Customer |
Request fields: no body, query, or path fields are read by this controller. Context comes from the headers/middleware above.
Example:
bash
curl -X GET "$BASE_URL/api/v1/user/loyalty/referral-transactions" \
-H "Origin: $ORIGIN" \
-H "api-key: $API_KEY" \
-H "Authorization: Bearer $CUSTOMER_TOKEN"Response: JSON with success: true and result containing the operation’s service data.
Source: app/v1/controller/referral_controller.ts:22 → getAllLoyaltyTransactions; routes: routes/v1/referral_route.ts:30; service: _getAllLoyaltyTransactions (app/v1/service/referral_service.ts:51).